Create left and Right buttons to control NPC walking and release skill animation.
First, prepare a NPC Lianbo animation map and a skill Lianbo chart
Creating NPC animations in Kiwi.js is accomplished by means of the add (name cells speed [Loop=false] animationmanager [Play=false]) method of the
Create a background
this.bgsprite = new Kiwi.GameObjects.StaticImage (this, this.textures.background, 1000,);
this.bgsprite.x = 0;
this.bgsprite.y = 0;
This.addchild (this.bgsprite);
Create game NPC
This.snakesprite = new Kiwi.GameObjects.Sprite (this, this.textures.snake, 117);
Create the action, make the display frame, frame length, etc.
this.snakeSprite.animation.add ("Idle", [0,1], 0.3, true, true);
This.snakeSprite.animation.add ("Walking", [0,1,2,3,4,5,6], 0.2, true, false);
This.snakeSprite.animation.add ("Spawn", [1,2], 0.2, false, false);
this.snakesprite.x = m;
This.snakesprite.y = 370;
This.snakeSprite.speed = 2;
This.addchild (This.snakesprite);
The complete code
<! DOCTYPE html> Effect chart