|
@@ -3,6 +3,13 @@
|
|
-- desc: one-handed
|
|
-- desc: one-handed
|
|
-- script: lua
|
|
-- script: lua
|
|
|
|
|
|
|
|
+-- TODO:
|
|
|
|
+-- configurable controls
|
|
|
|
+-- cannon: more animation when firing
|
|
|
|
+-- gun transition sprites
|
|
|
|
+-- enemy collisions
|
|
|
|
+-- ammo counting
|
|
|
|
+
|
|
seed=12345
|
|
seed=12345
|
|
player={
|
|
player={
|
|
x=20, y=50,
|
|
x=20, y=50,
|
|
@@ -348,19 +355,18 @@ function update()
|
|
player.x=player.x+2
|
|
player.x=player.x+2
|
|
end
|
|
end
|
|
end
|
|
end
|
|
- if btnp(4) then
|
|
|
|
- player.gun_held = player.gun_held + 1
|
|
|
|
- if player.gun_held > 6 then player.gun_held = 0 end
|
|
|
|
|
|
+ -- A: fire main gun
|
|
|
|
+ if btn(4) then
|
|
|
|
+ if player.fire == 0 then
|
|
|
|
+ player.fire = 5
|
|
|
|
+ table.insert(p_bullets, {x=player.x+10, y=player.y+2})
|
|
|
|
+ else
|
|
|
|
+ player.fire = player.fire - 1
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
+
|
|
|
|
+ -- B: fire accessory gun
|
|
if btn(5) then
|
|
if btn(5) then
|
|
- --if player.gun_held == 0 then
|
|
|
|
- if player.fire == 0 then
|
|
|
|
- player.fire = 5
|
|
|
|
- --table.insert(p_bullets, {x=player.x+10, y=player.y+2})
|
|
|
|
- else
|
|
|
|
- player.fire = player.fire - 1
|
|
|
|
- end
|
|
|
|
- --end
|
|
|
|
if player.gun_held == 1 then
|
|
if player.gun_held == 1 then
|
|
player.is_firing = 1
|
|
player.is_firing = 1
|
|
end
|
|
end
|
|
@@ -382,13 +388,21 @@ function update()
|
|
end
|
|
end
|
|
else
|
|
else
|
|
player.big_gun_cooldown = 0
|
|
player.big_gun_cooldown = 0
|
|
|
|
+ player.is_firing = 0
|
|
end
|
|
end
|
|
- if btnp(5) then
|
|
|
|
- -- debug
|
|
|
|
|
|
+
|
|
|
|
+ -- X: switch arm
|
|
|
|
+ if btnp(6) then
|
|
player.gun_down = not player.gun_down
|
|
player.gun_down = not player.gun_down
|
|
player.gun_anim = 1
|
|
player.gun_anim = 1
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+ -- Y: swap weapon (debug)
|
|
|
|
+ if btnp(7) then
|
|
|
|
+ player.gun_held = player.gun_held + 1
|
|
|
|
+ if player.gun_held > 6 then player.gun_held = 0 end
|
|
|
|
+ end
|
|
|
|
+
|
|
for key,val in ipairs(p_bullets) do
|
|
for key,val in ipairs(p_bullets) do
|
|
p_bullets[key].x = p_bullets[key].x + 8
|
|
p_bullets[key].x = p_bullets[key].x + 8
|
|
if val.x > 240 then
|
|
if val.x > 240 then
|