weapon switch

Get help using Construct 2

Post » Sat Jun 18, 2016 11:43 am

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?
B
3
Posts: 3
Reputation: 181

Post » Sat Jun 18, 2016 1:07 pm

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
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Tue Jun 21, 2016 2:51 pm

Thank you for your reply it helped me.
B
3
Posts: 3
Reputation: 181

Post » Wed Jun 22, 2016 3:28 am

Awesome stuff, no problem :)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, dop2000, Exabot [Bot] and 36 guests