mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
31 lines
789 B
Text
31 lines
789 B
Text
[gd_scene load_steps=3 format=2]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
script/source = "extends CharacterBody2D
|
|
|
|
@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\")
|
|
set_velocity(Vector2(right, down).normalized()*speed)
|
|
move_and_slide()
|
|
"
|
|
|
|
[sub_resource type="RectangleShape2D" id=2]
|
|
size = Vector2( 50, 50 )
|
|
|
|
[node name="Player" type="CharacterBody2D"]
|
|
script = SubResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
|
shape = SubResource( 2 )
|
|
|
|
[node name="Rect" type="ColorRect" parent="."]
|
|
offset_left = -50.0
|
|
offset_top = -50.0
|
|
offset_right = 50.0
|
|
offset_bottom = 50.0
|