Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DazJ on Sat 02/02/2008 16:37:54

Title: Animating Objects To Enter Screen Left and Exit Screen Right
Post by: DazJ on Sat 02/02/2008 16:37:54
Ok, so I have my object (a cloud) and I want it to appear from off the left-handside of the screen and disappear off the right. I can do this so far...well, to an extent.

The thing is, I can't have my cloud start off screen, it has to be ON screen before I can code it to move off screen. Is this because of the walkable area?

If this is the case then how can I have my cloud enter smoothly from offscreen if they can only move on walkable areas? Obviously there's no walkable area off-screen.

Any help would be appreciated.

I'm using AGS 3.0.



Title: Re: Animating Objects To Enter Screen Left and Exit Screen Right
Post by: Radiant on Sat 02/02/2008 16:57:54
Objects can be off-screen just fine. You can e.g. move them off-screen when the player enters the room, before fading in.

The MoveDirect functions and MoveStraight functions can be used to move a character directly, and having it ignore walkable areas (or lack thereof) while it does so.
Title: Re: Animating Objects To Enter Screen Left and Exit Screen Right
Post by: DazJ on Sat 02/02/2008 18:20:00
I'm not wanting to move the characters I'm wanting to move an object.

I'm wanting the object to be OFFSCREEN when the screen loads and I want it to glide across off-screen to the right.

The MoveObjectDirect is now obselete and using the standard Object[1].Move won't move the object because it's not over a walkable area.
Title: Re: Animating Objects To Enter Screen Left and Exit Screen Right
Post by: OneDollar on Sat 02/02/2008 19:12:56
The code you're looking for is
oObject.Move(x, y, speed, blocking, eAnywhere);
which works the same as the character's walk functions. eAnywhere (as opposed to eWalkableAreas) will move your character whether they are on a walkable area or not. Then as Radiant has already said you need to set the object's x and y position in the room's Before Fade-In function, something like:


function room_Load()
{
   oObject.X=340;
   oObject.Y=60;
}