Resolve "New Fire Enemy"
Closes #4 (closed)
Here is what I have in mind for managing the enemy's animation.
Flamo is currently setup to keep moving back and forth as soon as the scene is created. However, Blaze will combine some of Flamo and a Critter's approach.
As soon as Blaze is spawned, play its normal animation, possibly from its playNormalAnimation
method. This method will be inspired by Critter.playCaptiveAnimation
. Tweens will be setup for the idle animation and walk animation. Both will have an onStart
method. The Idle animation tween's onStart
will seting the enemy's moving
property to false
. Then it will play the Idle animation in the direction the enemy is facing, which defaults to LEFT.
After the Idle tween, which plays for a few seconds, the Walk tween will have an onStart
that sets the enemy's moving
to true. In the scene's update
method, it will go through the array of enemies in the scene. When an enemy's moving
is true
, call the enemy's move
method.
The enemy's move
method will set the enemy's velocity according to the direction they are facing. When they get to left border of movement, switch direction to RIGHT. Same if they get to the right border of movement, switch the enemy's direction to LEFT.