change weapons with touch of button help please?
Hello!
I have a side panel that is located in the game that has a bunch of different weapon upgrades in it. So when the user goes inside the panel and clicks a weapon, the main player actor will change it's weapon to the weapon you have chosen.
So I'm wondering how to change the weapon on my main player actor to the weapon you have chosen.
I hope that explains it!
Thanks!
I have a side panel that is located in the game that has a bunch of different weapon upgrades in it. So when the user goes inside the panel and clicks a weapon, the main player actor will change it's weapon to the weapon you have chosen.
So I'm wondering how to change the weapon on my main player actor to the weapon you have chosen.
I hope that explains it!
Thanks!
Best Answers
-
KevinCross London, UKPosts: 1,894
Have one game attribute for players weapon, either as a number or string.
On the weapon buttons set that attribute the weapon when pressed i.e.
game.weaponEquipped = 2
Or
game.weaponEquipped = "Dagger"
On the player actor or the weapon actor that is constrained to your player actor have a rule that says if game.weaponEquipped = "Dagger" then set self.Image to "Dagger.png".
If the player and weapon is all one image then same thing but change the image to the image where the player is holding the dagger i.e. "CharacterHoldingDagger.png"
Answers
Thanks for your reply, @KevinCross!