12
« on: February 11, 2006, 09:56:37 AM »
Engine can recognize standart animation in acror's file definition. For example, walk animation named "WALK", and on event actor.GoTo engine use walk sprite.
I have a question. I need actor can use two kind of move animation. On left click he is walking, on right click he is slinking. So, I've made slink sprite named "SLINK". So, how I can switch king of moving animation? My actor is 2D type.
I have solution of this problem, but I think it's not ideal solution.
I've made two actors - actor1 and actor2. actor1 in WALK animation use walking sprites, actor2 in WALK animation use slinking sprites.
on "LeftClick"
{
var actorX=actor.X;
var actorY=actor.Y;
Game.UnloadObject(actor);
actor = Game.LoadActor("actor1.actor");
actor.X=actorX;
actor.Y=actorY;
Game.MainObject = actor;
actor.GoTo(Scene.MouseX, Scene.MouseY);
}
on "RightClick"
{
var actorX=actor.X;
var actorY=actor.Y;
Game.UnloadObject(actor);
actor = Game.LoadActor("actor2.actor");
actor.X=actorX;
actor.Y=actorY;
Game.MainObject = actor;
actor.GoTo(Scene.MouseX, Scene.MouseY);
}
It's working nice, but how I can develop single actor with switching animation?