Reload Weapon Button - Top Down Shooter

Get help using Construct 2

Post » Wed Apr 08, 2015 8:39 pm

Hi.

I'm currently working on a top down survival game in which the bullets are spawn from the player sprite in the direction of the cursor. Pretty basic...
What I need now is to create a system that when the "bulletcount" variable reaches 0, you have to press a button (could be "R") to reset the value to its original number and enable the bullet spawning again.

What's the most efficient way for me to create this?

Thanks

--
B
6
S
1
Posts: 18
Reputation: 343

Post » Wed Apr 08, 2015 9:00 pm

Give the player an instance variable NumberOfBullets

Keybord on space bar pressed
player compare variable NumberOfBullets > 0
- shoot

Keyboard on R pressed
player compare variable NumberOfBullets = 0
- Player set variable NumberOfBullets = 20
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Apr 08, 2015 10:11 pm

Here is a simple capx example of mouse click shooting and reloading:

https://drive.google.com/open?id=0Bx-ufu2WID53NnVMTGRSa1k5MWM (click the download arrow in upper right corner of screen)
Last edited by chrisinfinger on Mon Sep 05, 2016 10:35 pm, edited 2 times in total.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Wed Apr 08, 2015 10:41 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Apr 10, 2015 1:34 am

Thank you all for the awesome help!
I followed chrisinfinger's example. It worked great!
B
6
S
1
Posts: 18
Reputation: 343

Post » Fri Apr 10, 2015 10:56 pm

using timer + instance variable on player.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 9 guests