/GgdxAI-Example

A small example project to demonstrate how to use GdxAI's statemachine and message handling for simple state and AI handling

Primary LanguageKotlinMIT LicenseMIT

Kotlin LibGDX LibKTX

image

GdxAI Example

This is an example project on how to use GdxAI's state machine and message dispatching functionality to create a player character that can have following states:

  • Idle
  • Run
  • Jump
  • Fall
  • Attack (three different attack states)

In addition, there is a priest character who will heal the player if injured. The priest has these states:

  • Idle
  • Run
  • Cast

The project uses LibGDX, LibKTX, Box2D and Ashley. The components and systems are just a quick&dirt implementation, but you can of course use them as a reference.

The main focus however sits in com.github.quillraven.gdxaiexample.ai package and com.github.quillraven.gdxaiexample.ecs.system/ai.kt which are showing how you can use GdxAI for simple AI.

Player controls:

  • A -> Attack
  • J -> Jump
  • LEFT/RIGHT -> Move

I will trigger a delayed injured event to let the priest know that the player needs healing.

The code is explained in more detail in following video: Link to YouTube