define most app variables and begin working on skill check logic
This commit is contained in:
@@ -9,3 +9,8 @@ Description: The main AI agent in kiro, used for most if not all of the promptin
|
||||
Source: Google Search / Google Search AI
|
||||
Description: Used infrequently just for general questions regarding python or graphics, no specific usage (and google search AI is just kind of always there)
|
||||
###############################################
|
||||
|
||||
###############################################
|
||||
Source: CMU Graphics Documentation (https://academy.cs.cmu.edu/cpcs-docs)
|
||||
Description: Refferred to for implementation and MVC architecture along with how to interface with graphics
|
||||
###############################################
|
||||
@@ -79,17 +79,52 @@ def writeSave(saveState, path="save.json"):
|
||||
# No drawing and no event handling here - just state.
|
||||
# =============================================================================
|
||||
|
||||
AVAILABLE_UPGRADES = [ # (name, bonus_type, bonus_modifier, price)
|
||||
#power mods
|
||||
("Smart Rod", "power", 2, 100),
|
||||
("Clever Rod", "power", 7, 350),
|
||||
("Intelligent Rod", "power", 10, 1500),
|
||||
("Genius Rod", "power", 20, 20000)
|
||||
]
|
||||
|
||||
def onAppStart(app):
|
||||
# cmu_graphics entry point. Initialize ALL app.* state here:
|
||||
# - window/layout constants (width, height, dock/water/grass regions)
|
||||
# - app.creatures (from loadCreatures)
|
||||
# - app.save (from loadSave) and derived player values
|
||||
# - app.scene (which screen is active: 'dock', 'shop', 'catch', ...)
|
||||
# - fishing state (idle / waiting-for-bite / skill-check / result)
|
||||
# - skill-check state placeholders (cursor angle, bars, speed, result)
|
||||
# - app.stepsPerSecond for the game loop cadence
|
||||
# Delegates to the smaller setup helpers below to keep this readable.
|
||||
pass
|
||||
|
||||
#DRAWING CONSTANTS
|
||||
app.width = 600
|
||||
app.height = 400
|
||||
app.background = 'lightSkyBlue'
|
||||
app.waterColor = 'midnightBlue'
|
||||
app.grassColor = 'seaGreen'
|
||||
app.waterHeight = app.height // 3
|
||||
app.waterBottom = app.height = app.waterHeight
|
||||
app.grassHeight = 20
|
||||
app.grassBottom = app.height - app.waterHeight - app.grassHeight
|
||||
|
||||
#GAME STATE/SETUP
|
||||
app.stepsPerSecond = 30
|
||||
app.creatures = loadCreatures()
|
||||
app.save = loadSave()
|
||||
app.scene = "idle" # idle, waiting-for-bite, skill-check, result, shopping, menu
|
||||
|
||||
#SKILL CHECK
|
||||
app.skillCheckAngle = 0
|
||||
app.skillCheckSpeed = 1
|
||||
app.skillCheckBars = []
|
||||
app.skillCheckSpeed = 1
|
||||
app.skillCheckFailed = False
|
||||
|
||||
#FISHING
|
||||
app.fishingTimer = 0
|
||||
app.hookedFish = None
|
||||
|
||||
|
||||
|
||||
def resetFishingState(app):
|
||||
@@ -115,6 +150,12 @@ def startSkillCheck(app, creature):
|
||||
# bar length/width. Also apply any owned upgrades that modify these values
|
||||
# (e.g. slower cursor, wider bars, extra forgiveness). Stores the resulting
|
||||
# parameters on app for the controller/view to use.
|
||||
app.scene = "skill-check"
|
||||
difficulty = creature["difficulty"]
|
||||
|
||||
fishingPower = 1 + sum(upgrade[2] for upgrade in AVAILABLE_UPGRADES if (upgrade[0] in app.save["owned_upgrades"] and upgrade[1] == "power"))
|
||||
|
||||
app.skillCheckSpeed = difficulty / fishingPower
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user