Talking about 3D, Game development and Javascript.
I love to code, but sometimes I love to experiment with the so called #nocode tools and build stuff.
With Buildbox I already showed you how to build a Sokoban prototype, a 3D version of Two Cars and also a 3D version of Don’t Touch the Spikes.
Today is the turn of a game with no name, an endless runner with all the modern features like splash screen, in game instructions showed only once, game over screen, randomly generated levels, physics and particle explosions.
Have a look at the game, unfortunately Buildbox can’t export for HTML5 so I have to show you a gif image:
Obviously all this stuff requires a bit of coding, but most of the hard work has been done using nodes, as you can see from this image:
The game works looping again and again through this scene:
Everything is grey here, but each time random colors are generated with this simple JavaScript:
let colors = [[255, 0, 0], [0, 255, 0], [0, 0, 255]]
function init(){
let zPosition = this.entity().worldPosition().z;
if(zPosition < -10){
let possible = false;
let floorColor = randomColor();
this.entity().setColor(colors[floorColor][0], colors[floorColor][1], colors[floorColor][2]);
let cubeColors = [];
for(let i = 0; i < 5; i++){
let color = randomColor();
cubeColors.push(color);
if(color == floorColor){
possible = true;
}
}
if(!possible){
let exit = Math.floor(Math.random() * 5);
cubeColors[exit] = floorColor;
}
let cubes = this.scene().find("ColorCube");
let totalCubes = cubes.length;
for(let i = 0; i < 5; i ++){
let cube = cubes[totalCubes - 5 + i];
let cubeColor = cubeColors[i];
cube.setColor(colors[cubeColor][0], colors[cubeColor][1], colors[cubeColor][2]);
cube.colorMatched = floorColor == cubeColor;
}
}
}
function randomColor(){
return Math.floor(Math.random() * colors.length);
}
Then, once the ship hits a box, we check for the color of the box to match the color of the ground.
I had to edit some built in scripts here and there, but the main logic is all described in the above script.
I am preparing a more detailed tutorial about building a game with Buildbox, but you can check the source code of the entire project and make yourself an idea about the ease of game development using this tool.
I will try to complete the game and publish on the app stores, then share my experience, stay tuned.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.