Hello, does anyone know or have access to events on how to create leafs that float into the screen? It's proving a touch tricky to get this to work.
Develop games in your browser. Powerful, performant & highly capable.
The way I'd do it:
Each leaf would be a sprite with a bullet behavior for overall wind direction and also a vertical sine wave movement behavior for a nice wavelike movement as it goes from right to left via the bullet movement.
Changing the bullet movement direction and speed would allow you to control wind direction and force.
Changing the sine-wave parameters will add variety and could also be made to correlate with wind speed.
Then I'd have an event that every X number of seconds, IF the total number of leaves is below a certain threshold number (you don't want to generate too many), and a random number is within whatever threshold you need (random(4))<2 for example, then generate a leaf sprite at right visible edge+50,maximum-desired Y position PLUS random(max additional Y position in pixels)
Be sure to have an event that destroys leaves once they go off screen to the left.
maybe you can try this event from game demos 'Kiwi Story' :
Thanks everyone for the help.
I tried to emulate the one from kiwi story but it didn't work. Different viewport settings.
I could do the bullet one, thanks. It's the code o struggle with, like where to put brackets and expressions.
I guess it's trial and error until it works. Can be tricky if you don't know what code to use.
Thanks all :-)