Animating an object problem in only one of the rooms

Started by MoonDog, Mon 08/06/2015 19:39:43

Previous topic - Next topic

MoonDog

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.

alphadalekben

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

Snarky

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.

MoonDog

my walkable areas are set up properly.

what I did typed for object animation was

Code: ags

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.


Snarky

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).

MoonDog

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?

Snarky

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!

MoonDog

Alright then. this will make things easier now.

SMF spam blocked by CleanTalk