Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Darkmaster400 on Sat 24/06/2006 14:04:05

Title: Moving and animating an object (SOLVED)
Post by: Darkmaster400 on Sat 24/06/2006 14:04:05
Hello guys,

Okay Ima go straigh to line here,

I have View1 and View2 here, okay.. And in this case I will use View2..
So I have 1 frame in Loop 0 (Down), and more frames in Loop 1 (Left), Okay..
Now I want Loop 0 to be enabled and moving towards a X and Y point.
I done that now, okay.. Then it reaches the x and y point, so I want it to
jump to Loop 1, WHEN it has reached the x and y point..

I tried:

*object*.SetView(2, 0);
*object*.Visible = true;
*object*.Move(155, 180, 2);
*object*.Visible = false;
*object2*.Visible = true;

With the code above, I wanted the object in Loop 0 to move to a postion then
it will disappear and the object in Loop 1 would be visible, so it LOOKS LIKE
the object are being replaced at a position, but as you can see, it
will disappear and the other object (object2) will appear..

Something is wrong now with this code..

I simply want object1 to go to a position then start animating object2
Title: Re: Stuck in a animation.
Post by: Ashen on Sat 24/06/2006 14:15:24
Firstly, I think this should be in Beginners Tech, as it seems like a pretty basic question. Although, since you haven't actually said what the problem IS, it's hard to tell.

The most obvious thing is, there's nothing to make the object animate. Unlike Characters, Objects don't automatically animate just because they're moving, so you'll need to include an Object.Animate (http://www.adventuregamestudio.co.uk/manual/Object.Animate.htm) command in there somewhere. You'll also want to look at the eBlock parameter for Object.Move (http://www.adventuregamestudio.co.uk/manual/Object.Move.htm), as that'll make it wait for the movement to finish, before the next bit (object 1 off, object 2 on).
(Unless you've got it in another bit of code somewhere, you might also want to set object 2's view & loop - although I don't see why you're using 2 objects instead of just animating object 1 with the second loop.)

In short - reading the manual would've helped here.
Title: Re: Stuck in a animation.
Post by: Darkmaster400 on Sat 24/06/2006 14:25:17
Yes, the objects are in same view..
But your right, I COULD try to use 1 Loop, but if I do it will animate at the same time
it moves, and then I want it to be Frame 1 in the Loop until it reaches the position..
And when it reached the position, THEN I want it to start animate.. tried everything here :-\
Title: Re: Stuck in a animation.
Post by: Ashen on Sat 24/06/2006 14:34:55
Read those manual entries (if you didn't notice, Object.Animate (http://www.adventuregamestudio.co.uk/manual/Object.Animate.htm) and Object.Move (http://www.adventuregamestudio.co.uk/manual/Object.Move.htm) in my last post link to the on-line version of the manual). Specifically note that:
Title: Re: Stuck in a animation.
Post by: Darkmaster400 on Sat 24/06/2006 15:44:20
Thanks for the great code, but isnt:

*object*.animate(0, 3, eOnce, eBlock);

pretty useless, since I am only using 1 frame in the loop??

EDIT: GREAT!! I got it to work the way I wanted now! Thanks..
Title: Re: Stuck in a animation.
Post by: Ashen on Sat 24/06/2006 15:55:49
Ah yes, sorry - misunderstood. I thought you wanted animation-movement-animation (since you're talking about two loops). If you don't want it to animate before moving then just remove the line you quoted. Or set the object to the graphic you want in the editor, and use object.SetView immediately before the animation, since a one frame loop is a bit pointless in itself.
Title: Re: Stuck in a animation.
Post by: Darkmaster400 on Sat 24/06/2006 16:27:25
hah okay, well it works great now anyhow with the code u posted..
But im experience something I think is related to the sprites and not the codes..

I got Loop0 to fall now but when it changes over to Loop1 it is moving away a little
from where Loop0 landed.. Hmm,  :-\..

Thanks anyhow Ashen ;D