Page 1 of 1

'Move to' on x axis

PostPosted: Wed Nov 22, 2006 11:39 pm
by Hedfone
hey y'all.
How can I make an actor 'move to' a destiantion on a mouse click, but ONLY on the x axis?

PostPosted: Thu Nov 23, 2006 2:33 pm
by Troodon
I'm not sure if I fully understand what you want, but try:

draw actor-> follow mouse -> and choose x only :wink:

PostPosted: Thu Nov 23, 2006 10:30 pm
by Hedfone
thnx tekdino, but that's not what I mean :( . I want, on left click, my actor moves towards the mouse at a velocity of about 3. but he only moves on the x axis. the 'move to' command only works on the x and y axis. anyone know how 2 do this? :D

PostPosted: Thu Nov 23, 2006 11:41 pm
by Game A Gogo
1. create a filled region
2. add an event mouse button down:
3. select script actor
4. create a variable whit 2 arrays
5. enter this code:
Code: Select all
MouseR[0]=xmouse;
MouseR[1]=ymouse;

6. add a move to action on mouse buttion down
7. make sure you enter teh variable in the x and y feilds.

PostPosted: Fri Nov 24, 2006 3:00 am
by makslane
Try this:

1) Create a Filled Region actor to act like a sensor
2) Create a player actor
3) In the sensor, on a 'Mouse Button Down' add a 'Move To' action with the values:

Actor: player
Relative to: Mouse Position
Avoid: (none)
Position: 0, 0
Velocity: 5

4) Now, to keep the player in the x axis, on a 'Draw Actor' event, put the action:

Code: Select all
y = 0; //Or other value


5) To a void a little flash, on a ' Move Finish' event, repeat the script above.

Get the example here:
http://game-editor.com/examples/moveto_1d.ged

PostPosted: Fri Nov 24, 2006 7:48 am
by Troodon
Avoid in 'Move to' !!!!!!
WOW!! :D I really would like to try the new GE!
:cry: It's pity that my folks accepted only one and I don't have VISA or Mastercard.

PostPosted: Fri Nov 24, 2006 4:01 pm
by Hedfone
sweetness mak! that works PERFECTLY :D
2 more things ( sry ) :


1. is there a way that I can have this type of movement AND gravity?

2. I need to make it so that if my player senses that he's moving rightward then he changes animation and the same with leftward. I've tried on DrawActor
Code: Select all
if (xvelocity=+2);
ChangeAnimation to right

but that didn't work. any suggestions?

PostPosted: Sat Nov 25, 2006 1:55 pm
by makslane
Try:

Code: Select all
if (xvelocity > 0)
{
    //Right animation
}