How do I make object move towards another object?

Get help using Construct 2

Post » Sat May 11, 2013 8:15 am

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!
B
9
Posts: 14
Reputation: 337

Post » Sat May 11, 2013 8:23 am

[QUOTE=Theoatrix] My Construct 2 "unexpectedly stopped working" and i lost my whole game..[/QUOTE]
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"?
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sat May 11, 2013 8:28 am

[QUOTE=7Soul] [QUOTE=Theoatrix] My Construct 2 "unexpectedly stopped working" and i lost my whole game..[/QUOTE]
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"?[/QUOTE]

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
B
9
Posts: 14
Reputation: 337

Post » Sun May 12, 2013 1:15 pm

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 :)
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 2:59 pm

@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 pointdelgado2013-05-12 15:27:01
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Sun May 12, 2013 3:47 pm

@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.
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 4:19 pm

@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!

[URL= https://www.dropbox.com/s/xrbmoldnym7o5ux/TouchFollow.capx][/URL]
B
24
S
10
G
10
Posts: 96
Reputation: 6,482

Post » Sun May 12, 2013 4:23 pm

@marlon667 i cant change origin image point possition in editor i Must write expressions to other imagepoint, any ideas?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Sun May 12, 2013 4:47 pm

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?
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 9:17 pm

@marlon667 i figure this out, this should be look like player.ImagePointX(1)
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests