How do I switch weapons/attacks?

Get help using Construct 2

Post » Fri Aug 21, 2015 9:08 pm

Hi!

Im trying to make a game where 2 players battle each other, and i cant figure out how to switch weapons. Please keep in mind this is a mobile game. I want to make it to to when they touch an icon, it selects that weapon, so when they touch the screen, it disables movement and shoots the selected weapon.

Please Help

Thanks in advance
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Fri Aug 21, 2015 10:26 pm

Think we'll need a little more info.

As I see it, there are two ways to do it:
1. Make all weapons as animation inside the same sprite (probably the method I would've used)
2. Create different sprites with different weapons, and destroy/create weapons when weapons are selected

Should it disable movement after weapon is selected, or when the player is shooting only? How do you want the player to be able to move again?
Image
B
14
S
4
Posts: 145
Reputation: 1,943

Post » Sat Aug 22, 2015 1:58 am

Ok. i would need different weapons to do different damages, and i would have a row of like 5 different buttons on the bottom of the screen, each would be a different weapon. when you click one of the buttons, i would need it to 1st disable movement, then, on next touch, i would want it to shoot the projectile, then re-enable movement.

As for shooting. i would need to figure out how to see where the touch is relative to the actor, and then shoot the projectile at that angle.


if it wouldnt be too much trouble, could you send an example of the code or project? im kinda new at construct 2

Thanks
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Sat Aug 22, 2015 4:15 pm

Tried to do a quick mock up. Is this close to what you're looking for?

- Weapon selection
- Fire towards location of touch

https://www.dropbox.com/s/k12edfuk1ghyoi8/weaponexample.capx?dl=0
Image
B
14
S
4
Posts: 145
Reputation: 1,943

Post » Sat Aug 22, 2015 7:00 pm

Yes! Thank you Very Much :D!! is there a way that after the player shoots, the weapon goes away? and a refresh time before you can shoot again?

Thanks for all of your help
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Sat Aug 22, 2015 11:07 pm

Sure, just set weapon to invisble at the end of the shoot event.
Image
B
14
S
4
Posts: 145
Reputation: 1,943

Post » Sat Aug 22, 2015 11:33 pm

Cool! Thank you Very much for all of your help!
B
22
S
7
G
1
Posts: 90
Reputation: 2,045


Return to How do I....?

Who is online

Users browsing this forum: MPPlantOfficial, Sup with that? and 64 guests