|
|
|
|
|
by vvanders
3811 days ago
|
|
Coroutines are also fantastic for scripting Game AI: local player = nil
while(player == nil) do
yeild(0)
player = LookForPlayer(...)
end
while(WalkTowardsPlayer(player)) do
yeild(0)
end
while(!PlayerDead(player)) do
MeleePlayer(player)
yield(0)
end
Makes state management super-simple and is something you can easily teach to designers as well. This is partly why you see Lua show up in so many game engines. |
|