Skip to content

Commit

Permalink
Update 10-9-enemies-and-basic-ai.html.md (#282)
Browse files Browse the repository at this point in the history
Code was missing the action variable. Otherwise errors will be thrown in the switch for facing.
  • Loading branch information
AndyAnon14 authored Mar 11, 2024
1 parent fcc9be3 commit 6b7b64b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions documentation/01_tutorial/10-9-enemies-and-basic-ai.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ What would a dungeon game be without enemies? Let's add some!

override public function update(elapsed:Float)
{
var action = "idle";
if (velocity.x != 0 || velocity.y != 0)
{
action = "walk";
if (Math.abs(velocity.x) > Math.abs(velocity.y))
{
if (velocity.x < 0)
Expand Down

0 comments on commit 6b7b64b

Please sign in to comment.