M
Matt93
Guest
Hi everyone,
I've just started thinking through how I might make an endless runner. I'd quite like to make something similar to Turbo Pug:
.
I'm unsure how the developers did something like this? The terrain is procedurally generated, but there seem to be set blocks which are repeated
. So it's not just like the length of each segment is changed randomly - each segment appears to have the same length. How should I go about building my blocks? Is it a case of designing block templates for each possible scenario (so having loads of different sprites)? Or is there a more efficient way?
Here's some code I've written so far, using the several sprite method. This is just in a platform generator:
I've just started thinking through how I might make an endless runner. I'd quite like to make something similar to Turbo Pug:
I'm unsure how the developers did something like this? The terrain is procedurally generated, but there seem to be set blocks which are repeated
. So it's not just like the length of each segment is changed randomly - each segment appears to have the same length. How should I go about building my blocks? Is it a case of designing block templates for each possible scenario (so having loads of different sprites)? Or is there a more efficient way?
Here's some code I've written so far, using the several sprite method. This is just in a platform generator:
Code:
if (platform_inst.bbox_right <= 640)
{
switch (range) {
case 0:
platform_inst = instance_create(room_width+32, 640, obj_ground_long);
platform_inst.hsp = platform_speed;
range = irandom_range(1,3) //no two blocks repeat consecutively
break;
case 1:
platform_inst = instance_create(room_width+32, 640, obj_ground_parts);
platform_inst.hsp = platform_speed;
range = choose(0,2,3);
break;
case 2:
platform_inst = instance_create(room_width+32, 640, obj_parts_2);
platform_inst.hsp = platform_speed;
range = choose(0,1,3);
break;
case 3:
platform_inst = instance_create(room_width+32, 640, obj_ground_top);
platform_inst.hsp = platform_speed;
range = irandom_range(0,2);
break;
}
}