HUMAN: update time, pausing for now. visuals are looking great!
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user