40 lines
934 B
GDScript3
40 lines
934 B
GDScript3
extends Sprite
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
# var a = 2
|
|
# var b = "text"
|
|
|
|
const types = {
|
|
"pawn": "res://src/pieces/Pawn.tscn",
|
|
"rook": "res://src/pieces/Rook.tscn",
|
|
"bishop": "res://src/pieces/Bishop.tscn",
|
|
"knight": "res://src/pieces/Knight.tscn",
|
|
"king": "res://src/pieces/King.tscn",
|
|
"queen": "res://src/pieces/Queen.tscn",
|
|
}
|
|
|
|
# Each piece should belong to a group - player or opponent
|
|
#
|
|
var health = 1
|
|
var damage = 1
|
|
var abilities = []
|
|
var kills = 0
|
|
|
|
static func new_piece(piece_type):
|
|
if not types.has(piece_type):
|
|
return null
|
|
return ResourceLoader.load(types[piece_type]).instance()
|
|
#piece.apply_scale(Vector2(pf.scale, pf.scale))
|
|
#piece.add_to_group(group)
|
|
#return piece
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
#func _process(delta):
|
|
# pass
|