How do I stop player from shooting

Get help using Construct 2

Post » Fri Apr 28, 2017 9:44 pm

I have a global variable set for my "Ammo" to 100.
When my player shoots all 100 bullets I don't want him to shoot anymore until he picks up an "Ammo Pack"
When I play and his ammo reaches zero he can keep shooting bullets.

I have tried adding a variable to the bullet but still the same thing.

What do I need to do?
Thanks
B
4
Posts: 15
Reputation: 230

Post » Fri Apr 28, 2017 9:51 pm

If bullet is less than 0

Disable shooting
B
21
S
9
G
8
Posts: 188
Reputation: 6,069

Post » Fri Apr 28, 2017 10:11 pm

I have tried that but he is still able to shoot.
B
4
Posts: 15
Reputation: 230

Post » Fri Apr 28, 2017 11:25 pm

have you tried setting an instance variable rather than a global?
B
7
S
1
Posts: 41
Reputation: 463

Post » Sat Apr 29, 2017 1:56 am

Brice wrote:I have tried that but he is still able to shoot.


You can use instance variable or Global variable, there are both options in the capx, the max bullet I set it up to 10 but you can change it to 100 or anything you like.

https://www.dropbox.com/s/sei0fbiw6gjufrc/BulletsMax.capx?dl=0
B
38
S
22
G
51
Posts: 211
Reputation: 29,505

Post » Sat Apr 29, 2017 10:58 am

@Brice You have to add a condition on shooting.

(event)On Left Mouse Button Click -----------> (action)Spawn another object Bullet
(condition) "Ammo" > 0 . . . . . . . . . (action)Subtract 1 from "Ammo"
B
35
S
9
G
9
Posts: 207
Reputation: 6,805


Return to How do I....?

Who is online

Users browsing this forum: Cha0tiXGamer, MaujDeveloper and 7 guests