How do I pick up a sprite with different instance variable

0 favourites
  • 4 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hello,

    I'm having trouble with picking, I'm trying to pick up individual red bars when I press down any key, already made an intance variable with different value number for red bars.

    But it keeps on picking all the red bar pickups.what I want to happen is if my player collide or overlap the red pickup upon pressing the keyboard is the only time the pickup will occur. At the same time destroying the red pickups.

    I'm still very new with C2 already making some experiments. I guess this may be too elementary for C2 masters.

    I provided the capx if you want to have a look and edit it.

    thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your code is incomplete...don't really need instance variable for something like this... I guess. The way you had it coded it was doing what it was actually told to do. But with this what every object instance that this is true for the condition will execute for it. So if the player is over it when the key is down only the pickup object that it is true for will be destroyed. You don't really need the collision line either and change the keyboard condition tor KEY IS PRESSED

  • Thank you very much PhoenixNightly for your help, as a newbie I'm really confused sometimes on how the event flows.

  • Hi guys,

    Just an update to this thread. I want to ask about the keyboard control I want to make it to touch.

    The toucher sprite is located in layer 1 below layer 0 where the player and pickups are located. The second condition below touch, I tested and set toucher sprite to Collision Enabled, Is on layer 1 and the third on I made it simpler -- Is touching. All three are working. But which one is appropriate, do I also have to add end touch condition? or you can suggest something better. This is too elementary I know, LOL, I just want to make sure I'm doing it right.


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