How do I switch weapons for the player?

Get help using Construct 2

Post » Sat Oct 22, 2016 1:33 am

In some games, if you press 1, it switches to pistol, then you let go, then you can click to fire. If you press 2, it switches to sniper, then let go, then you click to fire.
How do I simulate that?
B
5
S
1
Posts: 13
Reputation: 351

Post » Sat Oct 22, 2016 2:08 am

What you can do is spawn a pistol sprite or play the pistol animation when 1 is pressed and then test for if the sprite is on screen or the animation playing when the mouse is clicked, from that you can fire the gun. Same with sniper, spawn or start animation when 2 is pressed and then test for if the sniper is on when you click.
B
14
S
3
Posts: 55
Reputation: 912

Post » Sat Oct 22, 2016 2:24 am

Here is an old capx I made for a different but similar question. It does what you want but in it you click the gun picture instead of pushing 1 or 2.. same principle. Click on (A) "button" to fire.
https://drive.google.com/open?id=0Bx-ufu2WID53MWFjT2owWEVEWHc (click the download arrow in upper right corner to download).
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Sat Oct 22, 2016 4:47 am

Thanks to both!
B
5
S
1
Posts: 13
Reputation: 351


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, R0J0hound, trance and 23 guests