How do I pick up a sprite with different instance variable

Get help using Construct 2

Post » Fri Apr 18, 2014 3:30 am

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.
You do not have the required permissions to view the files attached to this post.
B
47
S
14
G
20
Posts: 87
Reputation: 12,913

Post » Fri Apr 18, 2014 4:26 am

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
You do not have the required permissions to view the files attached to this post.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Fri Apr 18, 2014 7:18 am

Thank you very much PhoenixNightly for your help, as a newbie I'm really confused sometimes on how the event flows.
B
47
S
14
G
20
Posts: 87
Reputation: 12,913

Post » Sat May 03, 2014 2:45 am

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.

Thanks........

Image
B
47
S
14
G
20
Posts: 87
Reputation: 12,913


Return to How do I....?

Who is online

Users browsing this forum: 25games, Artcadev, Yahoo [Bot] and 22 guests