Basic belts working
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
extends Sprite2D
|
||||
|
||||
var empty: bool = true
|
||||
var value: int
|
||||
var move_timer: int = 0
|
||||
var map_position: Vector2
|
||||
var facing_direction: int
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func setup(pos, dir):
|
||||
map_position = pos
|
||||
facing_direction = dir
|
||||
|
||||
func collect(input_value: int):
|
||||
$value_text.text = str(input_value)
|
||||
$value_text.show()
|
||||
empty = false
|
||||
value = input_value
|
||||
|
||||
func move():
|
||||
#print("Moving item")
|
||||
move_timer += 1
|
||||
$value_text.position[1] = -30 + (move_timer * 2)
|
||||
if move_timer > 15:
|
||||
move_timer = 0
|
||||
empty = true
|
||||
$value_text.hide()
|
||||
var next_pos = map_position
|
||||
if facing_direction == 0:
|
||||
next_pos[1] += 1
|
||||
return [next_pos, value]
|
||||
return
|
||||
Reference in New Issue
Block a user