This repository has been archived on 2023-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-01 00:59:39 +03:00

24 lines
690 B
GDScript

extends TextureButton
onready var anim = get_node('../../anim')
onready var animWinLose = get_node('../../winloseAnim')
onready var game = get_node('../../../Playground')
onready var sound = get_node('../../sound')
func _pressed():
if _G.currentTrashType == 'plastic' && _G.currentTrashType != 'none':
anim.play('onUnload')
animWinLose.play("win")
_G.updateScore(_G.score+1)
_G.currentTrashType = 'none'
sound.stream = load("res://sounds/win.wav")
sound.play()
else:
if(_G.currentTrashType != 'none'):
anim.play('onUnload')
animWinLose.play("lose")
_G.updateScore(0)
_G.currentTrashType = 'none'
sound.stream = load("res://sounds/lose.wav")
sound.play()