0 Favourites

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

  • 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

    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?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

    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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)