How do I create a weapon pick up system

Get help using Construct 2

Post » Thu Oct 13, 2016 4:06 pm

hello everyone I would like to create a system where the player has 9 weapon slots and as he picks up a weapon it will automatically be assigned to the next free slot so say the player has a knife and a pistol that is weapon 1 and 2 but if he picks up a shotgun that will become weapon 3 and if the player presses the next or previous weapon buttons they will go to the next available weapon. any help would be appreciated
B
14
S
4
Posts: 125
Reputation: 1,380

Post » Thu Oct 13, 2016 4:36 pm

Are you familiar with arrays?

They will work perfectly for this, you just have to learn how to manipulate them: https://www.scirra.com/tutorials/307/ar ... -beginners
ImageImageImage
B
39
S
22
G
11
Posts: 492
Reputation: 9,925

Post » Sun Dec 11, 2016 5:01 pm

I know the response was back in October but I needed to take a big break from game making for personal reasons and now I am back, I have spent the last hour trying to follow this tutorial https://www.youtube.com/watch?v=Us6aTgpreQ4 unfortunately it has me stumped I was trying to follow it, I created an array, then a global variable, then I renamed the animation of my gun by adding the name ID_ just like it said I should but when it told me to write this line of code
"ID_" & Arr_weapons.At(X)
construct 2 won't reconise the expression X construct 2 won't recognize the expression X does anyone have a capx with a working weapon pickup system I can look at?
B
14
S
4
Posts: 125
Reputation: 1,380

Post » Thu Dec 15, 2016 5:44 pm

I don't know exactly how this might work, but I have a method that might work. When making a game, I like to skrew around with the Bullet Behavior, just figuring out different ways I can make the bullets work. For example, like when the bullet reaches a set length (or if you use a command) the bullet will spawn two other bullets, with the angle of motion being random. Try using different groups for different gun behaviors in the event sheet. When one gun is active, then that group will be active, while the others are deactivated.
B
3
Posts: 2
Reputation: 186

Post » Fri Dec 16, 2016 2:49 am

You should be able to find multiple inventory examples if you search in tutorials, maybe even in other forum posts.

That X that isn't being recognized is probably referring to some variable you are missing
ImageImageImage
B
39
S
22
G
11
Posts: 492
Reputation: 9,925


Return to How do I....?

Who is online

Users browsing this forum: amazingdream, Yahoo [Bot] and 20 guests