Carry a Object

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi I'm new to Construct and I have been having a little trouble trying to figure out a way to have my platform character carry an object over his head. I want him to be able to carry a object that he is overlapping when the player presses a button, and then when the button is pressed again he will throw or drop the object.

    I tried searching the forums but I haven't found an answer yet.

    So whatever you think the best way of handling this is please let me know. Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In its simplest form you want to be looking at using a flag variable like "Carrying" to see if you're carrying something, and use a private variable as a flag for instances of your objects you want to carry.

    To pick up an object:

    Button Pressed

    +Carrying is 0 (false)

    +Overlapping object

    ---PrivateVariable=1

    ---Carrying=1

    To drop an object:

    Button Pressed

    +Carrying is 1 (true)

    +PrivateVariable=1

    ---PrivateVariable=0

    ---Carrying=0

    ---[Update object with new position coords]

    And use an Always to position object above player:

    Always

    +Carrying=1

    +PrivateVariable=1

    ---[Position object above player]

    You can improve it by making sure that you can't pick up whilst overlapping more than one object, and you can't drop whilst overlapping another object.

    Krush.

  • Thanks a ton for your help I'll give it a shot.

    Edit: This worked out really well, thanks.

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