Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Arjunaz78 on Thu 15/09/2011 07:04:09

Title: Characters Walk Off Screen [SOLVED]
Post by: Arjunaz78 on Thu 15/09/2011 07:04:09
Firstly..
i've problem to make a character walk off the screen from top of the screen & bottom of screen when making an intro/cutscene room.But i can make a character walk off by using x,y coordinate from both of left edge & right edge but difficult to make it using x,y coordinate from top,bottom screen.

I mean i want to make a character walk off the screen from top screen to bottom screen until left screen & from bottom screen to top screen until left the top screen,or should i said i want to make character walk within or straight follow the vertical lines but not horizontal line.

secondly..
i want to put a character in the middle of the screen without moving or animate it.how can i make it happen without the character walk/move or animate?

i appreciate if you can help me settling this problem.

TY.

p.s - sorry for my poor English.

sorry..i actually weak on making a script,plus using the c++ coding..
Title: Re: Characters Walk Off Screen
Post by: Khris on Thu 15/09/2011 11:21:08
To make a character walk off-screen, use the command's eAnywhere parameter.
I was testing this with this line:
player.Walk(player.x, 300, eNoBlock, eAnywhere);

Works flawlessly.

To set a character's positions, you can directly change their coordinates:

  cGuy.x = 160;
  cGuy.y = 120;


That'll put a character in the middle of a 320x240 room.

You could write an extender function:
void SetPosition(this Character*, int x, int y) {
  this.x = x;
  this.y = y;
}


Now you can use
  cGuy.SetPosition(160, 120);

You have to import it in the header to use it in room scripts:
import void SetPosition(this Character*, int x, int y);