HUMAN: start actually displaying things
This commit is contained in:
@@ -124,9 +124,9 @@ def onAppStart(app):
|
|||||||
app.waterColor = 'midnightBlue'
|
app.waterColor = 'midnightBlue'
|
||||||
app.grassColor = 'seaGreen'
|
app.grassColor = 'seaGreen'
|
||||||
app.waterHeight = app.height // 3
|
app.waterHeight = app.height // 3
|
||||||
app.waterBottom = app.height - app.waterHeight
|
app.waterTop = app.height - app.waterHeight
|
||||||
app.grassHeight = 20
|
app.grassHeight = 20
|
||||||
app.grassBottom = app.height - app.waterHeight - app.grassHeight
|
app.grassTop = app.height - app.waterHeight - app.grassHeight
|
||||||
|
|
||||||
#GAME STATE/SETUP
|
#GAME STATE/SETUP
|
||||||
app.stepsPerSecond = 30
|
app.stepsPerSecond = 30
|
||||||
@@ -261,7 +261,7 @@ def onStep(app):
|
|||||||
#list of interactables with name and their positions
|
#list of interactables with name and their positions
|
||||||
#(name, sceneFilter, left, right, top, bottom)
|
#(name, sceneFilter, left, right, top, bottom)
|
||||||
INTERACTABLES = [
|
INTERACTABLES = [
|
||||||
("open-shop", "idle", 250,350,0,100)
|
("open-shop", "idle", 250,350,0,100),
|
||||||
("close-shop", "shop", 500, 550, 50, 100)
|
("close-shop", "shop", 500, 550, 50, 100)
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -289,7 +289,8 @@ def onMousePress(app, mouseX, mouseY):
|
|||||||
if not interacted and app.scene == "idle":
|
if not interacted and app.scene == "idle":
|
||||||
beginFishing(app)
|
beginFishing(app)
|
||||||
case "result":
|
case "result":
|
||||||
resetFishingState()
|
sellCreature(app, app.hookedFish)
|
||||||
|
resetFishingState(app)
|
||||||
case "skill-check":
|
case "skill-check":
|
||||||
checkSkillHit(app)
|
checkSkillHit(app)
|
||||||
|
|
||||||
@@ -301,7 +302,10 @@ def onKeyPress(app, key):
|
|||||||
# 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.
|
#decidedly unused for now, i prefer mouse-only. ill keep the definition here in case i need debug tools.
|
||||||
pass
|
|
||||||
|
# DEBUG
|
||||||
|
if key == "m":
|
||||||
|
app.save["cash"] = 1000000
|
||||||
|
|
||||||
|
|
||||||
def checkSkillHit(app):
|
def checkSkillHit(app):
|
||||||
@@ -339,8 +343,12 @@ def sellCreature(app, creature):
|
|||||||
# 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
|
#selling will be automatic
|
||||||
pass
|
if creature == None: return
|
||||||
|
|
||||||
|
app.save["cash"] += creature["price"]
|
||||||
|
|
||||||
|
writeSave(app.save)
|
||||||
|
|
||||||
|
|
||||||
def buyUpgrade(app, upgradeId):
|
def buyUpgrade(app, upgradeId):
|
||||||
@@ -348,7 +356,14 @@ def buyUpgrade(app, upgradeId):
|
|||||||
# already own it; if valid, deduct money, record ownership in app.save, and
|
# already own it; if valid, deduct money, record ownership in app.save, and
|
||||||
# persist. Upgrades modify the skill check (cursor speed, bar size/count,
|
# persist. Upgrades modify the skill check (cursor speed, bar size/count,
|
||||||
# extra attempts, etc.) and are read back in startSkillCheck.
|
# extra attempts, etc.) and are read back in startSkillCheck.
|
||||||
pass
|
upgrade = [u for u in AVAILABLE_UPGRADES if u[0] == upgradeId][0] #find the specified upgrade
|
||||||
|
name, category, value, price = upgrade
|
||||||
|
|
||||||
|
if name in app.save["owned_upgrades"]: return False
|
||||||
|
if price > app.save["cash"]: return False
|
||||||
|
|
||||||
|
app.save["owned_upgrades"].append(name)
|
||||||
|
app.save["cash"] -= price
|
||||||
|
|
||||||
|
|
||||||
def buyBaitLicense(app, baitId):
|
def buyBaitLicense(app, baitId):
|
||||||
@@ -356,14 +371,27 @@ def buyBaitLicense(app, baitId):
|
|||||||
# freely switch to that bait at no further cost (switching handled by
|
# freely switch to that bait at no further cost (switching handled by
|
||||||
# setActiveBait). Bait determines which creatures are reachable in
|
# setActiveBait). Bait determines which creatures are reachable in
|
||||||
# pickRandomCreature. Deduct money, record ownership, persist.
|
# pickRandomCreature. Deduct money, record ownership, persist.
|
||||||
pass
|
bait = [b for b in AVAILABLE_BAITS if b[0] == baitId][0] #find the specified upgrade
|
||||||
|
name, max_difficulty, price = bait
|
||||||
|
|
||||||
|
if name in app.save["owned_baits"]: return False
|
||||||
|
if price > app.save["cash"]: return False
|
||||||
|
|
||||||
|
app.save["owned_baits"].append(name)
|
||||||
|
app.save["cash"] -= price
|
||||||
|
|
||||||
|
|
||||||
def setActiveBait(app, baitId):
|
def setActiveBait(app, baitId):
|
||||||
# Switch the currently-equipped bait to any bait the player already owns a
|
# Switch the currently-equipped bait to any bait the player already owns a
|
||||||
# license for. Free action. Updates app state so the next cast's creature
|
# license for. Free action. Updates app state so the next cast's creature
|
||||||
# pool reflects the new bait. Reject the switch if the bait isn't owned.
|
# pool reflects the new bait. Reject the switch if the bait isn't owned.
|
||||||
pass
|
bait = [b for b in AVAILABLE_BAITS if b[0] == baitId][0] #find the specified upgrade
|
||||||
|
name, max_difficulty, price = bait
|
||||||
|
|
||||||
|
if name in app.save["owned_baits"]:
|
||||||
|
app.save["current_bait"] = name
|
||||||
|
|
||||||
|
writeSave(app.save)
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -380,14 +408,21 @@ def redrawAll(app):
|
|||||||
# - the active skill-check overlay, or
|
# - the active skill-check overlay, or
|
||||||
# - the catch-display popup.
|
# - the catch-display popup.
|
||||||
# Delegates each piece to the helpers below.
|
# Delegates each piece to the helpers below.
|
||||||
pass
|
drawBackground(app)
|
||||||
|
|
||||||
|
|
||||||
|
#REMINDERS:
|
||||||
|
# drawRect(top, left, width, height, fill="color")
|
||||||
|
|
||||||
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
|
||||||
# wave patterns). This is the backdrop present in every scene.
|
# wave patterns). This is the backdrop present in every scene.
|
||||||
pass
|
|
||||||
|
#water
|
||||||
|
drawRect(0, app.waterTop, app.width, app.waterHeight, fill=app.waterColor)
|
||||||
|
#grass
|
||||||
|
drawRect(0, app.grassTop, app.width, app.grassHeight, fill=app.grassColor)
|
||||||
|
|
||||||
|
|
||||||
def drawPlayerAndRod(app):
|
def drawPlayerAndRod(app):
|
||||||
@@ -430,7 +465,7 @@ def drawHud(app):
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def main():
|
def main():
|
||||||
# Start the cmu_graphics app (runApp with the chosen window dimensions).
|
# Start the cmu_graphics app (runApp with the chosen window dimensions).
|
||||||
pass
|
runApp()
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -33,3 +33,12 @@ As previously stated, cmu_graphics should be the main backend engine, with the M
|
|||||||
- there is a dock with your character sprite sitting on the end with it's fishing rod, with the bobber going down onto the water when you fish
|
- there is a dock with your character sprite sitting on the end with it's fishing rod, with the bobber going down onto the water when you fish
|
||||||
- shop and other ui will appear as sprites standing on grass behind the dock/water area, and are clickable to interact with the shop/ui
|
- shop and other ui will appear as sprites standing on grass behind the dock/water area, and are clickable to interact with the shop/ui
|
||||||
- caught fish should have their sprite appear to come up flying out of the water, and stay on the screen while it displays the fish stats and name + description, until the user clicks it away
|
- caught fish should have their sprite appear to come up flying out of the water, and stay on the screen while it displays the fish stats and name + description, until the user clicks it away
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## UI Planning
|
||||||
|
|
||||||
|
- shop menu includes purchases at the top in 3 columns for each type, with the bait selector / purchaser at the bottom
|
||||||
|
- idle screen has fisherman on dock on left, water in bottom middle, shop guy in top middle, cash and current bait in top right
|
||||||
Reference in New Issue
Block a user