-
Book Overview & Buying
-
Table Of Contents
Learning game AI programming with Lua
By :
So far we've been using global data to store information about our agents. As we're going to create decision structures that require information about our agents, we'll create a local userdata table variable that contains our specific agent data as well as the agent controller in order to manage animation handling:
local userData =
{
alive, -- terminal flag
agent, -- Sandbox agent
ammo, -- current ammo
controller, -- Agent animation controller
enemy, -- current enemy, can be nil
health, -- current health
maxHealth -- max Health
};Moving forward, we will encapsulate more and more data as a means of isolating our systems from global variables. A userData table is perfect for storing any arbitrary piece of agent data that the agent doesn't already possess and provides a common storage area for data structures to manipulate agent data. So far, the listed data members are some common pieces of information we'll be storing...
Change the font size
Change margin width
Change background colour