I
Isla
Guest
Hey, everyone!
I (very recently) started using gamemaker and finished the tutorials. I've now got a fully-functioning remake of Asteroids, and I'd like to implement a feature where every time you finish a level, you get one more asteroid than in the previous one. As you get 50 for shooting a big one, and then 75 for the smaller ones, that means you get 200 points per asteroid in total. I was wondering if there's a way to make a function that adds more asteroids depending on the score, but automatic. Thanks to the tutorial, I have the coding that only activates if the screen is empty (which stops it from looping). The first level starts with 5 asteroids, so after that, you have 1000 points.
So far, I've only got about:
if (global.points = 1000)
{
if (!instance_exists(obj_asteroid))
{
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
}
}
How would I go about adding more of these, without just copying this code, adding an extra line of
instance_create(random(room_width),random(room_height),obj_asteroid);
and making the if-statement:
if (global.points = 2000)
I'd like something that said something like (global.points - global.points from the last level) /200 = amount of asteroids added. How would I go about adding that?
I (very recently) started using gamemaker and finished the tutorials. I've now got a fully-functioning remake of Asteroids, and I'd like to implement a feature where every time you finish a level, you get one more asteroid than in the previous one. As you get 50 for shooting a big one, and then 75 for the smaller ones, that means you get 200 points per asteroid in total. I was wondering if there's a way to make a function that adds more asteroids depending on the score, but automatic. Thanks to the tutorial, I have the coding that only activates if the screen is empty (which stops it from looping). The first level starts with 5 asteroids, so after that, you have 1000 points.
So far, I've only got about:
if (global.points = 1000)
{
if (!instance_exists(obj_asteroid))
{
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
}
}
How would I go about adding more of these, without just copying this code, adding an extra line of
instance_create(random(room_width),random(room_height),obj_asteroid);
and making the if-statement:
if (global.points = 2000)
I'd like something that said something like (global.points - global.points from the last level) /200 = amount of asteroids added. How would I go about adding that?