Added Level. Removed params from _init()

This commit is contained in:
2024-09-09 02:15:39 +03:00
parent f4758551cb
commit e7cbf0a6a1
11 changed files with 78 additions and 49 deletions
+4 -6
View File
@@ -1,10 +1,12 @@
class_name Field
extends StaticBody2D
enum FieldType {
MIDDLE, CORNER, TOP, LEFT,
}
@export var field_type: FieldType
@export var type: FieldType
var POSITIONS_BY_TYPE : Dictionary = {
@@ -37,10 +39,6 @@ var POSITIONS_BY_TYPE : Dictionary = {
Vector2(64, 16),
],
}
func _init(type : FieldType = FieldType.MIDDLE) -> void:
field_type = type
func _ready() -> void:
@@ -48,5 +46,5 @@ func _ready() -> void:
func update_atlas_position() -> void:
var positions = POSITIONS_BY_TYPE[field_type]
var positions = POSITIONS_BY_TYPE[type]
$Sprite2D.texture.region.position = positions[randi() % positions.size()]