First of all, let's call the 'green particle' a rain drop. I want the rain drop to spawn in randomly and always from the top of the screen. I want it to fall all the way to the bottom and then delete itself. Furthermore, I want there to be multiple raindrops, but not too many as the player needs to avoid them. Finally, as the game progresses I want the amount of rain drops to increase, therefore it's harder.
#I need help coding movement to this green particle (READ DESC)
9 messages · Page 1 of 1 (latest)
so i don't have the time to help with the whole thing but one thing i can let you know right away is you can't actually use particles for this. particles are incapable of collision checks. you need proper objects.
because you want them to interact with teh player
Hey, im happy to help if you still need it
- You will want to create a raindrop object with the raindrop sprite assigned to it, in this object you will give it a collision check for both the floor and the player. You will also give the raindrop some code in its step event such as y += 1
- you will need to create a second object which will manage spawning in all the raindrops. First you will need to set up a timer in the object, when this timer reaches zero a raindrop will be spawned and the timer will be reset, you could do this using a variable or using an alarm, i will use a variable as an example
In the create event of this raindrop spawner object give it 2 variables, one called raindrop_cooldown and set it to something like 60, and a second variable called raindrop_timer and set it to = raindrop_cooldown
- finally you will need to have some code in the step event of the raindrop spawner
In the step event you will want something like ```if (raindrop_timer-- <= 0) {
raindrop_timer = raindrop_cooldown;
raindrop_cooldown -= 0.25;
var _x = random_range("left most x coord raindrops can spawn", "rightmost x coord");
var _y = "the y coord you want the raindrops to spawn at";
instance_create_layer(_x, _y, "The layer they are spawned on", o_raindrop);
}```