Move Object if Mouse Is In Position

  • Hello,

    I'm new with construct. One thing that I find weird is the use of Events/Actions/Conditions in place of loops (for, while, if/else, etc).

    Basically, I have an object that is outside of the layout (origin x=832, y=240). What I want to happen is this:

    If the Mouse.X if within Layout 1 x-192, the object should move left until it's origin reaches (640,240).

    And when the Mouse.X is less than the Layout 1 x-192, the object should start moving right until it's origin reaches (8.32,240) again.

    But I'm not quite sure how. Can somebody help me?

    Thanks!

    Satellite

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What you described in pseudo is essentially all you need to do.

    Use the System > Compare Two Values for Mouse.X > 192 - Move object left. Mouse.X < 192 - Move object right.

    If you need help moving objects, you can enable Bullet behaviour and set angle to move toward a specific point.

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