4 Commits

View File

@ -417,8 +417,8 @@ mknew(fuzzy, function(x)
local p = (x.p or fuzzy.p) & 0xffff local p = (x.p or fuzzy.p) & 0xffff
x.mass = 0 x.mass = 0
while p ~= 0 do while p ~= 0 do
x.mass += p & 0x8000 x.mass += p & 1
p = p << 1 p = (p >>> 1) & 0xffff
end end
end) end)
@ -427,7 +427,7 @@ function fuzzy:update()
if (self.n < self.interval) return if (self.n < self.interval) return
self.n = 0 self.n = 0
for i=1,self.tries do for i=1,self.tries do
local b = 1 << rnd(15) local b = 1 << rnd(16)
if b & self.p == 0 then if b & self.p == 0 then
if i == self.tries or not self.weight or self.mass <= self.weight then if i == self.tries or not self.weight or self.mass <= self.weight then
self.mass += 1 self.mass += 1
@ -513,7 +513,7 @@ end
function title_screen:draw() function title_screen:draw()
pal() pal()
memset(0x5f78,0x0,8) clear_alt_pal_bits()
cls(12) cls(12)
print("title screen", 30, 57, 0) print("title screen", 30, 57, 0)
print("press right arrow", 15, 66, 0) print("press right arrow", 15, 66, 0)
@ -818,6 +818,10 @@ function wave(toff)
return 2.5 * sin((t()+toff)>>1) return 2.5 * sin((t()+toff)>>1)
end end
function clear_alt_pal_bits()
memset(0x5f70,0x0,16)
end
sea = {} sea = {}
mknew(sea) mknew(sea)
@ -1013,16 +1017,17 @@ end
function start_game() function start_game()
seq = sequencer.new{ seq = sequencer.new{
{ -- {
f = arcade_level.new, -- f = arcade_level.new,
params = {{ -- params = {{
max_score=2, -- max_score=2,
}} -- }}
}, -- },
{ {
f = function() f = function()
pal() pal()
return view.of{bg.new(), fuzzy_stripey.new{interval=7}} clear_alt_pal_bits()
return view.of{bg.new(), fuzzy_stripey.new{interval=7, tries=5}}
end, end,
}, },
} }