From 9db6c1b50b3d0edb72ac8b9f1d632edb1d8da003 Mon Sep 17 00:00:00 2001 From: lockeshor Date: Thu, 8 Oct 2026 20:09:19 -0400 Subject: [PATCH] HUMAN: start actually displaying things --- main.py | 61 ++++++++++++++++++++++++++++++++++++++++----------- spec-sheet.md | 11 +++++++++- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index c3f314e..261604a 100644 --- a/main.py +++ b/main.py @@ -124,9 +124,9 @@ def onAppStart(app): app.waterColor = 'midnightBlue' app.grassColor = 'seaGreen' app.waterHeight = app.height // 3 - app.waterBottom = app.height - app.waterHeight + app.waterTop = app.height - app.waterHeight app.grassHeight = 20 - app.grassBottom = app.height - app.waterHeight - app.grassHeight + app.grassTop = app.height - app.waterHeight - app.grassHeight #GAME STATE/SETUP app.stepsPerSecond = 30 @@ -261,7 +261,7 @@ def onStep(app): #list of interactables with name and their positions #(name, sceneFilter, left, right, top, bottom) INTERACTABLES = [ - ("open-shop", "idle", 250,350,0,100) + ("open-shop", "idle", 250,350,0,100), ("close-shop", "shop", 500, 550, 50, 100) ] @@ -289,7 +289,8 @@ def onMousePress(app, mouseX, mouseY): if not interacted and app.scene == "idle": beginFishing(app) case "result": - resetFishingState() + sellCreature(app, app.hookedFish) + resetFishingState(app) case "skill-check": checkSkillHit(app) @@ -301,7 +302,10 @@ def onKeyPress(app, key): # key during development. Remove if you decide the game is mouse-only. #decidedly unused for now, i prefer mouse-only. ill keep the definition here in case i need debug tools. - pass + + # DEBUG + if key == "m": + app.save["cash"] = 1000000 def checkSkillHit(app): @@ -339,8 +343,12 @@ def sellCreature(app, creature): # money via writeSave. Decide here whether selling is automatic on catch or # a deliberate action in the shop/market. - #selling is automatic - pass + #selling will be automatic + if creature == None: return + + app.save["cash"] += creature["price"] + + writeSave(app.save) def buyUpgrade(app, upgradeId): @@ -348,7 +356,14 @@ def buyUpgrade(app, upgradeId): # already own it; if valid, deduct money, record ownership in app.save, and # persist. Upgrades modify the skill check (cursor speed, bar size/count, # extra attempts, etc.) and are read back in startSkillCheck. - pass + upgrade = [u for u in AVAILABLE_UPGRADES if u[0] == upgradeId][0] #find the specified upgrade + name, category, value, price = upgrade + + if name in app.save["owned_upgrades"]: return False + if price > app.save["cash"]: return False + + app.save["owned_upgrades"].append(name) + app.save["cash"] -= price def buyBaitLicense(app, baitId): @@ -356,14 +371,27 @@ def buyBaitLicense(app, baitId): # freely switch to that bait at no further cost (switching handled by # setActiveBait). Bait determines which creatures are reachable in # pickRandomCreature. Deduct money, record ownership, persist. - pass + bait = [b for b in AVAILABLE_BAITS if b[0] == baitId][0] #find the specified upgrade + name, max_difficulty, price = bait + + if name in app.save["owned_baits"]: return False + if price > app.save["cash"]: return False + + app.save["owned_baits"].append(name) + app.save["cash"] -= price def setActiveBait(app, baitId): # Switch the currently-equipped bait to any bait the player already owns a # license for. Free action. Updates app state so the next cast's creature # pool reflects the new bait. Reject the switch if the bait isn't owned. - pass + bait = [b for b in AVAILABLE_BAITS if b[0] == baitId][0] #find the specified upgrade + name, max_difficulty, price = bait + + if name in app.save["owned_baits"]: + app.save["current_bait"] = name + + writeSave(app.save) # ============================================================================= @@ -380,14 +408,21 @@ def redrawAll(app): # - the active skill-check overlay, or # - the catch-display popup. # Delegates each piece to the helpers below. - pass + drawBackground(app) +#REMINDERS: +# drawRect(top, left, width, height, fill="color") + def drawBackground(app): # Draw the static scene layout from the spec: grass behind, the dock, and # the lake occupying the bottom ~1/3 of the screen (blue water, optional # wave patterns). This is the backdrop present in every scene. - pass + + #water + drawRect(0, app.waterTop, app.width, app.waterHeight, fill=app.waterColor) + #grass + drawRect(0, app.grassTop, app.width, app.grassHeight, fill=app.grassColor) def drawPlayerAndRod(app): @@ -430,7 +465,7 @@ def drawHud(app): # ----------------------------------------------------------------------------- def main(): # Start the cmu_graphics app (runApp with the chosen window dimensions). - pass + runApp() main() diff --git a/spec-sheet.md b/spec-sheet.md index 7f15453..c2c7955 100644 --- a/spec-sheet.md +++ b/spec-sheet.md @@ -32,4 +32,13 @@ As previously stated, cmu_graphics should be the main backend engine, with the M - bottom 1/3 of the screen is the lake/water that you are fishing into, just blue and maybe some wave patterns or improvements - there is a dock with your character sprite sitting on the end with it's fishing rod, with the bobber going down onto the water when you fish - shop and other ui will appear as sprites standing on grass behind the dock/water area, and are clickable to interact with the shop/ui -- caught fish should have their sprite appear to come up flying out of the water, and stay on the screen while it displays the fish stats and name + description, until the user clicks it away \ No newline at end of file +- caught fish should have their sprite appear to come up flying out of the water, and stay on the screen while it displays the fish stats and name + description, until the user clicks it away + + + + + +## UI Planning + +- shop menu includes purchases at the top in 3 columns for each type, with the bait selector / purchaser at the bottom +- idle screen has fisherman on dock on left, water in bottom middle, shop guy in top middle, cash and current bait in top right \ No newline at end of file