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.
trashsort/scripts/onCardLoad.gd
2020-11-01 00:59:39 +03:00

21 lines
470 B
GDScript

extends Node
func _ready():
nextCard()
func nextCard():
if !$winloseAnim.is_playing():
if _G.currentTrashType == 'none':
randomize()
var i = randi() % len(_G.trash) + 1
$sprite.texture = load(_G.trash[i][0])
_G.currentTrashType = _G.trash[i][1]
$anim.queue("onLoad")
# warning-ignore:unused_argument
func _physics_process(delta):
nextCard()
if Input.is_action_just_pressed("ui_cancel"):
_G.currentTrashType = 'none'
_G.loadScene("MainMenu")