Skip to content
Sean Bohan edited this page Dec 9, 2016 · 2 revisions

Motivation

D.R.Y

What is "Behavior"

In brief a Behavior is an isolated block of code that gives an object some abilities like bounce, jump, 4-way move. Every behavior works as its own, may or may not combine with others.

Why not pure ECS system

The pure ECS style can be very performant, systems are some pure functions which brings robust logic. The problem is that you need to manage entities and components manually, and usually such a system is hard to design and code. Which is not even a problem for serious projects but takes time and requires higher level skill of developers.

This kind of thing already exists in LesserPanda, they are called Systems. They are responsible to the most important parts like "graphics", "physics", "timer" and "animation".

While a behavior can be self-contained, that does not require external steps to work, simply call behave and you are ready to go.

Read before create a new behavior

  • Behaviors should inherit Behavior interface
  • Every behavior should have a unique type property
  • It may provides some methods as actions
  • Enable canEverTick or canFixedTick of entities to be able to get behavior itself updated