X axis MoveTo ?

Game Editor comments and discussion.

X axis MoveTo ?

Postby sonepoxy2015 » Thu Jun 18, 2015 2:56 am

hi,
is there a way to make an actor move to but just on the x axis?
i know there is a way with
actor.x=player.x;

but this would be to fast, i want him slowly fallow like in movto...
Create game!
cung cap son san epoxy | thi cong son epoxy
sonepoxy2015
 
Posts: 1
Joined: Wed Jun 17, 2015 8:41 am
Score: 0 Give a positive score

Re: X axis MoveTo ?

Postby DeltaLeeds » Thu Jun 18, 2015 8:11 am

So you want the actor to chase the player in a side scroller style? You can use angle, direction and directional_velocity for that. ;)
Right click the actor, go to draw actor, and paste the code below in script editor:
Code: Select all
angle=direction(x,y,player.x,y);
directional_velocity=3;//Or put different speeds to test out which speed is the best.

This code makes the actor's x move to the player's x in the speed of directional_velocity, and the y will stay constant as it will stay at y.
Hope this helps. ;)
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: X axis MoveTo ?

Postby lcl » Thu Jun 18, 2015 10:41 am

You can use what jonathang suggests, that should do pretty much what you asked for.

Or then you can use MoveTo, but instead of making it move to the actor by selecting the actor from the list, you can make it move to it by giving the actors coordinates as the place where to move to.
Code: Select all
MoveTo("Event Actor", movetothis.x, y, 3, "Game Center", "");

Replace 'movetothis' with the name of the actor you want the event actor to move to on x axis. The value y here is the event actor's y, so it will move to the y it already is on and to the x the other actor is at.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron