basic player
This commit is contained in:
parent
a42c93ff6b
commit
91d06311db
38
player.tscn
Normal file
38
player.tscn
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://sp3iv6cxuerm"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_hd04s"]
|
||||||
|
script/source = "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
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Player" type="Node2D"]
|
||||||
|
z_index = 1
|
||||||
|
script = SubResource("GDScript_hd04s")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
top_level = true
|
||||||
|
z_index = 2
|
||||||
|
position = Vector2(2.08165e-12, -128)
|
Loading…
Reference in New Issue
Block a user