Opposite to MoveTo

Talk about making games.

Opposite to MoveTo

Postby Troodon » Wed Dec 06, 2006 6:32 pm

Hi,
Is there any way to make opposite of MoveTo code?
I mean that instead of going towards an actor, the main actor goes in opposite direction. I'm working on a game where an actor should escape monsters itself. :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 sonicfire » Thu Dec 07, 2006 12:03 am

great idea! but this should be possible using code ... but if easily or not - i dont know :? :D
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby Game A Gogo » Thu Dec 07, 2006 12:09 am

use something like this:
Code: Select all
direction("ennemy.x"."ennemy.y","x","y");
directional_velocity=2;


something like that.
[/code]
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 Troodon » Thu Dec 07, 2006 1:01 pm

:wink: Thanks, but with that code it says only:
illegal structure operation

Is there another code I could try?
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 Novice » Thu Dec 07, 2006 1:13 pm

Use this
Code: Select all
angle=direction(actor1.x, actor1.y, actor2.x, actor2.y); +180;
directional_velocity=4;

I tired it out and it works great.

BTW. remember to change the actor names and velocity to suit your game.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Troodon » Thu Dec 07, 2006 1:30 pm

WOW!! :shock: Thanks! It works like a seal!
Now I only have to make that if the distance is smaller than something it escapes, but I think I can make it myself. :D
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 Game A Gogo » Fri Dec 08, 2006 12:25 am

AHHH, i knew i forgot something!
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


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest