push salesman png
This commit is contained in:
@@ -15,6 +15,10 @@ import random
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
#debug vars to store mouse pos
|
||||||
|
gmouseX = 0
|
||||||
|
gmouseY = 0
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# SECTION 1: DATA LOADING / FILE I/O
|
# SECTION 1: DATA LOADING / FILE I/O
|
||||||
@@ -225,7 +229,7 @@ def startSkillCheck(app, creature):
|
|||||||
|
|
||||||
def beginFishing(app):
|
def beginFishing(app):
|
||||||
app.fishingTimer = random.random() * app.stepsPerSecond * 25 + 5 # completely random between 5 and 30
|
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
|
app.hookedFish = selectedCreature
|
||||||
startSkillCheck(app, selectedCreature)
|
startSkillCheck(app, selectedCreature)
|
||||||
case "skill-check":
|
case "skill-check":
|
||||||
app.skillCheckAngle += app.skillCheckSpeed
|
app.skillCheckAngle += app.skillCheckSpeed / 5 #this was far too fast
|
||||||
if (skillCheckAngle > 360):
|
if (app.skillCheckAngle > 360):
|
||||||
finishSkillCheck(app)
|
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
|
case "idle" | "shop": #also had to look this up - pipe operator is dumb. just let me have multiple cases
|
||||||
interacted = False
|
interacted = False
|
||||||
#check if we clicked a hud element/interactable
|
#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 \
|
if left < mouseX < right and top < mouseY < bottom \
|
||||||
and sceneFilter == app.scene:
|
and sceneFilter == app.scene:
|
||||||
interacted = True
|
interacted = True
|
||||||
@@ -294,6 +298,8 @@ def onMousePress(app, mouseX, mouseY):
|
|||||||
resetFishingState(app)
|
resetFishingState(app)
|
||||||
case "skill-check":
|
case "skill-check":
|
||||||
checkSkillHit(app)
|
checkSkillHit(app)
|
||||||
|
case "waiting-for-bite":
|
||||||
|
resetFishingState(app)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -315,6 +321,10 @@ def onKeyPress(app, key):
|
|||||||
if key == 'd':
|
if key == 'd':
|
||||||
print("breakpoint here")
|
print("breakpoint here")
|
||||||
|
|
||||||
|
def onMouseMove(app, mouseX, mouseY):
|
||||||
|
global gmouseX, gmouseY
|
||||||
|
gmouseX, gmouseY = mouseX, mouseY
|
||||||
|
|
||||||
|
|
||||||
def checkSkillHit(app):
|
def checkSkillHit(app):
|
||||||
# Evaluate a skill-check click: is the cursor's current angle inside one of
|
# 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.
|
# - the catch-display popup.
|
||||||
# Delegates each piece to the helpers below.
|
# Delegates each piece to the helpers below.
|
||||||
drawBackground(app)
|
drawBackground(app)
|
||||||
|
if app.scene == "waiting-for-bite": drawBobber(app)
|
||||||
|
|
||||||
|
|
||||||
|
drawDebug(app)
|
||||||
|
|
||||||
|
|
||||||
#REMINDERS:
|
#REMINDERS:
|
||||||
# drawRect(top, left, width, height, fill="color")
|
# drawRect(top, left, width, height, fill="color")
|
||||||
|
# drawImage(url, )
|
||||||
def drawBackground(app):
|
def drawBackground(app):
|
||||||
# Draw the static scene layout from the spec: grass behind, the dock, and
|
# 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
|
# 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)
|
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
|
#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
|
# 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
|
# rod. When a cast is active, draw the line and the bobber dropping onto the
|
||||||
# water surface. Reflects the current fishing phase visually.
|
# water surface. Reflects the current fishing phase visually.
|
||||||
pass
|
|
||||||
|
#cast line
|
||||||
|
drawLine(172, 64, 370, 280, fill="white")
|
||||||
|
|
||||||
|
|
||||||
def drawShopEntities(app):
|
def drawShopEntities(app):
|
||||||
@@ -478,6 +500,18 @@ def drawHud(app):
|
|||||||
# every scene so the player always sees their core stats.
|
# every scene so the player always sees their core stats.
|
||||||
pass
|
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
|
# SECTION 6: PROGRAM ENTRY
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
Reference in New Issue
Block a user