From 9eaff2d837ebb4c1af00550d3caa33c72da99b0e Mon Sep 17 00:00:00 2001 From: lockeshor Date: Wed, 7 Oct 2026 00:29:07 -0400 Subject: [PATCH] define most app variables and begin working on skill check logic --- citations | 5 +++++ main.py | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/citations b/citations index 6cbe063..4ebb432 100644 --- a/citations +++ b/citations @@ -8,4 +8,9 @@ Description: The main AI agent in kiro, used for most if not all of the promptin ############################################### Source: Google Search / Google Search AI Description: Used infrequently just for general questions regarding python or graphics, no specific usage (and google search AI is just kind of always there) +############################################### + +############################################### +Source: CMU Graphics Documentation (https://academy.cs.cmu.edu/cpcs-docs) +Description: Refferred to for implementation and MVC architecture along with how to interface with graphics ############################################### \ No newline at end of file diff --git a/main.py b/main.py index a812cc8..f22e772 100644 --- a/main.py +++ b/main.py @@ -79,17 +79,52 @@ def writeSave(saveState, path="save.json"): # No drawing and no event handling here - just state. # ============================================================================= +AVAILABLE_UPGRADES = [ # (name, bonus_type, bonus_modifier, price) + #power mods + ("Smart Rod", "power", 2, 100), + ("Clever Rod", "power", 7, 350), + ("Intelligent Rod", "power", 10, 1500), + ("Genius Rod", "power", 20, 20000) +] + def onAppStart(app): # cmu_graphics entry point. Initialize ALL app.* state here: # - window/layout constants (width, height, dock/water/grass regions) # - app.creatures (from loadCreatures) # - app.save (from loadSave) and derived player values - # - app.scene (which screen is active: 'dock', 'shop', 'catch', ...) # - fishing state (idle / waiting-for-bite / skill-check / result) # - skill-check state placeholders (cursor angle, bars, speed, result) # - app.stepsPerSecond for the game loop cadence # Delegates to the smaller setup helpers below to keep this readable. - pass + + #DRAWING CONSTANTS + app.width = 600 + app.height = 400 + app.background = 'lightSkyBlue' + app.waterColor = 'midnightBlue' + app.grassColor = 'seaGreen' + app.waterHeight = app.height // 3 + app.waterBottom = app.height = app.waterHeight + app.grassHeight = 20 + app.grassBottom = app.height - app.waterHeight - app.grassHeight + + #GAME STATE/SETUP + app.stepsPerSecond = 30 + app.creatures = loadCreatures() + app.save = loadSave() + app.scene = "idle" # idle, waiting-for-bite, skill-check, result, shopping, menu + + #SKILL CHECK + app.skillCheckAngle = 0 + app.skillCheckSpeed = 1 + app.skillCheckBars = [] + app.skillCheckSpeed = 1 + app.skillCheckFailed = False + + #FISHING + app.fishingTimer = 0 + app.hookedFish = None + def resetFishingState(app): @@ -115,6 +150,12 @@ def startSkillCheck(app, creature): # bar length/width. Also apply any owned upgrades that modify these values # (e.g. slower cursor, wider bars, extra forgiveness). Stores the resulting # parameters on app for the controller/view to use. + app.scene = "skill-check" + difficulty = creature["difficulty"] + + fishingPower = 1 + sum(upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "power")) + + app.skillCheckSpeed = difficulty / fishingPower pass