MoveTo

From Game Editor

Revision as of 01:48, 4 May 2011 by Skydereign (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

int MoveTo(char *actorName, double x, double y, double velocity, char *relativeActor, char *avoidActor);

This function makes actorName move to point (x,y) at a speed, velocity. If specified, actorName will avoid any clones of avoidActor. Returns 1 on success, 0 on error.

MoveTo Input

actorName

  • "Event Actor": Actor that is receiving the current event.
  • "Parent Actor": Event Actor's parent, if actor has a parent.
  • "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
  • "Collide Actor": Actor that collided with the event Actor.
  • Any Actor name or clonename in the game.


x and y

  • Any point (x,y).


velocity

  • Any positive velocity.


relativeActor

  • "Event Actor": Actor that is receiving the current event.
  • "Parent Actor": Event Actor's parent, if actor has a parent.
  • "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
  • "Collide Actor": Actor that collided with the event Actor.
  • "Game Center": Normal global coordinates.
  • "Mouse Position": Relative to point (xmouse,ymouse).
  • Any Actor name or clonename in the game.


avoidActor

  • "Event Actor": Actor that is receiving the current event.
  • "Parent Actor": Event Actor's parent, if actor has a parent.
  • "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
  • "Collide Actor": Actor that collided with the event Actor.
  • Any Actor name or clonename in the game.


Example:

Have ai move to player while avoiding walls.

enemy -> CreateActor -> Script Editor

MoveTo("Event Actor", 0, 0, 5, "player", "walls");