Skip to content

Commit

Permalink
Small fixes, new sfx, and music v1
Browse files Browse the repository at this point in the history
Fixes:
- trader background
- no bites from legendary fish unless super rod

Sound:
- golden anchovy victory sfx
- ocean sound effect (playing constantly)
- basic music
- menu item to toggle music
  • Loading branch information
camirmas committed Aug 30, 2023
1 parent 692f6f7 commit 49c90ac
Showing 1 changed file with 66 additions and 32 deletions.
98 changes: 66 additions & 32 deletions projects/jam.p8
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ pico-8 cartridge // http://www.pico-8.com
version 41
__lua__

-- SEEK THE GOLDEN ANCHOVY!
-- BY OUTOFSAMPLE

-- CONSTANTS

debug = ""
debug_hitbox = false

k_left=0
Expand Down Expand Up @@ -37,6 +39,19 @@ waves = {}
objects = {}
boat_particles = {}

play_music = true

menuitem(1, "toggle music",
function()
play_music = not play_music
if play_music then
music(0)
else
music(-1)
end
end
)

-- OBJECT DEFINITIONS

item_types = {
Expand Down Expand Up @@ -287,12 +302,6 @@ function draw_item(item, x, y)
palt(item.t_col or 0, false)
end

function draw_junk(junk, x, y)
palt(junk.t_col, true)
spr(junk.k, x + junk.off.x, y + junk.off.y, junk.dim, junk.dim)
palt(junk.t_col, false)
end

function get_region(x, y)
-- Define the quadrant boundaries
local half_width = 128 * 8 / 2
Expand Down Expand Up @@ -349,7 +358,9 @@ function create_trader()
hitbox = {x = 0, y = 0, w = 16, h = 12},

draw = function(self)
palt(0, true)
spr(9, self.x, self.y, 2, 2)
palt(0, false)

palt(0, false)
palt(11, true)
Expand Down Expand Up @@ -641,6 +652,8 @@ function create_fishing_spot(x, y, is_junk, is_legendary)
hook = nil,

set_hook = function(self, hook)
-- no legendaries unless super rod in inventory
if (self.is_legendary and player.backpack.items.super_rod.quantity == 0) return
self.bite = false
if (hook ~= nil) self.hook = hook
self.time_to_bite = mid(1*30, rnd(time_to_bite_max), self.t)
Expand All @@ -657,6 +670,7 @@ function create_fishing_spot(x, y, is_junk, is_legendary)
if self.is_legendary then
if dt < .34 and player.backpack.items.super_rod.quantity > 0 then
self.to_delete = true
sfx(7)
catch = fish.gold_anchovy
else
-- missed
Expand Down Expand Up @@ -1196,7 +1210,7 @@ function create_player(x, y)

-- draw fishing bite alert
if self.hook ~= nil and self.hook.spot ~= nil and self.hook.spot.bite then
spr(k_alert, p.x + 2, p.y - 6)
spr(k_alert, p.x + 2, p.y - 7)
-- draw fish/junk caught
elseif self.info_caught ~= nil and self.info_timer > 0 then
-- fish are 2x2
Expand Down Expand Up @@ -1461,7 +1475,7 @@ function create_trade_ui(trade_item, qty)
for name, qty in pairs(self.item.junk) do
local p_qty = player.backpack.junk[name].quantity
local j = junk[name]
draw_junk(j, cx, cy)
draw_item(j, cx, cy)
print(j.disp_name .. " X " .. p_qty .. "/" .. qty, cx + 20, cy + 2, 0)
cy += 14
end
Expand Down Expand Up @@ -1635,7 +1649,7 @@ function create_craft_ui()
for name, qty in pairs(self.item.junk) do
local p_qty = player.backpack.junk[name].quantity
local j = junk[name]
draw_junk(j, cx, cy)
draw_item(j, cx, cy)
print((j.disp_name or j.name) .. " X " .. p_qty .. "/" .. qty, cx + 22, cy + 2, 0)
cy += 14
end
Expand Down Expand Up @@ -1860,7 +1874,7 @@ function create_backpack_ui()
cy += 18
elseif item.type == item_types.junk then
print((item.disp_name or item.name) .. " X " .. qty, cx + 18, cy + 2, 0)
draw_junk(item, cx, cy)
draw_item(item, cx, cy)
cy += 16
end
end
Expand Down Expand Up @@ -1919,13 +1933,15 @@ function load_map()
end

function _init()
-- set ocean sound
sfx(10, 3)
start_screen = create_start_screen()
states:update_state(states.start)
load_map()
-- music(0)
end

function start_game()
music(0)
states:update_state(states.game)
cam = {x=0, y=0}
trader = create_trader()
Expand All @@ -1950,14 +1966,15 @@ function start_game()
backpack = backpack_ui
}

