Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MoonDog on Mon 08/06/2015 19:39:43

Title: Animating an object problem in only one of the rooms
Post by: MoonDog on Mon 08/06/2015 19:39:43
Hi everyone.

I'm a newbie to AGS and started a month ago
Everything was going well and even followed a bunch
Of tutorials already. But now that I want to animate an
Object, I have hit a wall.

Basically I can animate the object no problem
But while it's animating my character can't move
And I can't exit game or open menu.

And when I add eNoBlock to the object animate script the game crashes.
And when I add eBlock the object doesn't animate anymore
But everything else works fine.
Title: Re: Animating an object problem in only one of the rooms
Post by: alphadalekben on Mon 08/06/2015 20:01:01
Sorry if this sounds silly, but have you put down walkable areas in that room?

They're needed in a room otherwise the characters can't move.

Cheers,
alphadalekben
Title: Re: Animating an object problem in only one of the rooms
Post by: Snarky on Mon 08/06/2015 20:05:35
Please post your code and details of the crash.

Generally speaking, when something isn't working it's because you've done something wrong. If you don't show us what it is you've done, we have to guess what it could be. It's much easier if you just show us.
Title: Re: Animating an object problem in only one of the rooms
Post by: MoonDog on Mon 08/06/2015 20:28:57
my walkable areas are set up properly.

what I did typed for object animation was

Code (ags) Select

function room_RepExec()
{
  object[6].SetView(18);
object[6].Animate(0, 15, eRepeat);
}


I realized that game seems to think its in dialog mode when the object animates
because my mouse cursor icon for speech appears and all the GUI's dissapears.

Title: Re: Animating an object problem in only one of the rooms
Post by: Snarky on Mon 08/06/2015 20:43:58
OK, well, the reason why it's not working is that you're calling it from the room_RepExec() function. Recall that this function is called every game cycle, so what effectively happens is that the game starts playing the animation, but then immediately is told to play it again before it has even got going. That makes it restart from the beginning, and since it keeps doing that indefinitely it freezes. Instead, you have to put it in a function that is called once when you want the animation to start (probably the enter room after fade-in event handler).
Title: Re: Animating an object problem in only one of the rooms
Post by: MoonDog on Mon 08/06/2015 20:49:06
Thank you so much Snarky. Moving it to After Fadein worked. which is weird because I started with that but didnt want to work the first time.
Probably just forgot something the first time.

Does this mean if I want to animate a bunch of objects for that room I just carry on adding to those Lines?
Title: Re: Animating an object problem in only one of the rooms
Post by: Snarky on Mon 08/06/2015 20:55:27
Yeah, if they're just meant to animate constantly, sure. As long as they're all non-blocking, they can all animate in the background without interference.

Glad you got it working!
Title: Re: Animating an object problem in only one of the rooms
Post by: MoonDog on Mon 08/06/2015 21:03:11
Alright then. this will make things easier now.