Add sounds
This commit is contained in:
parent
bb2cfdd6af
commit
4747e297b4
@ -93,8 +93,10 @@ function board:get_completion_level()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function board:undo()
|
function board:undo()
|
||||||
if (not self.watcher:intercept("undo")) return
|
if (not self.checkpoint) return
|
||||||
if (self.checkpoint) self.checkpoint:apply(self)
|
if (not self.watcher:intercept("undo")) sounds:dire() return
|
||||||
|
sounds:menu()
|
||||||
|
self.checkpoint:apply(self)
|
||||||
self.checkpoint=nil
|
self.checkpoint=nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ function board:_animate_move_card(card,on_end,start_x,start_y,compute_end)
|
|||||||
if (frame==0) end_x,end_y=compute_end()
|
if (frame==0) end_x,end_y=compute_end()
|
||||||
frame+=1
|
frame+=1
|
||||||
progress=frame/7
|
progress=frame/7
|
||||||
if (progress>=1.0) on_end() return false
|
if (progress>=1.0) sounds:deal_card() on_end() return false
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
function anim_obj:draw()
|
function anim_obj:draw()
|
||||||
|
@ -36,18 +36,21 @@ function cursor:toggle_grab()
|
|||||||
local acc,src,tar=self:acceptance_state()
|
local acc,src,tar=self:acceptance_state()
|
||||||
local slot=self:hover_slot()
|
local slot=self:hover_slot()
|
||||||
if acc==acceptance_state.not_grabbed then
|
if acc==acceptance_state.not_grabbed then
|
||||||
if (not self.board.watcher:intercept("grab",slot)) return
|
if (not self.board.watcher:intercept("grab",slot)) sounds:dire() return
|
||||||
if (self.board.slots[slot]:peek()) self.grabbed=slot
|
if (self.board.slots[slot]:peek()) self.grabbed=slot
|
||||||
|
sounds:menu()
|
||||||
elseif acc==acceptance_state.would_accept then
|
elseif acc==acceptance_state.would_accept then
|
||||||
if (not self.board.watcher:intercept("drop",slot)) return
|
if (not self.board.watcher:intercept("drop",slot)) sounds:dire() return
|
||||||
self.board:pre_move(src:peek())
|
self.board:pre_move(src:peek())
|
||||||
local card=src:pop()
|
local card=src:pop()
|
||||||
tar:add(card)
|
tar:add(card)
|
||||||
self.grabbed=nil
|
self.grabbed=nil
|
||||||
self.board:on_move(card)
|
self.board:on_move(card)
|
||||||
|
sounds:menu()
|
||||||
elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then
|
elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then
|
||||||
if (not self.board.watcher:intercept("cancel")) return
|
if (not self.board.watcher:intercept("cancel")) sounds:dire() return
|
||||||
self.grabbed=nil
|
self.grabbed=nil
|
||||||
|
sounds:menu()
|
||||||
else
|
else
|
||||||
assert(false,"invalid acceptance state")
|
assert(false,"invalid acceptance state")
|
||||||
end
|
end
|
||||||
|
38
main.p8
38
main.p8
@ -20,6 +20,7 @@ __lua__
|
|||||||
#include progression.lua
|
#include progression.lua
|
||||||
#include seed_constants.lua
|
#include seed_constants.lua
|
||||||
#include seeds.lua
|
#include seeds.lua
|
||||||
|
#include sounds.lua
|
||||||
#include state_archaeology.lua
|
#include state_archaeology.lua
|
||||||
#include state_excavate_menu.lua
|
#include state_excavate_menu.lua
|
||||||
#include state_manager.lua
|
#include state_manager.lua
|
||||||
@ -230,6 +231,43 @@ __sfx__
|
|||||||
a51300003051030510305103051030510305103051030510305103051030510305103051030510305103051524500245002450024500245002450024500245002450024500245002450024500245002450024500
|
a51300003051030510305103051030510305103051030510305103051030510305103051030510305103051524500245002450024500245002450024500245002450024500245002450024500245002450024500
|
||||||
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
930a00003766437625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
954a00002b66518000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
010400000c25512255232550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0108000013335113000c3000c3050c305000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
__music__
|
__music__
|
||||||
01 00551544
|
01 00551544
|
||||||
00 01551544
|
00 01551544
|
||||||
|
13
sounds.lua
Normal file
13
sounds.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
sounds={}
|
||||||
|
function sounds:menu()
|
||||||
|
sfx(63,3)
|
||||||
|
end
|
||||||
|
function sounds:deal_card()
|
||||||
|
sfx(60,3)
|
||||||
|
end
|
||||||
|
function sounds:dire()
|
||||||
|
sfx(62,3)
|
||||||
|
end
|
||||||
|
function sounds:win()
|
||||||
|
sfx(61,3)
|
||||||
|
end
|
@ -43,8 +43,8 @@ function state_archaeology:update()
|
|||||||
local vel=0
|
local vel=0
|
||||||
if (btnp(0)) vel-=1
|
if (btnp(0)) vel-=1
|
||||||
if (btnp(1)) vel+=1
|
if (btnp(1)) vel+=1
|
||||||
if (btnp(5)) self.done=true
|
if (btnp(5)) sounds:menu() self.done=true
|
||||||
if (vel!=0) self:select_book((self.selection+vel-1)%self.n_holy_books+1)
|
if (vel!=0) sounds:menu() self:select_book((self.selection+vel-1)%self.n_holy_books+1)
|
||||||
end
|
end
|
||||||
function state_archaeology:draw()
|
function state_archaeology:draw()
|
||||||
local fullw,fullh=measure_text(self.full_text)
|
local fullw,fullh=measure_text(self.full_text)
|
||||||
|
@ -35,7 +35,7 @@ end
|
|||||||
function state_menu:update()
|
function state_menu:update()
|
||||||
self.frame+=1
|
self.frame+=1
|
||||||
self.frame%=1024
|
self.frame%=1024
|
||||||
if (btnp(1) or btnp(4)) self.options[self.selection]:cb()
|
if (btnp(1) or btnp(4)) sounds:menu() self.options[self.selection]:cb()
|
||||||
|
|
||||||
local vel=0
|
local vel=0
|
||||||
if (btnp(2)) vel-=1
|
if (btnp(2)) vel-=1
|
||||||
|
@ -23,6 +23,7 @@ function state_reset_menu:update()
|
|||||||
run()
|
run()
|
||||||
end
|
end
|
||||||
if self.code[self.code_i]==o then
|
if self.code[self.code_i]==o then
|
||||||
|
sounds:dire()
|
||||||
self.code_i+=1
|
self.code_i+=1
|
||||||
if (self.code_i>#self.code) completion_tracker:reset()
|
if (self.code_i>#self.code) completion_tracker:reset()
|
||||||
else
|
else
|
||||||
|
@ -2,6 +2,7 @@ state_wonironman=klass()
|
|||||||
function state_wonironman:init()
|
function state_wonironman:init()
|
||||||
end
|
end
|
||||||
function state_wonironman:enter()
|
function state_wonironman:enter()
|
||||||
|
sounds:win()
|
||||||
completion_tracker:incr_metascore()
|
completion_tracker:incr_metascore()
|
||||||
end
|
end
|
||||||
function state_wonironman:exit(new_top) end
|
function state_wonironman:exit(new_top) end
|
||||||
@ -10,7 +11,7 @@ function state_wonironman:reenter() end
|
|||||||
function state_wonironman:suspend() end
|
function state_wonironman:suspend() end
|
||||||
|
|
||||||
function state_wonironman:update()
|
function state_wonironman:update()
|
||||||
if (btnp(4)) self.done=true
|
if (btnp(4)) sounds:menu() self.done=true
|
||||||
end
|
end
|
||||||
function state_wonironman:draw()
|
function state_wonironman:draw()
|
||||||
cls(13)
|
cls(13)
|
||||||
|
@ -9,6 +9,7 @@ function state_wonround:init(board)
|
|||||||
end
|
end
|
||||||
seen_tip_this_session=false
|
seen_tip_this_session=false
|
||||||
function state_wonround:enter()
|
function state_wonround:enter()
|
||||||
|
sounds:win()
|
||||||
completion_tracker:mark_seen(self.verse_id)
|
completion_tracker:mark_seen(self.verse_id)
|
||||||
completion_tracker:advance_completion_level(self.board:get_completion_level())
|
completion_tracker:advance_completion_level(self.board:get_completion_level())
|
||||||
self.has_tip = not seen_tip_this_session
|
self.has_tip = not seen_tip_this_session
|
||||||
@ -26,7 +27,7 @@ function state_wonround:update()
|
|||||||
self.board:set_restart_progress(self.progress)
|
self.board:set_restart_progress(self.progress)
|
||||||
|
|
||||||
if (self.progress<1.0) return
|
if (self.progress<1.0) return
|
||||||
if (btnp(4)) self.done=true
|
if (btnp(4)) sounds:menu() self.done=true
|
||||||
end
|
end
|
||||||
function state_wonround:draw()
|
function state_wonround:draw()
|
||||||
cls(13)
|
cls(13)
|
||||||
|
Loading…
Reference in New Issue
Block a user