How do I assign a sprite to another sprite objects?

Get help using Construct 2

Post » Thu Sep 10, 2015 1:09 am

Hello everyone, I'm having trouble assigning a sprite object to another sprite objects.

https://www.dropbox.com/s/n61pvuvthed9b ... a.png?dl=0

I have two sprites, a Human sprite and a button sprite. Whenever a new human sprite is created, it spawns 3 button sprites(with different image frames). Whenever I tap a button I want the human sprite to do a certain action depending on which button frame it is on. (e.g. If I (on tap tree button) Human sprite move to tree). The problem is that all the human sprites are doing the action whenever I press a button. I only want one of human sprites to do an action whenever one of it's buttons is touched.

So how can I make the buttons sprites work for only one human sprite?
B
12
S
4
G
1
Posts: 100
Reputation: 2,362

Post » Thu Sep 10, 2015 5:12 am

ThunderLion wrote:Hello everyone, I'm having trouble assigning a sprite object to another sprite objects.

https://www.dropbox.com/s/n61pvuvthed9b ... a.png?dl=0

I have two sprites, a Human sprite and a button sprite. Whenever a new human sprite is created, it spawns 3 button sprites(with different image frames). Whenever I tap a button I want the human sprite to do a certain action depending on which button frame it is on. (e.g. If I (on tap tree button) Human sprite move to tree). The problem is that all the human sprites are doing the action whenever I press a button. I only want one of human sprites to do an action whenever one of it's buttons is touched.

So how can I make the buttons sprites work for only one human sprite?


if you upload your capx its more easy to the others to help you, you can make a new capx with the issue if you don't want to share your complete project.
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Thu Sep 10, 2015 5:57 am

@Majinboo

Here is a link to the capx:

https://www.dropbox.com/s/m26aw380t8tn1 ... .capx?dl=0
B
12
S
4
G
1
Posts: 100
Reputation: 2,362

Post » Thu Sep 10, 2015 7:32 am

B
9
S
3
Posts: 142
Reputation: 1,108

Post » Fri Sep 11, 2015 3:43 am

@majinboo Thank you! It works perfectly.
B
12
S
4
G
1
Posts: 100
Reputation: 2,362

Post » Fri Sep 11, 2015 3:57 am

as my opinion,you can set each your human sprite & button sprite self variables name"H_uid"&"B_uid",then when you touch the button, pick it's"B_uid"= human's"H_uid" and finish it's action
B
72
S
25
G
5
Posts: 89
Reputation: 7,275


Return to How do I....?

Who is online

Users browsing this forum: sublimate and 2 guests