About collider & Pin [Solved]

Get help using Construct 2

Post » Sun Apr 07, 2013 3:33 pm

Hello :)
i've searched about my problem but i've not found the answer...and a recent answer...so, a platform, super mario bros style.

im wondering if there is a simple method to pin a collider on a mob(to do same as mario head squish) and doing this for every instance.

I've created a container with collider spawned on an image point but when i hit it i kill,obviously, all the mobs.

Also it's genuine using every tick to set position of the collider? is it a waste of resources?
Thank you in advance. :)TheRagMan2013-04-07 19:19:17
B
4
Posts: 10
Reputation: 395

Post » Sun Apr 07, 2013 3:41 pm

Use containers: this will ensure that each mob gets a collision box when it's created, and when one dies, so will the other.

The simple method to pin a container is with the pin behaviour. So do something like this: when the mob is created, position the collision box to it, and then pin the box to it (two separate actions, same condition). With containers, the box is automatically created when the mob is created, and the correct instance of the box is automatically picked when you pick the mob.

Pinning and assigning position every tick are identical in terms of functionality and resource usage.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Sun Apr 07, 2013 4:40 pm

i was using spawn instead of set position, now i've understood..thx!
now the instance works but it doesnt stay pinned... O_o
i've set pos & angle. it look so simple,damn! maybe im a moron.
B
4
Posts: 10
Reputation: 395

Post » Sun Apr 07, 2013 5:33 pm

Have a look at this example.

Just for example's sake, I've assigned the PlayerBox the platform behaviour so you can see how it moves, but in your game you'd obviously have some sort of custom AI movement set up for your mobs.

The way you should set up your colliders should be the same, though. Notice that the actual box is the object that's controlled - the sprite is simple pinned to it. The box would be invisible in a proper game, though.

Also worth noting is that when I pick the sprite (On Created) - it automatically picks the correct collision box in the pin action; this is the beauty of containers.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Sun Apr 07, 2013 5:51 pm

i dont have 124, but yes my player is a box with animation pinned to it!
But the condition is On start of layout! i've just changed it with "on creation" of player(box) and is not pinned anymore...so maybe is that the problem.
Pin doesnt work with that, cause it's just on created container mob set posit collider and pin it. :/
B
4
Posts: 10
Reputation: 395

Post » Sun Apr 07, 2013 5:56 pm

i've changed with on start of layout and the collider was pinned to mob...but when the mob(bullet) bounce on solid...the collider continue to go forward. :/
B
4
Posts: 10
Reputation: 395

Post » Sun Apr 07, 2013 6:02 pm

Maybe...maybe i've solved using "Is Visible"
B
4
Posts: 10
Reputation: 395

Post » Sun Apr 07, 2013 6:08 pm

Download R124 and check out my example. It's dead simple - a single event. You should generally stay up-to-date anyway.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Sun Apr 07, 2013 7:18 pm

now it works, maybe it was the 119 ver. i dont know,but was the same of your ex.
thank you.
B
4
Posts: 10
Reputation: 395


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, mjj1990 and 8 guests