Characters Walk Off Screen [SOLVED]

Started by Arjunaz78, Thu 15/09/2011 07:04:09

Previous topic - Next topic

Arjunaz78

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..
..In the making of Silent Hill: The Hospital..

https://www.facebook.com/ArjunazGamesStudio

Khris

To make a character walk off-screen, use the command's eAnywhere parameter.
I was testing this with this line:
Code: ags
player.Walk(player.x, 300, eNoBlock, eAnywhere);


Works flawlessly.

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

Code: ags
  cGuy.x = 160;
  cGuy.y = 120;


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

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


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


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

SMF spam blocked by CleanTalk