Kotlin LibGDX/KTX RPG Tutorial - Part 18 (AI State)
This is a tutorial series about game development using Kotlin, LibGDX with LibKTX extensions.
We are developing a small 2D adventure RPG using different technologies like Box2D, GdxAI, Entity Component System or Tiled.
The full source code of the tutorial can be found on github: https://github.com/Quillraven/MysticWoods
Part 18 - AI State:
In this part we are going to learn how to implement the state pattern into our game and handle several states for our player like IDLE, RUN or ATTACK.
Link to State design pattern: https://gameprogrammingpatterns.com/state.html
Link to LibGDX AI State Machine: https://github.com/libgdx/gdx-ai/wiki/State-Machine
Link to my other State Machine tutorial including telegrams: https://www.youtube.com/watch?v=LqAmBdKfPXU&t=1349s
Chapters:
00:00 - Preview of AI parts
02:00 - Introduction to State design pattern
09:30 - StateComponent
14:40 - LibGDX State
17:22 - Update StateComponent
18:10 - DefaultState
19:47 - StateComponentListener
20:55 - Update EntitySpawnSystem
22:05 - StateSystem
24:55 - IDLE state
30:00 - Update AiEntity
32:44 - RUN state
33:50 - ATTACK state part 1
37:10 - Update MoveSystem
38:00 - ATTACK state part 2
42:20 - Update AttackSystem
44:45 - Test first three states
45:42 - DEAD state
48:00 - RESURRECT state
49:57 - CHECK_ALIVE global state
54:41 - Update DeadSystem
56:20 - Test remaining states
57:10 - Summary