Compare commits
No commits in common. "a4590821be8861c786204e5f7fab5bd70586cc56" and "f3ac1f492c5cfc4f05a3d426d04a0b7ac45e0468" have entirely different histories.
a4590821be
...
f3ac1f492c
@ -118,7 +118,6 @@ function linked_list:pop_front()
|
||||
end
|
||||
|
||||
function _init()
|
||||
init_blip_pals()
|
||||
wipe_level()
|
||||
primary_ship.main_gun = zap_gun.new()
|
||||
load_level(example_level)
|
||||
@ -427,7 +426,7 @@ ship_m = {
|
||||
shield = 0,
|
||||
maxshield = 0,
|
||||
shieldcost = 32767.9,
|
||||
shieldcooldown = 0x0.00a0,
|
||||
shieldcooldown = 180,
|
||||
|
||||
-- default generator behavior:
|
||||
-- 10 seconds for a full charge
|
||||
@ -435,6 +434,8 @@ ship_m = {
|
||||
power = 600,
|
||||
generator = 1, -- power gen per frame
|
||||
|
||||
invincible_until = -32768,
|
||||
|
||||
slip = true, -- most enemies slide
|
||||
|
||||
xmomentum = 0,
|
||||
@ -516,6 +517,7 @@ end
|
||||
|
||||
function ship_m:hitsomething(dmg)
|
||||
if (dmg <= 0) return false
|
||||
if (lframe < self.invincible_until) return false
|
||||
self.shield_refresh_ready = lframe + self.shieldcooldown
|
||||
if self.shield >= dmg then
|
||||
self.shield -= dmg
|
||||
@ -862,7 +864,7 @@ end
|
||||
-- effective frame
|
||||
distance = 0
|
||||
-- actual frame count since
|
||||
-- start of level times 0x0.0001
|
||||
-- start of level
|
||||
lframe = 0
|
||||
|
||||
-- do not advance distance when
|
||||
@ -886,7 +888,7 @@ function load_level(lvltbl)
|
||||
end
|
||||
|
||||
function level_frame()
|
||||
lframe += 0x0.0001
|
||||
lframe += 1
|
||||
if (current_level == nil) return true
|
||||
if freeze == 0 then
|
||||
distance += 1
|
||||
@ -1006,11 +1008,11 @@ function spawn_blocking_boss_chasey()
|
||||
chasey.die(self)
|
||||
end
|
||||
|
||||
local nextspawn = lframe + 0x0.0080
|
||||
local nextspawn = lframe + 120
|
||||
events:push_back{move=function()
|
||||
if lframe >= nextspawn then
|
||||
helpers[flr(rnd(#helpers))+1]()
|
||||
nextspawn += 0x0.0040
|
||||
nextspawn += 60
|
||||
end
|
||||
return c.dead
|
||||
end}
|
||||
@ -1053,7 +1055,7 @@ example_level = {
|
||||
events:push_back{move=function()
|
||||
if (lframe < tnext) return false
|
||||
spawn_blocking_blocky()
|
||||
tnext = lframe + 0x0.000c
|
||||
tnext = lframe + 12
|
||||
remain -= 1
|
||||
return (remain <= 0)
|
||||
end}
|
||||
@ -1174,7 +1176,7 @@ mknew(zap)
|
||||
zap_gun = gun_base.new{
|
||||
enemy = false,
|
||||
power = 20, -- power consumed per shot
|
||||
cooldown = 0x0.000a, -- frames between shots
|
||||
cooldown = 10, -- frames between shots
|
||||
ammo = nil, -- unlimited ammo - main gun
|
||||
t = zap -- metatable of bullet to fire
|
||||
}
|
||||
@ -1231,7 +1233,7 @@ blast_gun = gun_base.new{
|
||||
icon = 13,
|
||||
enemy = false,
|
||||
power = 0, -- ammo, not power
|
||||
cooldown = 0x0.0020, -- frames between shots
|
||||
cooldown = 30, -- frames between shots
|
||||
ammo = 5,
|
||||
maxammo = 5,
|
||||
t = blast -- type of bullet to fire
|
||||
@ -1264,7 +1266,7 @@ protron_gun = gun_base.new{
|
||||
icon = 25,
|
||||
enemy = false,
|
||||
power = 35,
|
||||
cooldown = 0x0.000f, -- frames between shots
|
||||
cooldown = 15, -- frames between shots
|
||||
ammo = nil,
|
||||
maxammo = nil,
|
||||
actually_shoot = function(self, x, y)
|
||||
@ -1322,7 +1324,7 @@ vulcan_gun = gun_base.new{
|
||||
icon = 37,
|
||||
enemy = false,
|
||||
power = 8,
|
||||
cooldown = 0x0.0002, -- frames between shots
|
||||
cooldown = 2, -- frames between shots
|
||||
ammo = nil,
|
||||
maxammo = nil,
|
||||
dxs = {0.35, -0.35, -0.7, 0.7, 0.35, -0.35},
|
||||
@ -1571,22 +1573,21 @@ it sets lframe ("level frame")
|
||||
and distance to 0.
|
||||
|
||||
every frame, level_frame
|
||||
increments lframe by 0x0.0001.
|
||||
then if the level is not frozen,
|
||||
it increments distance by 1.0
|
||||
and runs the function in the
|
||||
level table for exactly that
|
||||
frame number (if any). distance
|
||||
is therefore "nonfrozen frames",
|
||||
and is used to trigger level
|
||||
progress. lframe always
|
||||
increments lframe. then if the
|
||||
level is not frozen (more on
|
||||
that later), it increments
|
||||
distance and runs the function
|
||||
in the level table for exactly
|
||||
that frame number (if any).
|
||||
distance is therefore "nonfrozen
|
||||
frames", and is used to trigger
|
||||
level progress. lframe always
|
||||
increments. ships are encouraged
|
||||
to use lframe to control
|
||||
animation and movement, and may
|
||||
use distance to react to level
|
||||
progress separately from overall
|
||||
time. remember to multiply
|
||||
lframe-related stuff by 0x0001.
|
||||
time.
|
||||
|
||||
a special sentinel value, eol,
|
||||
marks the end of the level.
|
||||
@ -1753,19 +1754,10 @@ end
|
||||
|
||||
mknew(blip_fx)
|
||||
|
||||
blip_pals = {}
|
||||
function init_blip_pals()
|
||||
for i=0,15 do
|
||||
local pp = {[0]=0}
|
||||
for j=1,15 do
|
||||
pp[j] = i
|
||||
end
|
||||
blip_pals[i]=pp
|
||||
end
|
||||
end
|
||||
|
||||
function blip(obj, col, frames)
|
||||
obj.fx_pal = blip_pals[col]
|
||||
local p = {[0]=0}
|
||||
obj.fx_pal = p
|
||||
for i=1,15 do p[i]=col end
|
||||
if (obj.___fx_pal_event) obj.___fx_pal_event:abort()
|
||||
events:push_back(blip_fx.new{frames=frames, obj=obj})
|
||||
end
|
||||
@ -1850,7 +1842,7 @@ sheen8x8 = split"2,54,55,56,57,58,59,60,61"
|
||||
|
||||
function powerup:draw()
|
||||
spr(self.sprites[max(1,
|
||||
((lframe<<16)\self.anim_speed)
|
||||
(lframe\self.anim_speed)
|
||||
%(#self.sprites+self.loop_pause)
|
||||
-self.loop_pause
|
||||
+1)],
|
||||
|
Loading…
Reference in New Issue
Block a user