71 lines
1.4 KiB
GDScript
71 lines
1.4 KiB
GDScript
extends Node
|
|
|
|
var points = 0
|
|
|
|
const minSpeed = 0.5
|
|
const maxSpeed = 0.15
|
|
var currentSpeed := minSpeed
|
|
|
|
var hasSelectedSpeed = false
|
|
|
|
const GRID := 64
|
|
|
|
enum BLOCKTYPES {LIGHT=1, HEAVY=3}
|
|
|
|
const BLOCKSPATTERS : Dictionary = {
|
|
"Z": "res://scenes/Blocks/Patterns/Z/Z_block_pattern.tscn",
|
|
"L": "res://scenes/Blocks/Patterns/L/L_block_pattern.tscn",
|
|
"L-Reverse": "res://scenes/Blocks/Patterns/L-Reverse/L-Reverse_block_pattern.tscn",
|
|
"Z-Reverse": "res://scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn",
|
|
"2x2": "res://scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn",
|
|
"T": "res://scenes/Blocks/Patterns/T/T_block_pattern.tscn",
|
|
#"I": "res://scenes/Blocks/Patterns/I/I_block_pattern.tscn",
|
|
"1x3": "res://scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn"
|
|
}
|
|
enum Direction {BOTTOM, LEFT, RIGHT, TOP}
|
|
|
|
var lastUID = 1
|
|
|
|
var currentUID = lastUID
|
|
|
|
var time = 60
|
|
|
|
var lost = false
|
|
|
|
enum MODES {INFINITE, TIME}
|
|
|
|
var currentMode = MODES.INFINITE
|
|
|
|
func getNewUID() -> int:
|
|
lastUID += 1
|
|
return lastUID
|
|
|
|
|
|
func resetGame():
|
|
lost = false
|
|
points = 0
|
|
lastUID = 0
|
|
currentUID = lastUID
|
|
resetTime()
|
|
lost = false
|
|
|
|
func _ready() -> void:
|
|
resetGame()
|
|
|
|
func lose():
|
|
lost = true
|
|
|
|
func resetTime():
|
|
time = 0
|
|
|
|
|
|
func setTimeModeTimer():
|
|
time = 60
|
|
|
|
func convertIntToTime(value) -> String:
|
|
var time = str(value)
|
|
var seconds = value % 60
|
|
var minutes = value / 60
|
|
if seconds < 10:
|
|
seconds = "0"+ str(seconds)
|
|
return str(minutes) + ":" + str(seconds)
|