oh-my-git/scenes/player.tscn
2020-10-26 19:16:22 +01:00

30 lines
775 B
Text

[gd_scene load_steps=3 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends KinematicBody2D
export var speed = 800
func _ready():
pass
func _process(delta):
var right = Input.get_action_strength(\"right\") - Input.get_action_strength(\"left\")
var down = Input.get_action_strength(\"down\") - Input.get_action_strength(\"up\")
move_and_slide(Vector2(right, down).normalized()*speed)
"
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 50, 50 )
[node name="Player" type="KinematicBody2D"]
script = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
[node name="Rect" type="ColorRect" parent="."]
margin_left = -50.0
margin_top = -50.0
margin_right = 50.0
margin_bottom = 50.0