How do I make attached object move?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • HI,

    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,

    M

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)