weapon switch

  • I am in a very complex situation. Let's say there are 2 weapons A and B. A has 2 second reloading time and B has 4 second reloading time and more effective. Player can switch weapons during the game. But bullet variable stays the same. So player can use B as a main gun but when he/she wants to reload he/she can switch to A, reload, and back to B. I can't crate another variable to weapon B. Because I need to rewrite every event I wrote about weapon A. So how can I do 2 variable for 2 weapons at the same variable?

  • You probably need to use instance variables (variables specific to the object) in order to make different "stats" for your weapons.

    You can then make ONE event that references the instance variables (which can be different per weapon). Global variables aren't as flexible for this type of thing, unless you have a tonne of them - instance variables are much easier to use on item specific stuff. You can easily have all sorts of instance variables, like "reload speed" and "accuracy" or even "weight" - things like that.

    Hope this helps.

    ~Sol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your reply it helped me.

  • Awesome stuff, no problem

    ~Sol

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