Pin on collision

Get help using Construct 2

Post » Fri Aug 17, 2012 4:01 pm

Hi all,

Loving Construct 2 so far.

What I want to do:

When apple collides with bubble -> pin apple to bubble

This works perfectly for one instance of an apple and bubble. When I have multiple apples/bubbles however, all the apples pin to a single bubble.

Any help would be greatly appreciated.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Aug 17, 2012 5:02 pm

Could you provide more details or capx file? What other behaviors apple or bubble has?
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Fri Aug 17, 2012 5:09 pm

A bit of a dirty trick which may or may not work would be to add a local/instanced variable to each apple "collided=0" and then have a collision change that value to 1 and make that trigger a pin command? I'm fairly new to construct so don't waste too much time on it if it doesn't work.

There probably is a more elegant solution out there though.

Alternatively you could make a new object spawn which is both bubble and apple together. Maybe.

-EDIT-

Ignore mine, the instance solution below is much better.MWB2012-08-17 17:12:56
B
4
Posts: 20
Reputation: 390

Post » Fri Aug 17, 2012 5:11 pm

You're luck today ^^

It's a tutorial to help you understand how instances works.
http://www.scirra.com/tutorials/361/understanding-uid-iid-health-of-enemies-and-rocket-smoke-trail

I would recommend you to make a "instance variable" called "ID" for each bubble and each apple and make the condition to meet for the apple colliding with the bubble, check their ID and setup to pin the apple ID "x" to the bubble collided bubble with ID "y"

I'm sorry to don't create a CAPX for you, also, hopping this explain help in anything.
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,190
Reputation: 18,272

Post » Fri Aug 17, 2012 5:27 pm

apple: on collision with bubble
     apple: pin to bubble

should work with multiple apples/bubbles.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Fri Aug 17, 2012 5:59 pm

[QUOTE=ramones] apple: on collision with bubble
     apple: pin to bubble

should work with multiple apples/bubbles.[/QUOTE]

Sometimes We complicated what is simple ^^

How it work with concurrence when hitting, or, for a single apple don't pin in multiple bubble you still needing to make a variable Boolean too, call it as "already pinned" and set ON when the apple pin to the bubble.
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,190
Reputation: 18,272

Post » Mon Aug 20, 2012 1:13 pm

Thanks so much for the replies guys, that tutorial link is especially useful.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783


Return to How do I....?

Who is online

Users browsing this forum: agittm, mystazsea and 14 guests