How do I make bullets without many sprites.

Get help using Construct 2

Post » Tue Jun 21, 2016 3:10 pm

Hello again, I will get straight to point. In the game there is a box on the right-bottom corner which shows player bullets. Image

I created another sprite for each bullet and I did the events like this:
Image

However I want to know how to make all bullets spawn and destroy one by one when the variable changes without separate sprites.
-Cem
B
3
Posts: 3
Reputation: 181

Post » Thu Jun 23, 2016 2:57 am

Instead of using different sprites copy and paste the same sprite but add an instance variables to it found in the object's properties bar. You could name the instance variable KursunSayisi and choose 0, 1 or 2 for each instance of the sprite.
B
7
S
2
G
1
Posts: 4
Reputation: 1,037

Post » Thu Jun 23, 2016 6:23 am

Or you can write function:
printBullet(bullet cont)
-destroy bullet
-for i=1 to i=bulletCount
-create bullet x:layoutWidth - 30*loopindex; y: layoutHeight - 30

But better use #Rexro metod
B
21
S
3
Posts: 73
Reputation: 1,488

Post » Thu Jun 23, 2016 6:41 am

Make an animation with 9 Frames. Frame 0 no Bullet, frame 1 one bullet, frame 2 two bullets and so one.
Now you can set easy the number of bullets with 'Sprite| Set animation frame to'
B
24
S
3
G
1
Posts: 451
Reputation: 2,165


Return to How do I....?

Who is online

Users browsing this forum: jasontoups and 1 guest