progress being made, commiting to save
This commit is contained in:
@@ -153,11 +153,13 @@ def resetFishingState(app):
|
|||||||
# is resolved/dismissed.
|
# is resolved/dismissed.
|
||||||
app.skillCheckAngle = 0 #measured in degrees
|
app.skillCheckAngle = 0 #measured in degrees
|
||||||
app.skillCheckSpeed = 1
|
app.skillCheckSpeed = 1
|
||||||
app.skillCheckBars = []
|
app.skillCheckBars = [] # list of tuples of form (position, length)
|
||||||
app.skillCheckFailed = False
|
app.skillCheckFailed = False
|
||||||
|
|
||||||
app.hookedFish = None
|
app.hookedFish = None
|
||||||
app.fishingTimer = 0
|
app.fishingTimer = 0
|
||||||
|
|
||||||
|
app.scene = "idle"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -221,7 +223,8 @@ def startSkillCheck(app, creature):
|
|||||||
#speed is set, bars are set, scene is good, should be fine?
|
#speed is set, bars are set, scene is good, should be fine?
|
||||||
|
|
||||||
def beginFishing(app):
|
def beginFishing(app):
|
||||||
pass
|
app.fishingTimer = random.random() * app.stepsPerSecond * 25 + 5 # completely random between 5 and 30
|
||||||
|
app.state = "waiting-for-bite"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -246,15 +249,20 @@ def onStep(app):
|
|||||||
case "waiting-for-bite":
|
case "waiting-for-bite":
|
||||||
app.fishingTimer -= 1
|
app.fishingTimer -= 1
|
||||||
if app.fishingTimer < 1:
|
if app.fishingTimer < 1:
|
||||||
startSkillCheck(app, pickRandomCreature(app))
|
selectedCreature = pickRandomCreature(app)
|
||||||
|
app.hookedFish = selectedCreature
|
||||||
|
startSkillCheck(app, selectedCreature)
|
||||||
case "skill-check":
|
case "skill-check":
|
||||||
app.skillCheckAngle += app.skillCheckSpeed
|
app.skillCheckAngle += app.skillCheckSpeed
|
||||||
|
if (skillCheckAngle > 360):
|
||||||
|
finishSkillCheck(app)
|
||||||
|
|
||||||
|
|
||||||
#list of interactables with name and their positions
|
#list of interactables with name and their positions
|
||||||
#(name, left, right, top, bottom)
|
#(name, sceneFilter, left, right, top, bottom)
|
||||||
INTERACTABLES = [
|
INTERACTABLES = [
|
||||||
("")
|
("open-shop", "idle", 250,350,0,100)
|
||||||
|
("close-shop", "shop", 500, 550, 50, 100)
|
||||||
]
|
]
|
||||||
|
|
||||||
def onMousePress(app, mouseX, mouseY):
|
def onMousePress(app, mouseX, mouseY):
|
||||||
@@ -266,18 +274,24 @@ def onMousePress(app, mouseX, mouseY):
|
|||||||
# - shop / UI sprites clicked: open the shop or trigger that UI action.
|
# - shop / UI sprites clicked: open the shop or trigger that UI action.
|
||||||
# Keep this as dispatch only - defer the real work to helper functions.
|
# Keep this as dispatch only - defer the real work to helper functions.
|
||||||
match app.scene:
|
match app.scene:
|
||||||
case "idle":
|
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, left, right, top, buttom in INTERACTABLES:
|
for name, sceneFilter, left, right, top, buttom in INTERACTABLES:
|
||||||
if left < mouseX < right and top < mouseY < bottom:
|
if left < mouseX < right and top < mouseY < bottom \
|
||||||
|
and sceneFilter == app.scene:
|
||||||
interacted = True
|
interacted = True
|
||||||
match name:
|
match name:
|
||||||
case "shop":
|
case "open-shop":
|
||||||
#... do something
|
app.scene = "shop"
|
||||||
pass
|
case "close-shop":
|
||||||
if not interacted:
|
app.scene = "idle"
|
||||||
|
if not interacted and app.scene == "idle":
|
||||||
beginFishing(app)
|
beginFishing(app)
|
||||||
|
case "result":
|
||||||
|
resetFishingState()
|
||||||
|
case "skill-check":
|
||||||
|
checkSkillHit(app)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -285,6 +299,8 @@ def onKeyPress(app, key):
|
|||||||
# Optional keyboard controls. Candidates: a key to cast/reel as an
|
# Optional keyboard controls. Candidates: a key to cast/reel as an
|
||||||
# alternative to clicking, a key to open/close the shop, or a debug/reset
|
# alternative to clicking, a key to open/close the shop, or a debug/reset
|
||||||
# key during development. Remove if you decide the game is mouse-only.
|
# key during development. Remove if you decide the game is mouse-only.
|
||||||
|
|
||||||
|
#decidedly unused for now, i prefer mouse-only. ill keep the definition here in case i need debug tools.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +311,19 @@ def checkSkillHit(app):
|
|||||||
# advance or fail the skill check accordingly. On full success, mark the
|
# advance or fail the skill check accordingly. On full success, mark the
|
||||||
# creature as caught and move to the catch-display phase; on failure, end
|
# creature as caught and move to the catch-display phase; on failure, end
|
||||||
# the cast without a catch.
|
# the cast without a catch.
|
||||||
pass
|
targetPos, targetLen = app.skillCheckBars.pop(0)
|
||||||
|
if not ( 0 < (app.skillCheckAngle - targetPos) < targetLen): #check if we hit a bar
|
||||||
|
#if we succeed, nothing needs to happen, we popped the bar
|
||||||
|
#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"
|
||||||
|
|
||||||
|
|
||||||
|
def finishSkillCheck(app):
|
||||||
|
if len(app.skillCheckBars) > 0:
|
||||||
|
app.hookedFish = None #meaning we failed
|
||||||
|
app.scene = "result"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -310,6 +338,8 @@ def sellCreature(app, creature):
|
|||||||
# difficulty (harder creatures pay more, per the spec). Persist the updated
|
# difficulty (harder creatures pay more, per the spec). Persist the updated
|
||||||
# money via writeSave. Decide here whether selling is automatic on catch or
|
# money via writeSave. Decide here whether selling is automatic on catch or
|
||||||
# a deliberate action in the shop/market.
|
# a deliberate action in the shop/market.
|
||||||
|
|
||||||
|
#selling is automatic
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,3 +49,11 @@ End Time: 1:20am
|
|||||||
Duration: 40 minutes
|
Duration: 40 minutes
|
||||||
Description: finish up (mostly) basic functions and move onto controller, work out a bunch of finer logic and complex math
|
Description: finish up (mostly) basic functions and move onto controller, work out a bunch of finer logic and complex math
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
###############################################
|
||||||
|
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
|
||||||
|
###############################################
|
||||||
|
|||||||
Reference in New Issue
Block a user