push salesman png
This commit is contained in:
@@ -15,6 +15,10 @@ import random
|
||||
import math
|
||||
import os
|
||||
|
||||
#debug vars to store mouse pos
|
||||
gmouseX = 0
|
||||
gmouseY = 0
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# SECTION 1: DATA LOADING / FILE I/O
|
||||
@@ -225,7 +229,7 @@ def startSkillCheck(app, creature):
|
||||
|
||||
def beginFishing(app):
|
||||
app.fishingTimer = random.random() * app.stepsPerSecond * 25 + 5 # completely random between 5 and 30
|
||||
app.state = "waiting-for-bite"
|
||||
app.scene = "waiting-for-bite"
|
||||
|
||||
|
||||
|
||||
@@ -254,8 +258,8 @@ def onStep(app):
|
||||
app.hookedFish = selectedCreature
|
||||
startSkillCheck(app, selectedCreature)
|
||||
case "skill-check":
|
||||
app.skillCheckAngle += app.skillCheckSpeed
|
||||
if (skillCheckAngle > 360):
|
||||
app.skillCheckAngle += app.skillCheckSpeed / 5 #this was far too fast
|
||||
if (app.skillCheckAngle > 360):
|
||||
finishSkillCheck(app)
|
||||
|
||||
|
||||
@@ -278,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, buttom in INTERACTABLES:
|
||||
for name, sceneFilter, left, right, top, bottom in INTERACTABLES:
|
||||
if left < mouseX < right and top < mouseY < bottom \
|
||||
and sceneFilter == app.scene:
|
||||
interacted = True
|
||||
@@ -294,6 +298,8 @@ def onMousePress(app, mouseX, mouseY):
|
||||
resetFishingState(app)
|
||||
case "skill-check":
|
||||
checkSkillHit(app)
|
||||
case "waiting-for-bite":
|
||||
resetFishingState(app)
|
||||
|
||||
|
||||
|
||||
@@ -315,6 +321,10 @@ def onKeyPress(app, key):
|
||||
if key == 'd':
|
||||
print("breakpoint here")
|
||||
|
||||
def onMouseMove(app, mouseX, mouseY):
|
||||
global gmouseX, gmouseY
|
||||
gmouseX, gmouseY = mouseX, mouseY
|
||||
|
||||
|
||||
def checkSkillHit(app):
|
||||
# Evaluate a skill-check click: is the cursor's current angle inside one of
|
||||
@@ -417,11 +427,15 @@ def redrawAll(app):
|
||||
# - the catch-display popup.
|
||||
# Delegates each piece to the helpers below.
|
||||
drawBackground(app)
|
||||
if app.scene == "waiting-for-bite": drawBobber(app)
|
||||
|
||||
|
||||
drawDebug(app)
|
||||
|
||||
|
||||
#REMINDERS:
|
||||
# drawRect(top, left, width, height, fill="color")
|
||||
|
||||
# drawImage(url, )
|
||||
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
|
||||
@@ -440,15 +454,23 @@ def drawBackground(app):
|
||||
drawRect(140, app.grassTop - 10, 20, app.height, fill = dockLegColor)
|
||||
|
||||
#image cred: https://pngtree.com/freepng/cartoon-style-illustration-of-a-young-sleeping-men-fishing-on-a-wood-chair_15775817.html
|
||||
#fisherman
|
||||
drawImage("https://gitea.lockeshor.com/lockeshor/15112-fishing-miniproject/raw/branch/main/sprites/fisherman.png",
|
||||
60, app.grassTop - 50 - 140, width=140, height=170)
|
||||
|
||||
drawImage()
|
||||
#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)
|
||||
|
||||
|
||||
def drawPlayerAndRod(app):
|
||||
def drawBobber(app):
|
||||
# Draw the character sprite seated at the end of the dock with the fishing
|
||||
# rod. When a cast is active, draw the line and the bobber dropping onto the
|
||||
# water surface. Reflects the current fishing phase visually.
|
||||
pass
|
||||
|
||||
#cast line
|
||||
drawLine(172, 64, 370, 280, fill="white")
|
||||
|
||||
|
||||
def drawShopEntities(app):
|
||||
@@ -478,6 +500,18 @@ def drawHud(app):
|
||||
# every scene so the player always sees their core stats.
|
||||
pass
|
||||
|
||||
def drawDebug(app):
|
||||
debugStr = f"""\
|
||||
mX: {gmouseX}, mY: {gmouseY}
|
||||
Scene: {app.scene}
|
||||
fishingTimer: {rounded(app.fishingTimer)}
|
||||
hookedFish: {app.hookedFish["name"]}
|
||||
"""
|
||||
debugLines = debugStr.splitlines()
|
||||
size = 16
|
||||
for i in range(len(debugLines)):
|
||||
drawLabel(debugLines[i], 0, app.height - 125 + size * i, fill="white", size=size, align = "left")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# SECTION 6: PROGRAM ENTRY
|
||||
|
||||
Reference in New Issue
Block a user