Legacy GM How to make randomly generated 'asteroids'?

W

Whirlpoolio

Guest
Hey!
I'm making a side project and its kinda like Asteroids. You are a block and have to pilot your way through a field of blocks (asteroids). I want it so they are randomly generated and its a top down style game. You can only go 'up' the room but you can fly 360 degrees with a joystick.

I don't know how I would make it so each one is random and looks different. I know I have to use randomise() but I don't know how to make shapes with objects. Please help ;)
 

DarthTenebris

Definitely not a Sith Lord
I think you would need to have several base shapes, and generate objects with shapes chosen at random.

Hope I helped :)
 
W

Whirlpoolio

Guest
I think you would need to have several base shapes, and generate objects with shapes chosen at random.

Hope I helped :)
So maybe in the step event:
Code:
xx = irandom_range(32,320)
yy = irandom_range(32,992)
a = sBlock1
b = sBlock2
c = sBlock3

var wall = instance_create(xx,yy,oWall)
wall.sprite_index = choose(a,b,c)
But how would I limit it to only the room and make it so they don't place on top of each other?
 

DarthTenebris

Definitely not a Sith Lord
So maybe in the step event:
Code:
xx = irandom_range(32,320)
yy = irandom_range(32,992)
a = sBlock1
b = sBlock2
c = sBlock3

var wall = instance_create(xx,yy,oWall)
wall.sprite_index = choose(a,b,c)
But how would I limit it to only the room and make it so they don't place on top of each other?
Code:
while(place_meeting(xx, yy, obj_asteroid)) {
     xx = irandom_range(32, 320);
     yy = irandom_range(32, 992);
}
instance_create(xx, yy, obj_asteroid);
Sorry if it doesn't work, but at least you get the logic.
Hope I helped :)
 
Top