How do I make attached object move?

Get help using Construct 2

Post » Tue Aug 23, 2016 11:59 am


In my platformer game I want to attach an object (pitchfork) to my Player and then press a key and have the pitchfork thrust to the right by 30 pixels or so by pressing Keyboard "Z".

I've attached the object in two ways, by using a

System Every Tick event - Set Position to Image point

but this seems to be rigid, I can't change the position, only the rotation. I tried making a Condition to the event, that if Keyboard "Z" was NOT pressed, and this seemed to allow the thrusting (by shifting to another Image Point), but the pitchfork would not adhere to the Player if I thrusted and jumped or moved.

Also attached via the Pin To behavior on the object, but again I can't get the position adjusted after that.

Any advice, pointers, etc. much appreciated,

Posts: 23
Reputation: 571

Post » Tue Aug 23, 2016 5:30 pm

Not exactly what you ate asking for, but generally speaking the better approach world be to "move" the weapon with animation frames rather than fiddle with it's actual position and angle.

But to solve your problem, set the new position AFTER your every tick event. Remember events run in order from top to bottom, so if you change the position before, the every tick event will just put it back to where it was before.
Mistakes were made.
Posts: 1,973
Reputation: 75,448

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 68 guests