(02-02-2025, 06:53 AM)johnno56 Wrote: YES!! An alien!! Very cool. Was it difficult to work out the coding for the alien?
I had no plans of working more on this "game" - it was just a test. But the alien 1micha created made me want to add more stuff after all - cool levels, powerups, points, maybe even enemies
Code:
visible vBricks = fill(unset, 15, 10, 3)
for x = 0 to 14 for z = 0 to 9 for y = 0 to 2
if y = 0 and rnd(2) = 0 or y > 0 and vBricks[x][z][y - 1] and rnd(2) = 0
select rnd(3)
case 0 vBricks[x][z][y] = [st: 1, m: cube, t: vRedBrickImage, offs: 0, ht: 0]
case 1 vBricks[x][z][y] = [st: 2, m: cube, t: vGreenBrickImage, offs: 0, ht: 0]
case 2 vBricks[x][z][y] = [st: 3, m: cube, t: vBlueBrickImage, offs: 0, ht: 0]
endsel
endif
next
That's where the level is created, all random. But it's just a 3d array, vBricks[X][Z][Y]. X is left to right, Z is into the screen and Y is up. The array has the size 15x10x3. To put a brick somewhere, add a table like this at the coordinates x, z, y:
Code:
vBricks[x][z][y] = [st: 1, m: cube, t: vRedBrickImage, offs: 0, ht: 0]
st is the brick's stamina, m its mesh (always cube for now), t its image. offs and ht should always be 0.