How do I drop the current item when I pick up a new one?

Get help using Construct 2

Post » Mon Dec 29, 2014 11:04 pm

So the item the player currently has is saved with a string variable in the player object. If the player already has an item, when they pick up a new one I need the old item to drop next to them. My setup currently looks like this
Image
If the player doesn't have an item, it sets the item to the player, if they DO have an item, it spawns the item then sets the new item to the player. For some reason this doesn't work consistently, sometimes it spawns the correct item and sometimes it spawns the item I just picked up. Does anyone know why? Or a different setup that will work consistently?
B
5
S
1
Posts: 59
Reputation: 497

Post » Tue Dec 30, 2014 10:21 pm

Ok so I realized my issue was that I was assigning the nicknames used to access each item with a for loop and the for loop wasn't assigning the names properly. The for loop looks like this
Image
For every item in the family, I assign it a nickname based on an instance variable called name that stores its name as a string. I don't know exactly what it was assigning the nicknames as, but I think it gave them all the same one because it seemed random as to what item would drop when you picked up a new one. Anyone know what's wrong with this for loop?
B
5
S
1
Posts: 59
Reputation: 497


Return to How do I....?

Who is online

Users browsing this forum: divsyntax, volumetv and 9 guests