How do I make a projectile sprite randomized

Get help using Construct 2

Post » Wed May 17, 2017 5:21 pm

First off I apologize if this has in fact been solved before. I had a scroll through the forums to try and find an answer but could not find one.

What I am looking to do is have a projectile possibly be 5 different sprites. The idea is every time you fire or throw there is chance of the projectile be 1 of 5 different items.

If someone could help me with this that'd be great!

Thanks in advance.
B
2
Posts: 1
Reputation: 152

Post » Wed May 17, 2017 5:57 pm

2 Solutions: Either use the same sprite and put all bullets in different frames of the default animation or Put all 5 sprites in a Family called BULLETS for example

For family method:
On [SHOOT BUTTON] pressed | Gun Create BULLETS >>> This randomly creates one bullet from the family.

For same sprite method:
On [SHOOT BUTTON] pressed | Gun Create BULLET <<< Sprite
On BULLET created | Stop Animation.
|Set frame to int(random(0,4))
Image Image Image
B
29
S
11
G
27
Posts: 730
Reputation: 17,002


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Buddhika, R0J0hound, Unconnected and 16 guests