Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Sequences


Lastly, we have sequences, which act as sequential blocks of execution that will execute each of their children in an order until a condition, selector, or child sequence fails to execute. Sequences will return true if all their children run successfully; if any one of their children returns false, the sequence immediately exits and returns false in turn:

SoldierLogic.lua:

local function CreateSequence()
    return BehaviorTreeNode.new(
        "sequence", BehaviorTreeNode.Type.SEQUENCE);
end