How do I make object move towards another object?

0 favourites
  • 12 posts
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 got Construct 2 yesterday and I am still in the process of learning how to use it. I must say, it is the best Game Maker out there. I used to use one that wasn't so good.   Anyway..

    I'm trying to make an object move towards another. I know this may sound easy but I'm just a beginner. I have searched around the forums but i haven't found anything that has worked.

    Thanks for your help! <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My Construct 2 "unexpectedly stopped working" and i lost my whole game..

    Welcome to the world of game-making. Do like I do, save every 2 minutes and set up some automatic backups

    For your question though, you'll have to be more specific. Are you using some of the movement behaviors or you just want some plain "move directly towards it and screw the rest"?

  • > My Construct 2 "unexpectedly stopped working" and i lost my whole game..

    Welcome to the world of game-making. Do like I do, save every 2 minutes and set up some automatic backups

    For your question though, you'll have to be more specific. Are you using some of the movement behaviors or you just want some plain "move directly towards it and screw the rest"?

    I want the object to "follow" touch if you know what i mean.

    where the player touches it moves towards it at a certain speed

  • Two things:

    Try playing around with the CustomMovement Behaviour on the Sprite you want to move. Also you need to add the "Touch" object to your project to allow recognition of touch.

    You also need to understand how to use expressions in your C2 project. I suggest looking in the tutorials for information on expressions.

    If you need more information, just ask :)

  • marlon667 how use custom movement to follow player sprite but i want to follow of image point 1 (not origin)

    or other movement method WITHOT changing angle of sprite

    i need right expression to move towards image point

  • delgado Ok you can use the Accelerate Towards Position Action in the CustomMovement Behaviour.

    For the X and Y parameters, open the Expression Window and navigat to the Sprite that you want to follow, there is an expression under Size and Position that says ImagePointX and ImagePointY (for the X and Y co-ordinates of the image points). Replace the ImagePoint in the place holder with the image point you want it to follow. I don't know about locking rotation though, sorry.

  • Theoatrix:

    You need to create a Touch object.

    Set a condition with "At every tick" (system group) and "Is in touch" (touch group).

    Use the Sprite action "rotate towards position" with a rotation speed (given by you), and use Touch.X and Touch.Y as positions.

    Use the Sprite action "move forward" with a speed given by you.

    I'm including a CAPX with this idea. Hopefully this helps!

  • marlon667 i cant change origin image point possition in editor i Must write expressions to other imagepoint, any ideas?

  • If you want to use the origin image point, use the X and Y expressions for the sprite. If you want to use an image point, use the ImagePointX and ImagePointY expressions.

    Create a new image point and call it something, then use the ImagePointX and ImagePointY expressions. Could I see a screenshot of what you want to do?

  • marlon667 i figure this out, this should be look like player.ImagePointX(1)

  • Yep, thats right :)

  • You helped me and my friend. We love you.

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