How do I code a better upgrade UI?

Get help using Construct 2

Post » Tue May 24, 2016 1:01 am

Hi, I'm not asking to fix what I have since it's not well made, but I'd like to hear some options on how to make this better?
I'm using way too much code to make a simpler upgrade UI that there must be a better way.

This is what I have right now and it's only to upgrade 3 weapons and health / shields.
I'm needing to have to swap weapons and more stuff down the road and the way it is now it's going to be hell. ;)

Image

My foundation of all this may just not be the right way to go aswell. :(
Right now I have all my weapon stats in instance variable on a sprite for each weapon. Once I add more weapons for the player and enemy it's going to get complicated, I'm using the same weapons for the player as the enemies right now.

The system I have now is this:
The UI pops up and I set all the variables to a tmp variable incase they reset the changes.
Once they accept (close the UI) I then set the tmp variables back to the spriet that the player uses.
B
16
S
9
G
10
Posts: 38
Reputation: 6,519

Post » Tue May 24, 2016 4:59 pm

This looks fine to me. If you're going to add more weapons then you just slot the extra weapons into the events easily. It only looks confusing to me because they're called weap1 weap2, if you use the actual weapon names it might be easier to manage.

Also to control some of the upgrade logic it may be useful to just have levels for the weapons so that if it's level 2 then it has defined stats, you hit upgrade and it becomes level 2. that way you might only have to store the single level variable as a temp, then when you apply it on leaving the UI it applies the level to the weapon which then just applies all the predetermined damage stats.

I would say you could use arrays instead but I don't think that would save much time since you would be updating array positions instead of instance variables and would be about the same amount of logic.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Wed May 25, 2016 4:00 am

Yeah, I changed the weapon names to the correct ones now.
Ah good idea about the weapon levels.
Thanks!
B
16
S
9
G
10
Posts: 38
Reputation: 6,519


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], ultrafop and 11 guests