'Move to' on x axis

Talk about making games.

'Move to' on x axis

Postby Hedfone » Wed Nov 22, 2006 11:39 pm

hey y'all.
How can I make an actor 'move to' a destiantion on a mouse click, but ONLY on the x axis?
User avatar
Hedfone
 
Posts: 174
Joined: Mon Jul 31, 2006 9:47 pm
Score: 2 Give a positive score

Postby Troodon » Thu Nov 23, 2006 2:33 pm

I'm not sure if I fully understand what you want, but try:

draw actor-> follow mouse -> and choose x only :wink:
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Hedfone » Thu Nov 23, 2006 10:30 pm

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
User avatar
Hedfone
 
Posts: 174
Joined: Mon Jul 31, 2006 9:47 pm
Score: 2 Give a positive score

Postby Game A Gogo » Thu Nov 23, 2006 11:41 pm

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.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Fri Nov 24, 2006 3:00 am

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
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Troodon » Fri Nov 24, 2006 7:48 am

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.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Hedfone » Fri Nov 24, 2006 4:01 pm

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?
User avatar
Hedfone
 
Posts: 174
Joined: Mon Jul 31, 2006 9:47 pm
Score: 2 Give a positive score

Postby makslane » Sat Nov 25, 2006 1:55 pm

Try:

Code: Select all
if (xvelocity > 0)
{
    //Right animation
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest