25 lines
551 B
GDScript3
25 lines
551 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
var yvel = 1
|
||
|
var yoff = 0
|
||
|
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
$Sprite2D.texture = PakAssetLoader.load_file("user://data/units.pak/tomomo_00_00.dat")
|
||
|
$Sprite2D.position = get_global_transform().origin
|
||
|
$Sprite2D.position.y -= 128
|
||
|
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(_delta):
|
||
|
var pos = get_global_transform().origin
|
||
|
pos.y += -128 + yoff
|
||
|
yvel -= 1
|
||
|
if yvel < -9:
|
||
|
yvel = 9
|
||
|
pos.y += yvel
|
||
|
yoff += yvel
|
||
|
$Sprite2D.position = pos
|
||
|
|