basic player
This commit is contained in:
parent
5d2158fcaf
commit
a42c93ff6b
24
Player/player.gd
Normal file
24
Player/player.gd
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
||||
|
13
Player/player.tscn
Normal file
13
Player/player.tscn
Normal file
@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dtm0201qhcn4d"]
|
||||
|
||||
[ext_resource type="Script" path="res://player.gd" id="1_6ggpr"]
|
||||
|
||||
[node name="Player" type="Node2D"]
|
||||
z_index = 1
|
||||
script = ExtResource("1_6ggpr")
|
||||
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