dolphin idle state
This commit is contained in:
parent
d49da29c2d
commit
e6c48029a4
161
vacation.p8
161
vacation.p8
@ -406,6 +406,7 @@ function newtitle()
|
|||||||
},
|
},
|
||||||
bg.new{c=1},
|
bg.new{c=1},
|
||||||
box,
|
box,
|
||||||
|
toyphin.new(),
|
||||||
{
|
{
|
||||||
x=128,
|
x=128,
|
||||||
update=function(self)
|
update=function(self)
|
||||||
@ -439,6 +440,10 @@ mknew(arcade_level, function(x)
|
|||||||
x.fx = linked_list.new()
|
x.fx = linked_list.new()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- global
|
||||||
|
function wave()
|
||||||
|
return 2.5 * sin(t()>>1)
|
||||||
|
end
|
||||||
|
|
||||||
-- dolphin sprite states:
|
-- dolphin sprite states:
|
||||||
-- spr args
|
-- spr args
|
||||||
@ -452,60 +457,124 @@ end)
|
|||||||
-- single sprite is bigger on
|
-- single sprite is bigger on
|
||||||
-- the sprite sheet but easier
|
-- the sprite sheet but easier
|
||||||
-- to render.
|
-- to render.
|
||||||
phinstate_nrm = {}
|
phin_nrm_pal = {
|
||||||
|
[2]=2,
|
||||||
|
[7]=7,
|
||||||
|
[12]=12,
|
||||||
|
}
|
||||||
|
phin_uw_pal = {
|
||||||
|
[2]=130,
|
||||||
|
[7]=135,
|
||||||
|
[12]=140,
|
||||||
|
}
|
||||||
|
|
||||||
phinstate_jump_full = {}
|
phinstate_nrm = {
|
||||||
|
s={4, 36, 4, 9},
|
||||||
phinstate_jump_wane = {}
|
ws=3,
|
||||||
|
hs=2,
|
||||||
phinstate_crest = {}
|
p=phin_nrm_pal,
|
||||||
|
floaty=true,
|
||||||
phinstate_fall_wax = {}
|
}
|
||||||
|
phinstate_jump_full = {
|
||||||
phinstate_fall_full = {}
|
s={7},
|
||||||
|
ws=2,
|
||||||
phinstate_dive_full = {}
|
hs=3,
|
||||||
|
p=phin_nrm_pal,
|
||||||
phinstate_dive_wane = {}
|
}
|
||||||
|
phinstate_jump_wane = {
|
||||||
phinstate_return = {}
|
s={1},
|
||||||
|
ws=3,
|
||||||
phinstate_rise_wax = {}
|
hs=3,
|
||||||
|
p=phin_nrm_pal,
|
||||||
phinstate_rise_full = {}
|
}
|
||||||
|
phinstate_crest = {
|
||||||
|
s={4},
|
||||||
|
ws=3,
|
||||||
|
hs=2,
|
||||||
|
p=phin_nrm_pal,
|
||||||
|
}
|
||||||
|
phinstate_fall_wax = phinstate_jump_wane
|
||||||
|
phinstate_fall_full = phinstate_jump_full
|
||||||
|
phinstate_dive_full = {
|
||||||
|
s={7},
|
||||||
|
ws=2,
|
||||||
|
hs=3,
|
||||||
|
p=phin_uw_pal,
|
||||||
|
}
|
||||||
|
phinstate_dive_wane = {
|
||||||
|
s={1},
|
||||||
|
ws=3,
|
||||||
|
hs=3,
|
||||||
|
p=phin_uw_pal,
|
||||||
|
}
|
||||||
|
phinstate_return = {
|
||||||
|
s={4},
|
||||||
|
ws=3,
|
||||||
|
hs=2,
|
||||||
|
p=phin_uw_pal,
|
||||||
|
}
|
||||||
|
phinstate_rise_wax = phinstate_dive_wane
|
||||||
|
phinstate_rise_full = phinstate_dive_full
|
||||||
|
|
||||||
|
|
||||||
toyphin = {
|
toyphin = {
|
||||||
x=3,
|
x=-24,
|
||||||
y=56,
|
y=56,
|
||||||
state=phinstate_nrm,
|
dy=0,
|
||||||
|
state=phinstate_nrm
|
||||||
}
|
}
|
||||||
mknew(toyphin)
|
mknew(toyphin)
|
||||||
|
|
||||||
|
function toyphin:update()
|
||||||
|
-- entry mode?
|
||||||
|
if not self.entered then
|
||||||
|
self.x += 1
|
||||||
|
self.entered = self.x >= 4
|
||||||
|
end
|
||||||
|
-- TODO: switch states, do physics, etc.
|
||||||
|
-- prepare for collision detection
|
||||||
|
self.w=self.state.ws*8
|
||||||
|
self.h=self.state.hs*8
|
||||||
|
end
|
||||||
|
|
||||||
|
function toyphin:draw()
|
||||||
|
local st, y = self.state, self.y
|
||||||
|
if (st.floaty) y += wave()
|
||||||
|
spr(st.s[1+(((t()<<1)&0x0.FFFF*#st.s)&0x7FFF)], self.x, y, self.state.ws, self.state.hs)
|
||||||
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
-- game sequencer
|
-- game sequencer
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000777777777777777777777777777777777777777777777777777777777777777700000000000000000000000000000000000000000000000000000000
|
00000000777777777777777777777777777777777777777777777777777777777777777777777777777777777777777700000000000000000000000000000000
|
||||||
00000000700000000000000000000007700000000000000000000007700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007700000000000000000000007700000000000000770000000000000000000000700000000000000000000000000000000
|
||||||
00700700700000000000000000000007700000000000000000000007700000000000000700000000000000000000000000000000000000000000000000000000
|
00700700700000000000000000000007700000000000000000000007700002222220000770000000000000000000000700000000000000000000000000000000
|
||||||
00077000700000000000000000000007700000000000000000000007700000cccc00000700000000000000000000000000000000000000000000000000000000
|
00077000700000000000000000000007700000000000000000000007700002cccc20000770000000000000000000000700000000000000000000000000000000
|
||||||
0007700070000000000000000000000770000000000000000000000770000000c000000700000000000000000000000000000000000000000000000000000000
|
0007700070000000000000000000000770000000000000000000000770000222c220000770222200000000000000000700000000000000000000000000000000
|
||||||
00700700700000000000000000000007700000000000000000000007700000cccc00000700000000000000000000000000000000000000000000000000000000
|
00700700700000000000000000000007702222022222222222222207700002cccc200007702cc222222222222222220700000000000000000000000000000000
|
||||||
00000000700000000000000000000007700cc000c00c00cc00c0c007700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007702cc222c22c22cc22c2c2077000022222200007702c2c22c22c22cc22c2c20700000000000000000000000000000000
|
||||||
00000000700000000000000000000007700c0c0c0c0c00c0c0c0c0077000000c0000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007702c2c2c2c2c22c2c2c2c2077000022c22000007702c2c2c2c2c22c2c2c2c20700000000000000000000000000000000
|
||||||
00000000700000000000000000000007700c0c0c0c0c00cc00ccc007700000c0c000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007702c2c2c2c2c22cc22ccc207700002c2c2200007702ccc2c2c2c22cc22ccc20700000000000000000000000000000000
|
||||||
00000000700000000000000000000007700ccc00c00cc0c000c0c007700000cccc00000700000000000000000000000000000000000000000000000000000000
|
00000000702222022222222222222207702ccc22c22cc2c222c2c207700002cccc20000770222222c22cc2c222c2c20700000000000000000000000000000000
|
||||||
00000000700cc000c00c00cc00c0c007700000000000000000000007700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000702cc222c22c22cc22c2c207702222222222222202222207700002222220000770000022222222220222220700000000000000000000000000000000
|
||||||
00000000700c0c0c0c0c00c0c0c0c007700000000000000000000007700000000c00000700000000000000000000000000000000000000000000000000000000
|
00000000702c2c2c2c2c22c2c2c2c207700000000000000000000007700002222c20000770000000000000000000000700000000000000000000000000000000
|
||||||
00000000700c0c0c0c0c00cc00ccc007700000000000000000000007700000cccc00000700000000000000000000000000000000000000000000000000000000
|
00000000702c2c2c2c2c22cc22ccc207700000000000000000000007700002cccc20000770000000000000000000000700000000000000000000000000000000
|
||||||
00000000700ccc00c00cc0c000c0c007700000000000000000000007700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000702ccc22c22cc2c222c2c207700000000000000000000007700002222220000770000000000000000000000700000000000000000000000000000000
|
||||||
000000007000000000000000000000077000000000000000000000077000000cc000000700000000000000000000000000000000000000000000000000000000
|
000000007022222222222222022222077000000000000000000000077000022cc220000770000000000000000000000700000000000000000000000000000000
|
||||||
00000000700000000000000000000007777777777777777777777777700000c00c00000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007777777777777777777777777700002c22c20000777777777777777777777777700000000000000000000000000000000
|
||||||
000000007000000000000000000000070000000000000000000000007000000cc000000700000000000000000000000000000000000000000000000000000000
|
000000007000000000000000000000077777777777777777777777777000022cc220000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000700000000000000000000007000000000000000000000000700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007700000000000000000000007700000222220000700000000000000000000000000000000000000000000000000000000
|
||||||
000000007000000000000000000000070000000000000000000000007000000ccc00000700000000000000000000000000000000000000000000000000000000
|
000000007000000000000000000000077000000000000000000000077000022ccc20000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000700000000000000000000007000000000000000000000000700000c00c00000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007700000000000000000000007700002c22c20000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000700000000000000000000007000000000000000000000000700000cccc00000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007700000000000000000000007700002cccc20000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000700000000000000000000007000000000000000000000000700000000000000700000000000000000000000000000000000000000000000000000000
|
00000000700000000000000000000007700000022222222222222207700002222220000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000700000000000000000000007000000000000000000000000700000000000000700000000000000000000000000000000000000000000000000000000
|
0000000070000000000000000000000770222222c22c22cc22c2c207700000000000000700000000000000000000000000000000000000000000000000000000
|
||||||
00000000777777777777777777777777000000000000000000000000777777777777777700000000000000000000000000000000000000000000000000000000
|
00000000777777777777777777777777702cc22c2c2c22c2c2c2c207777777777777777700000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000702c2c2c2c2c22cc22ccc207000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000702c2c22c22cc2c222c2c207000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000702ccc222222222202222207000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000702222200000000000000007000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000700000000000000000000007000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000700000000000000000000007000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000700000000000000000000007000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000777777777777777777777777000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user