How do I Make a Top-Down Weapon Switching system?

0 favourites
  • 7 posts
From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • I'm trying to make a top down game in which the player starts unarmed and picks up a gun. and i want it to be able to cycle back and fourth. and so when ever he picks up another gun you will be able to cycle between all 3. How would i go about doing that?

    Example.

    There are 3 Weapons in the game

    You start with a Weapon ID Of 0

    Then You Pickup a Weapon with the ID of 1 Then you are only able to cycle between those 2

    Until

    You Pickup a 3rd weapon. Then You Will be able to cycle through all 3 weapons.

    You could say use an array. i already have one but if i cycle through it will give me all weapons.

    Thanks!

  • You probably want some instance variables on your player to keep track of what guns they have. Then add a condition, only allow switching to that weapon if the weapon is acquired.

  • You probably want some instance variables on your player to keep track of what guns they have. Then add a condition, only allow switching to that weapon if the weapon is acquired.

    If i do that, will i have to get rid of my array? I like how my weapon Switching system works there.

  • Without seeing how your events are currently set up, I have no way of answering that question.

  • What oosyrag said. I don't think you need an array for a simple 3 weapon - weapon switch in my newbie opinion. I would use (and have used) variables to switch between weapons.

    I think this tutorial might help you build your weapon switch system. Think of switching weapons as switching between different states.

    https://www.scirra.com/tutorials/158/ve ... two-states

    This might be relevant too though I haven't seen the entire 2 parts.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What oosyrag said. I don't think you need an array for a simple 3 weapon - weapon switch in my newbie opinion. I would use (and have used) variables to switch between weapons.

    I think this tutorial might help you build your weapon switch system. Think of switching weapons as switching between different states.

    https://www.scirra.com/tutorials/158/ve ... two-states

    This might be relevant too though I haven't seen the entire 2 parts.

    Thanks!

  • Create a variable called WeaponFrame and create too a object called weapon go to the event sheet and set it: every tick - Weapon set frame WeaponFrame,and forever if you go change the weapon change the variable for example, When I press 1 - WeaponFrame set 1

    I want have helped

    (Sorry my english i'm not american)

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