Skip to content

Commit

Permalink
results\
Browse files Browse the repository at this point in the history
  • Loading branch information
RobzLegz committed May 19, 2022
1 parent 964851e commit 938be74
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 36 deletions.
60 changes: 26 additions & 34 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
male.state(6)

#fn for setting game appearance
(flash_quad, status_bar, time_text, score_text, gray_effect, inventory) = set_appearance()
(flash_quad, status_bar, time_text, score_text, gray_effect, inventory, resultPanel) = set_appearance()

# List of hiding spots for trash_pile
trash_pile = []
Expand Down Expand Up @@ -119,29 +119,38 @@ def DisplayInstructionsTask():
yield viztask.waitKeyDown(' ')
panel.remove()

def DisplayInventory():
if len(player_picks) < 1:
inventory.message("")
def removeObjects():
for trash in trash_pile:
trash.visible(False)

for recycle_bin in recicle_bins:
recycle_bin.visible(False)

return
def showResults():
if len(collected_trash) >= 9:
resultPanel.setText(RESULTS)
resultPanel.visible(True)
removeObjects()

item = player_picks[0]
def DisplayInventory():
if len(player_picks) < 1:
inventory.message("")
else:
item = player_picks[0]

item_type = ""
item_type = ""

if item in plastic_trash:
item_type = "plastmasas"
elif item in glass_trash:
item_type = "stikla"
elif item in paper_trash:
item_type = "papīra"
if item in plastic_trash:
item_type = "plastmasas"
elif item in glass_trash:
item_type = "stikla"
elif item in paper_trash:
item_type = "papīra"

inventory.message(PICKED_TRASH.format(item_type))
inventory.message(PICKED_TRASH.format(item_type))

def UpdateScore(TIMER_TIMER):
print(TIMER_TIMER)
score_text.message(f'Time: {TIMER_TIMER}')
if len(collected_trash) >= 9:
showResults()

def dropTrash(object):
player_picks.pop()
Expand Down Expand Up @@ -181,28 +190,11 @@ def MainTask():
# Display instructions and wait for key press to continue
yield DisplayInstructionsTask()

TIMER_TIMER = 0

# Create panel to display trial results
resultPanel = vizinfo.InfoPanel('',align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
resultPanel.visible(False)

# Go through each position
for trash in trash_pile:
trash.visible(True)

for recycle_bin in recicle_bins:
recycle_bin.visible(True)

# while len(collected_trash) < 10:
# TIMER_TIMER += 1
# UpdateScore(TIMER_TIMER)
# time.sleep(1)

if len(collected_trash) >= 10:
resultPanel.setText(RESULTS.format(TIMER_TIMER))
resultPanel.visible(True)
yield viztask.waitKeyDown(' ')
resultPanel.visible(False)

viztask.schedule( MainTask() )
6 changes: 5 additions & 1 deletion src/apearance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import viz
import vizfx
import vizinfo
import vizfx.postprocess
from vizfx.postprocess.color import GrayscaleEffect
from vizfx.postprocess.composite import BlendEffect
Expand Down Expand Up @@ -45,4 +46,7 @@ def set_appearance():
gray_effect.setEnabled(False)
vizfx.postprocess.addEffect(gray_effect)

return (flash_quad, status_bar, time_text, score_text, gray_effect, inventory)
resultPanel = vizinfo.InfoPanel('', align=viz.ALIGN_CENTER, fontSize=25, icon=False, key=None)
resultPanel.visible(False)

return (flash_quad, status_bar, time_text, score_text, gray_effect, inventory, resultPanel)
2 changes: 1 addition & 1 deletion src/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

PICKED_TRASH = """Esi pacēlis {} atkritumu, iemet to attiecīgajā konteinerā"""

RESULTS = """Jūs sašķirojāt atkritumus {} ilgā laikā"""
RESULTS = """Apsveicam! Jūs sašķirojāt visus atkritumus"""

TRIAL_SUCCESS = 'You caught the pigeon!'
TRIAL_FAIL = 'The pigeon flew away!'

0 comments on commit 938be74

Please sign in to comment.