-- player.backpack:add(items.super_rod, 1)
-- for _, f in pairs(fish) do
-- player.backpack:add(f, 10)
-- end
-- for _, j in pairs(junk) do
-- player.backpack:add(j, 10)
-- player.backpack:add(f, 3)
-- end
-- for _, i in pairs(items) do
-- player.backpack:add(i, 10)
-- -- for _, j in pairs(junk) do
-- -- player.backpack:add(j, 10)
-- -- end
-- -- for _, i in pairs(items) do
-- -- player.backpack:add(i, 1)
-- end

-- add legendary fishing spots
Expand Down Expand Up @@ -2016,7 +2033,6 @@ function create_start_screen()
print("nori", flr((128-3*4)/2), 5*8, 6)

local msg = "start: ❎"
print(debug, 10, 50)
print(msg, (128-#msg*4)/2, 12*8, 6)
end,

Expand All @@ -2031,6 +2047,8 @@ states = {
start = {
_update = function()
if (btnp(k_X)) then
-- clear ocean sound
-- sfx(-1)
start_game()
else
start_screen:update()
Expand Down Expand Up @@ -2155,7 +2173,7 @@ states = {
menu_states[menu_state]:draw()
end

print(debug, 10, 10)
-- print(debug, 10, 10)

camera(cam.x, cam.y)

Expand Down Expand Up @@ -2223,13 +2241,13 @@ cc44a4cccccccccce8d2e82edee8edeec66666666666666c9ff3bbffddd2d29ddd2ddd2d00000000
ccc4a4ccccccccccde2ee2dededd8ed8ccccccccccccccccf4ff3f4fdded9ddded9d9edd00000000000000000000000000000000000000000000000000000000
cccc4cccccccccccdede8dedd8edd8edccccccccccccccccffff3fffddd2ddddd2d2dddd00000000000000000000000000000000000000000000000000000000
cccccccccccccccc8dde8dedddedddedccccccccccccccccffffff9fddd9ddddddd9dddd00000000000000000000000000000000000000000000000000000000
ccccccccccccccccccccccccccccccccccccccccf9fff4ffff4fff9f000000000000000000000000000000000000000000000000000000000000000000000000
cccccccccc555ccccccccccccccccccccc6666ccffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000
ccccccccccccccccccccccccccccccccccccccccfffff4ffff4fff9f000000000000000000000000000000000000000000000000000000000000000000000000
cccccccccc555ccccccccccccccccccccc6666ccf4ffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000
ccccccccc5d675cccc22222cccccccccc400004cfffffffffffffffc000000000000000000000000000000000000000000000000000000000000000000000000
ccccccc65d6075ccc2ddddd2cccccccccf4aa4fcff4ffff99ffff4fc000d90000000000000000000000000000000000000000000000000000000000000000000
cccccc65d66675ccc20dd0d2ccccccccc449944c9fffffffffffffcc00d039000000000000000000000000000000000000000000000000000000000000000000
cccccc5d66d75cccc2ddddd2ccccccccc444444cf4ff9f4ff4f9ffcc00d003900000000000000000000000000000000000000000000000000000000000000000
ccccc5d66675ccccc00d00062ccccccccffffffcffffffffffffcccc000d00390000000000000000000000000000000000000000000000000000000000000000
ccccccc65d6075ccc2ddddd2cccccccccf4aa4fcff9fff9f9ffff4fc000d90000000000000000000000000000000000000000000000000000000000000000000
cccccc65d66675ccc20dd0d2ccccccccc449944cffff4fffffffffcc00d039000000000000000000000000000000000000000000000000000000000000000000
cccccc5d66d75cccc2ddddd2ccccccccc444444cfffffffff4f9ffcc00d003900000000000000000000000000000000000000000000000000000000000000000
ccccc5d66675ccccc00d00062ccccccccffffffcf4ffffffffffcccc000d00390000000000000000000000000000000000000000000000000000000000000000
ccccc5d6d765cccccc2ddddd622cc2ccccccccccffffff9fffcccccc0000d0039000000000000000000000000000000000000000000000000000000000000000
cccc5d66755ccccccc2ddd2dd662222cfcccccccff9fff4fcccccccf0000d0039000000000000000000000000000000000000000000000000000000000000000
cccc56675ccccccccc25dd22ddd66222fffccccccfffffffcccccfff000d00003900000000000000000000000000000000000000000000000000000000000000
Expand Down Expand Up @@ -2340,14 +2358,30 @@ __map__
0101010101010101010101010101010101010101010101010101011301010101010101010101010101240101010101010101010124010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101017566010101010101010101010175655665656601010101010101010101
0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
__sfx__
0012000000053000030000300053246153a6050005300003000530005300003000532461500003000530005300053000530000300053246150005300003000530005300053000030005324615000030005300053
011200000004500025000150001510045100351003510025100251002510015100150000500005150451501500045000250001500025100451003510035100251002510015100151001500005000050000500005
711200000000500005000150002500015000251001510025100151002510015100251001510025000050000515015150250001500025000150002510015100251001510025100151002510015100250000500000
49120000000533f200000033f400246153f2003f2003f400000533f4003f30000000246153f2000000000000000533f3003f2003f200246153f300000033f400000533f200000033f400246153f300000003f200
49120000070420702207022070220b0420b0220704207022070220702207042070220b0420b0220704207022070420702207022070220b0420b0220704207022070220702207042070220b0420b0220704207022
491200000504205022050220502209042090220504205022050220502205042050220904209022050420502205042050220502205022090420902205042050220502205022050420502209042090220504205022
49010000057550a7550c7550f7551375516755187551d7551f70500705267052e7053570500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005
490300001044514445184251d42521425134051140510405104050d4050c405004050040500405004050040500405004050040500405004050040500405004050040500405004050040500405004050040500405
480300001044514445184251d42521425134051140510405104050d4050c405004050040500405004050040500405004050040500405004050040500405004050040500405004050040500405004050040500405
4b0400002d61032610386103b6103e6102160021600216003c6003c6003c6003c6003c6003b600006000060000600006000060000600006000060000600006000060000600006000060000600006000060000600
00020000090210a0210d0210f02111021140211802100001000010000100001000010000100001000010000100001000010000100001000010000100001000010000100001000010000100001000010000100001
4a0200000161003610066100d610166101d61023610296102f61033610376102f6003460036600006000060000600006000060000600006000060000600006000060000600006000060000600006000060000600
03080000110501505011050150501a0501c0501d0501f050230501f0502405016000160001b0001f000270002e00035000290002e000330003700037000340003600000000000000000000000000000000000000
691200001f0351f015210352101523035230151f0351f01521035210151d0351d015240351d015230352301523015000050000500005000050000500005000050000500005000050000500005000050000500005
691200001f0351f015210352101523035230151f0351f01521035210151d0351d015180351d0151f0351f0151f0151f0001f00000005000050000500005000050000500005000050000500005000050000500005
481800200261202612046120561205612046120261200612006120161203612096120761205612046120361201612016120261205612086120661205612036120361203612066120c61209612076120361200612
__music__
03 00010244
01 40014844
00 40014944
01 40024844
01 00024844
00 00014344
00 00014344
00 00024344
00 00024344
01 00010844
00 00010844
00 00010844
00 00020944
00 00010844
02 00020944

0 comments on commit 49c90ac

Please sign in to comment.