|
@@ -13,6 +13,8 @@
|
|
|
seed=12345
|
|
|
player={
|
|
|
x=20, y=50,
|
|
|
+ vx=0, vy=0,
|
|
|
+ speed=1.5,
|
|
|
inv=0,
|
|
|
show=1,
|
|
|
fire=0,
|
|
@@ -219,7 +221,7 @@ function drawPlayer()
|
|
|
local randFactor = math.random(10,100)
|
|
|
local spawnOffsetY = 1
|
|
|
|
|
|
- local lineStart = math.random(player.x+20, 260)
|
|
|
+ local lineStart = math.random(player.x//1+20, 260)
|
|
|
if player.gun_down then
|
|
|
spawnOffsetY = 18
|
|
|
-- vulcan tilts downward so we get to do trig! yay!
|
|
@@ -337,26 +339,35 @@ function drawDebug()
|
|
|
end
|
|
|
|
|
|
function update()
|
|
|
- if btn(0) then
|
|
|
- if player.y > 0 then
|
|
|
- player.y=player.y-2
|
|
|
- end
|
|
|
+ player.vx = 0
|
|
|
+ player.vy = 0
|
|
|
+ if btn(0) then
|
|
|
+ player.vy=-player.speed
|
|
|
end
|
|
|
- if btn(1) then
|
|
|
- if player.y < 120 then
|
|
|
- player.y=player.y+2
|
|
|
- end
|
|
|
+ if btn(1) then
|
|
|
+ player.vy=player.speed
|
|
|
end
|
|
|
- if btn(2) then
|
|
|
- if player.x > 1 then
|
|
|
- player.x=player.x-2
|
|
|
- end
|
|
|
+ if btn(2) then
|
|
|
+ player.vx=-player.speed
|
|
|
end
|
|
|
if btn(3) then
|
|
|
- if player.x < 216 then
|
|
|
- player.x=player.x+2
|
|
|
- end
|
|
|
- end
|
|
|
+ player.vx=player.speed
|
|
|
+ end
|
|
|
+
|
|
|
+ -- slow down diagonal movements
|
|
|
+ if player.vx * player.vy ~= 0 then
|
|
|
+ player.vx = player.vx * 0.707
|
|
|
+ player.vy = player.vy * 0.707
|
|
|
+ end
|
|
|
+
|
|
|
+ player.x = player.x + player.vx
|
|
|
+ player.y = player.y + player.vy
|
|
|
+
|
|
|
+ if player.x < 5 then player.x = 5 end
|
|
|
+ if player.x > 220 then player.x = 220 end
|
|
|
+ if player.y < 5 then player.y = 5 end
|
|
|
+ if player.y > 128 then player.y = 128 end
|
|
|
+
|
|
|
-- A: fire main gun
|
|
|
if btn(4) then
|
|
|
if player.fire == 0 then
|