Skip to content

Commit

Permalink
Added wall randomization with different boxes and paintings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico-242 committed Oct 8, 2024
1 parent a1d150d commit e5ba3b5
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 7 deletions.
Binary file added assets/WallBoxDoubleSlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/WallBoxSlash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/WallBoxSlashReverse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 26 additions & 1 deletion create1.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,32 @@ function create1() {
for(i=0; i<arr1.length; i++){
for(j=0;j<arr1[i].length;j++){
if(arr1[i][j]==9){
wall.create(j*40+20,i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}
//wall.create(j*40+20,i*40+20, "wall");
}
else if (arr1[i][j] == 1){
wall.create(j*40+20, i*40+20, "void");
Expand Down
27 changes: 26 additions & 1 deletion create2.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,32 @@ function create2() {
for(i=0; i<arr2.length; i++){
for(j=0;j<arr2[i].length;j++){
if(arr2[i][j]==9){
wall.create(j*40+20,i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}
//wall.create(j*40+20,i*40+20, "wall");
}
else if (arr2[i][j] == 1){
wall.create(j*40+20, i*40+20, "void");
Expand Down
27 changes: 26 additions & 1 deletion create3.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,32 @@ function create3() {
for (i = 0; i < arr3.length; i++){
for(j=0; j < arr3[i].length; j++){
if(arr3[i][j]==9){
wall.create(j*40+20,i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}
//wall.create(j*40+20,i*40+20, "wall");
}
else if (arr3[i][j] == 1){
wall.create(j*40+20, i*40+20, "void");
Expand Down
27 changes: 26 additions & 1 deletion create4.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,32 @@ function create4() {
for(i=0; i<arr4.length; i++){
for(j=0;j<arr4[i].length;j++){
if(arr4[i][j]==9){
wall.create(j*40+20,i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}
//wall.create(j*40+20,i*40+20, "wall");
}
else if (arr4[i][j] == 1){
wall.create(j*40+20, i*40+20, "void");
Expand Down
27 changes: 26 additions & 1 deletion create5.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,32 @@ function create5() {
for(i=0; i<arr5.length; i++){
for(j=0;j<arr5[i].length;j++){
if(arr5[i][j]==9){
wall.create(j*40+20,i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}
//wall.create(j*40+20,i*40+20, "wall");
}
else if (arr5[i][j] == 1){
wall.create(j*40+20, i*40+20, "void");
Expand Down
28 changes: 27 additions & 1 deletion createDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,33 @@ function createDemo() {
for (i = 0; i < arr0.length; i++){
for(j=0; j < arr0[i].length; j++){
if (arr0[i][j] ==9){
wall.create(j*40+20, i*40+20, "wall");
wallkind = Math.floor(Math.random() * (10 - 1 + 1) + 1);
if (wallkind == 1 || wallkind == 4 || wallkind == 7){
wall.create(j*40+20, i*40+20, "wallS");
}
else if (wallkind == 2 || wallkind == 5 || wallkind == 8){
wall.create(j*40+20, i*40+20, "wallSR");
}
else if (wallkind == 3 || wallkind == 6 || wallkind == 9){
wall.create(j*40+20, i*40+20, "wallDS");
}
else if (wallkind == 10){
wallkind = Math.floor(Math.random() * (4 - 1 + 1) + 1);
if (wallkind == 1){
wall.create(j*40+20, i*40+20, "painting1");
}
else if (wallkind == 2){
wall.create(j*40+20, i*40+20, "painting2");
}
else if (wallkind == 3){
wall.create(j*40+20, i*40+20, "painting3");
}
else if (wallkind == 4){
wall.create(j*40+20, i*40+20, "painting4");
}
}

// wall.create(j*40+20, i*40+20, "wall");

}
else if (arr0[i][j] == 1){
Expand Down
9 changes: 8 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ var game = new Phaser.Game(config);
function preload() {
this.load.image("blueT", "assets/tileBlue.png");
this.load.image("whiteT", "assets/tileWhite.png");
this.load.image("wall", "assets/WallBoxOld.png");
this.load.image("wall", "assets/WallBox.png");
this.load.image("wallS", "assets/WallBoxSlash.png");
this.load.image("wallSR", "assets/WallBoxSlashReverse.png");
this.load.image("wallDS", "assets/WallBoxDoubleSlash.png");
this.load.image("painting1", "assets/WallBoxPainting.png");
this.load.image("painting2", "assets/WallBoxPainting2.png");
this.load.image("painting3", "assets/WallBoxPainting3.png");
this.load.image("painting4", "assets/WallBoxPainting4.png");
this.load.image("void", "assets/void.png");
this.load.image("jewel", "assets/jewel.png");
// this.load.image("jewelg", "assets/jewelg.png");
Expand Down

0 comments on commit e5ba3b5

Please sign in to comment.