From 1d7ca8c3af0825f7dfc13431aeeecebb65a0c45b Mon Sep 17 00:00:00 2001 From: lockeshor Date: Thu, 8 Oct 2026 21:42:50 -0400 Subject: [PATCH] HUMAN: update time, pausing for now. visuals are looking great! --- main.py | 68 +++++++++++++++++++++++++++++++++++++++++++------------ save.json | 1 + time_log | 8 +++---- 3 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 save.json diff --git a/main.py b/main.py index d657a37..8ef7f7a 100644 --- a/main.py +++ b/main.py @@ -149,6 +149,13 @@ def onAppStart(app): app.fishingTimer = 0 app.hookedFish = None + #list of interactables with name and their positions + #(name, sceneFilter, left, right, top, bottom) + app.INTERACTABLES = [ + ("open-shop", "idle", 400, 540, app.grassTop - 130, app.grassTop + 30), + ("close-shop", "shop", app.width-50, app.width, 0, 50) + ] + def resetFishingState(app): @@ -258,18 +265,11 @@ def onStep(app): app.hookedFish = selectedCreature startSkillCheck(app, selectedCreature) case "skill-check": - app.skillCheckAngle += app.skillCheckSpeed / 5 #this was far too fast + app.skillCheckAngle += app.skillCheckSpeed / 6 #this was far too fast if (app.skillCheckAngle > 360): finishSkillCheck(app) -#list of interactables with name and their positions -#(name, sceneFilter, left, right, top, bottom) -INTERACTABLES = [ - ("open-shop", "idle", 250,350,0,100), - ("close-shop", "shop", 500, 550, 50, 100) -] - def onMousePress(app, mouseX, mouseY): # Primary input router. Behavior depends on app.scene / fishing phase: # - dock idle: clicking starts a cast (begin waiting-for-bite). @@ -282,7 +282,7 @@ def onMousePress(app, mouseX, mouseY): case "idle" | "shop": #also had to look this up - pipe operator is dumb. just let me have multiple cases interacted = False #check if we clicked a hud element/interactable - for name, sceneFilter, left, right, top, bottom in INTERACTABLES: + for name, sceneFilter, left, right, top, bottom in app.INTERACTABLES: if left < mouseX < right and top < mouseY < bottom \ and sceneFilter == app.scene: interacted = True @@ -339,6 +339,7 @@ def checkSkillHit(app): #if we fail, we either didnt hit or missed a past bar, either way we can jump straight to the fail screen app.hookedFish = None app.scene = "result" + print("failed",targetPos,targetLen,app.skillCheckAngle) def finishSkillCheck(app): @@ -427,7 +428,12 @@ def redrawAll(app): # - the catch-display popup. # Delegates each piece to the helpers below. drawBackground(app) - if app.scene == "waiting-for-bite": drawBobber(app) + if app.scene == "waiting-for-bite": + drawBobber(app) + if app.scene == "shop": + drawShopEntities(app) + if app.scene == "skill-check": + drawSkillCheck(app) drawDebug(app) @@ -461,7 +467,10 @@ def drawBackground(app): #image cred: https://www.artstation.com/artwork/xzLbe2 #salesman drawImage("https://gitea.lockeshor.com/lockeshor/15112-fishing-miniproject/raw/branch/main/sprites/salesman.png", - 300, app.grassTop - 140, width = 70, height= 140) + 400, app.grassTop - 130, width = 140, height= 160) + + #cash + drawLabel(f"${app.save["cash"]}",app.width - 5,5,align="right-top",size=26,fill='darkgoldenrod',font='orbitron') def drawBobber(app): @@ -472,19 +481,50 @@ def drawBobber(app): #cast line drawLine(172, 64, 370, 280, fill="white") + #bobber? + def drawShopEntities(app): # Draw the clickable shop/UI sprites standing on the grass (per the spec). # Positions here must line up with the hit-testing done in onMousePress so # clicks land on the right entity. - pass + + #dimming + drawRect(0,0,app.width,app.height,opacity=50) + #menu background + drawRect(50,50,app.width-100,app.height-100,fill='bisque',border='lightCoral',borderWidth=5) + #exit "X" + drawLine(app.width-45, 5, app.width-5, 45, fill='red', lineWidth=5) + drawLine(app.width-5, 5, app.width-45, 45, fill='red', lineWidth=5) def drawSkillCheck(app): # Draw the active skill-check overlay: the circle, the target bars placed # around it (count/length from difficulty), and the rotating cursor at its # current angle. Optionally show which bars are already cleared. Read-only. - pass + + #IMPORTANT: circle is like unit circle for drawing, but we want it to have 0 at the top. transformations will be needed + + #radius of circle + r = 90 + + #basic path + #REMINDER: cx, cy, r + drawCircle(300, 130, r, fill=None,border='dimGray') + + #bars + for barPos, barLen in app.skillCheckBars: + drawArc(300,130, r * 2 + 20, r * 2 + 20, -barPos + 90 - barLen, barLen, fill="white") + + #cover up center of bars + drawCircle(300, 130, r - 10, fill=app.background) + + #cursor + #REMINDER: width and height are for oval (so r * 2) + #REMINDER: cx, cy, width, height, startangle, sweepangle + drawArc(300,130, r * 2 + 20, r * 2 + 20, -app.skillCheckAngle + 90, 2, fill="red") + + def drawCatchDisplay(app): @@ -505,7 +545,7 @@ def drawDebug(app): mX: {gmouseX}, mY: {gmouseY} Scene: {app.scene} fishingTimer: {rounded(app.fishingTimer)} - hookedFish: {app.hookedFish["name"]} + hookedFish: {app.hookedFish["name"] if app.hookedFish else "N/A"} """ debugLines = debugStr.splitlines() size = 16 diff --git a/save.json b/save.json new file mode 100644 index 0000000..27cb2b3 --- /dev/null +++ b/save.json @@ -0,0 +1 @@ +{"cash": 86.0, "owned_baits": ["Worms"], "owned_upgrades": [], "current_bait": "Worms", "catch_log": []} \ No newline at end of file diff --git a/time_log b/time_log index 1eee2ee..bc85e93 100644 --- a/time_log +++ b/time_log @@ -1,5 +1,5 @@ ############################################### -Total Time: 190 minutes +Total Time: 330 minutes ############################################### ############################################### @@ -53,7 +53,7 @@ Description: finish up (mostly) basic functions and move onto controller, work o ############################################### Date: 08-Oct Start Time: 7:20pm -End Time: 1:20am -Duration: 40 minutes -Description: finish up (mostly) basic functions and move onto controller, work out a bunch of finer logic and complex math +End Time: 9:40pm +Duration: 140 minutes +Description: get a decent chunk of the visuals done and finish logic, much closer to being done ###############################################