oh-my-git/scenes/player.tscn

31 lines
775 B
Text
Raw Permalink Normal View History

2020-01-29 20:25:13 +01:00
[gd_scene load_steps=3 format=2]
2020-10-26 18:56:35 +01:00
[sub_resource type="GDScript" id=1]
script/source = "extends KinematicBody2D
2020-01-29 20:25:13 +01:00
2020-10-26 18:56:35 +01:00
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]
2020-01-29 20:25:13 +01:00
extents = Vector2( 50, 50 )
[node name="Player" type="KinematicBody2D"]
2020-10-26 18:56:35 +01:00
script = SubResource( 1 )
2020-01-29 20:25:13 +01:00
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
2020-10-26 18:56:35 +01:00
shape = SubResource( 2 )
2020-01-29 20:25:13 +01:00
[node name="Rect" type="ColorRect" parent="."]
margin_left = -50.0
margin_top = -50.0
margin_right = 50.0
margin_bottom = 50.0