I'm in the process of creating an endless runner, and one of the features that I've been trying to implement effectively is a distance between platforms that scales with the speed you're running (-hspeed of the platforms). Essentially, the faster you run, the further you can jump. The problem is that I really don't know how to go about doing it. Here is my code for alarm[0] in the controller object that generates the platforms:
var len =irandom_range(global.playerspeed*10,global.playerspeed*16);
var rany = irandom_range(-20,20);
var floor_number = 0;
xx = 16
repeat (len){
new_floor = instance_create(room_width+xx,160+rany,obj_floor)
var yy2 = 0;
repeat(20){
yy2 += 16
instance_create(new_floor.x, new_floor.y + yy2, obj_floor);
}
floor_number ++
if (floor_number < len - 4 and floor_number > 4 ){
//if irandom(100) < 10 instance_create(room_width+xx,new_floor.y - 1, obj_enemy);
}
xx += 16;
}
alarm[0] = ????
I'm essentially trying to get the alarm to set to a scaling value at the end. Does anyone have any ideas? Am I going about the platform generation the wrong way? Any help or advice would be much appreciated!
Oh, and I also found that if the len == 1 global.playerspeed == 3 and alarm[0] == 10, the floors are seemingly spaced apart by their own width like this:
I've been playing around with those ratios but they don't seem to scale up properly. Maybe I'm missing something, though...