Here's an example of the current enemy lua script format:
file: enemy.lua
-- Start paste --
--- Enemy.lua ---
--- Generic enemy template/experiment for lua integration purposes ---
enemy = {
x = math.random(20, 780),
y = math.random(20, 580),
texture = "enemy1.png",
ticks = 0,
heading = 1,
}
init = function()
return enemy.texture, enemy.x, enemy.y
end
step = function()
enemy.ticks = enemy.ticks + 1
enemy.x = enemy.x + math.cos( math.rad(enemy.heading) ) * 1
enemy.y = enemy.y + math.sin( math.rad(enemy.heading) ) * 1
enemy.heading = enemy.heading + .75
if enemy.ticks % 20 == 0 then
addBullet("green01.png", enemy.x+8, enemy.y+8, math.rad(enemy.heading), 1 )
end
if enemy.ticks % 150 == 0 then
for i=0,360,10 do
addBullet("red01.png", enemy.x+8, enemy.y+8, math.rad(i), .5)
end
end
return enemy.x, enemy.y
end
-- End Paste --