A
AquaticChaos
Guest
So I've been following a Youtuber's tutorials on random generation (Name can be discussed if needed) and finished it up, but now I want to add a bit to a line of code.
This small line of code was put immediately after the previous code, but it didn't work.
Any suggestions would be absolutely helpful to my cause.
Code:
//Create level using 1000 steps;
repeat(500) {
//Place floor tile at controller position
grid[# cx, cy] = FLOOR;
//Randomize direction of controller
if(irandom(odds) == odds) {
cdir = irandom(3);
}
//Move controller
var xdir = lengthdir_x(1, cdir*90);
var ydir = lengthdir_y(1, cdir*90);
cx += xdir;
cy += ydir;
//Make sure we don't move outside grid
cx = clamp(cx, 1, width-2);
cy = clamp(cy, 1, height-2);
}
Code:
//Add stairs
var sx = cx*CELL_WIDTH+CELL_WIDTH/2;
var sy = cy*CELL_HEIGHT+CELL_HEIGHT/2;
instance_create(sx, sy, obj_Stairs);