|
@@ -11,14 +11,15 @@ x=96
|
|
y=24
|
|
y=24
|
|
|
|
|
|
local player = {
|
|
local player = {
|
|
- screenx=0,
|
|
+ screenx=110,
|
|
- screeny=0,
|
|
+ screeny=80,
|
|
spr=0,
|
|
spr=0,
|
|
spr_base=256,
|
|
spr_base=256,
|
|
flip=0,
|
|
flip=0,
|
|
cnt_run=0,
|
|
cnt_run=0,
|
|
cnt_fire=0,
|
|
cnt_fire=0,
|
|
- frames_run={258,260,262,260}
|
|
+ frames_run={258,260,262,260},
|
|
|
|
+ frame_slide=266,
|
|
}
|
|
}
|
|
|
|
|
|
function BOOT()
|
|
function BOOT()
|
|
@@ -26,36 +27,50 @@ function BOOT()
|
|
end
|
|
end
|
|
|
|
|
|
function update()
|
|
function update()
|
|
-
|
|
+ local is_running = false
|
|
-
|
|
+
|
|
if btn(2) then
|
|
if btn(2) then
|
|
player.cnt_run = player.cnt_run + 1
|
|
player.cnt_run = player.cnt_run + 1
|
|
player.flip = 1
|
|
player.flip = 1
|
|
|
|
+ is_running = true
|
|
end
|
|
end
|
|
if btn(3) then
|
|
if btn(3) then
|
|
player.cnt_run = player.cnt_run + 1
|
|
player.cnt_run = player.cnt_run + 1
|
|
player.flip = 0
|
|
player.flip = 0
|
|
|
|
+ is_running = true
|
|
end
|
|
end
|
|
if btn(4) then
|
|
if btn(4) then
|
|
- player.cnt_fire = 30
|
|
+ player.cnt_fire = 10
|
|
else
|
|
else
|
|
player.cnt_fire = player.cnt_fire - 1
|
|
player.cnt_fire = player.cnt_fire - 1
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+
|
|
|
|
+ if not is_running then player.cnt_run = 0 end
|
|
|
|
+
|
|
local spr_offset = 0
|
|
local spr_offset = 0
|
|
if player.cnt_run > 0 then
|
|
if player.cnt_run > 0 then
|
|
spr_offset = ((player.cnt_run // 6) % 4) + 1
|
|
spr_offset = ((player.cnt_run // 6) % 4) + 1
|
|
player.spr = player.frames_run[spr_offset]
|
|
player.spr = player.frames_run[spr_offset]
|
|
|
|
+ else
|
|
|
|
+ player.spr = player.spr_base
|
|
end
|
|
end
|
|
|
|
|
|
if player.cnt_fire > 0 then
|
|
if player.cnt_fire > 0 then
|
|
- spr_offset = 32 + spr_offset
|
|
+ player.spr = player.spr + 32
|
|
end
|
|
end
|
|
|
|
|
|
end
|
|
end
|
|
|
|
|
|
function draw_player(colorkey)
|
|
function draw_player(colorkey)
|
|
spr(player.spr, player.screenx, player.screeny, colorkey, 1, player.flip, 0, 2, 2)
|
|
spr(player.spr, player.screenx, player.screeny, colorkey, 1, player.flip, 0, 2, 2)
|
|
|
|
+ if player.cnt_fire > 8 then
|
|
|
|
+ if player.flip == 1 then
|
|
|
|
+ spr(270, player.screenx, player.screeny+2, colorkey, 1, player.flip)
|
|
|
|
+ else
|
|
|
|
+ spr(270, player.screenx+8, player.screeny+2, colorkey, 1, player.flip)
|
|
|
|
+ end
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
function TIC()
|
|
function TIC()
|
|
@@ -86,8 +101,8 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -96,14 +111,14 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -114,24 +129,24 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|