mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
30 lines
775 B
Text
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
|