How do I switch weapons/attacks?

0 favourites
  • 7 posts
From the Asset Store
Toggles Dials Switches and Alerts ! A foundational sound grouping of Analog type switches and Steampunk effects
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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

  • 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

  • Yes! Thank you Very Much !! 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

  • Sure, just set weapon to invisble at the end of the shoot event.

  • Cool! Thank you Very much for all of your help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)