start working on Controller phase, and pulling logic together
This commit is contained in:
@@ -185,12 +185,6 @@ def pickRandomCreature(app):
|
||||
catch = [c for c in app.creatures if c["name"] == possibleCatch[0]][0]
|
||||
return catch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def startSkillCheck(app, creature):
|
||||
@@ -226,7 +220,8 @@ def startSkillCheck(app, creature):
|
||||
|
||||
#speed is set, bars are set, scene is good, should be fine?
|
||||
|
||||
|
||||
def beginFishing(app):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -245,9 +240,23 @@ def onStep(app):
|
||||
# creature and transition into the skill check.
|
||||
# - skill-check: advance the cursor's angle around the circle each step.
|
||||
# - otherwise (idle, viewing a catch, in shop): do nothing time-based.
|
||||
pass
|
||||
|
||||
#had to look up how to do switch-case statement in python, I know it from JS though
|
||||
match app.scene:
|
||||
case "waiting-for-bite":
|
||||
app.fishingTimer -= 1
|
||||
if app.fishingTimer < 1:
|
||||
startSkillCheck(app, pickRandomCreature(app))
|
||||
case "skill-check":
|
||||
app.skillCheckAngle += app.skillCheckSpeed
|
||||
|
||||
|
||||
#list of interactables with name and their positions
|
||||
#(name, left, right, top, bottom)
|
||||
INTERACTABLES = [
|
||||
("")
|
||||
]
|
||||
|
||||
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).
|
||||
@@ -256,7 +265,20 @@ def onMousePress(app, mouseX, mouseY):
|
||||
# - catch popup showing: dismiss the popup and reset fishing.
|
||||
# - shop / UI sprites clicked: open the shop or trigger that UI action.
|
||||
# Keep this as dispatch only - defer the real work to helper functions.
|
||||
pass
|
||||
match app.scene:
|
||||
case "idle":
|
||||
interacted = False
|
||||
#check if we clicked a hud element/interactable
|
||||
for name, left, right, top, buttom in INTERACTABLES:
|
||||
if left < mouseX < right and top < mouseY < bottom:
|
||||
interacted = True
|
||||
match name:
|
||||
case "shop":
|
||||
#... do something
|
||||
pass
|
||||
if not interacted:
|
||||
beginFishing(app)
|
||||
|
||||
|
||||
|
||||
def onKeyPress(app, key):
|
||||
|
||||
Reference in New Issue
Block a user