diff options
| author | freddie-a <57713959+freddie-a@users.noreply.github.com> | 2022-10-30 09:21:08 +0000 |
|---|---|---|
| committer | freddie-a <57713959+freddie-a@users.noreply.github.com> | 2022-10-30 09:21:08 +0000 |
| commit | d532570052901e9e956fab4809228a6b742ee233 (patch) | |
| tree | 6161dbaedf0ed172a3ceced9abce68c2f72f667c | |
| parent | f3ac42262d09514040a7c48a2fd320c23a16a950 (diff) | |
Rotate player to mouse and rename
| -rw-r--r-- | Player.gd (renamed from KinematicBody2D.gd) | 1 | ||||
| -rw-r--r-- | Player.tscn | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/KinematicBody2D.gd b/Player.gd index 22f7db1..9b5bbd6 100644 --- a/KinematicBody2D.gd +++ b/Player.gd @@ -29,6 +29,7 @@ func _physics_process(delta): position += velocity * delta position.x = clamp(position.x, 0, screen_size.x) position.y = clamp(position.y, 0, screen_size.y) + rotation = global_position.angle_to_point(get_global_mouse_position()) + PI + PI / 8 # extra /8 to offset TeX's snout if Input.is_action_just_pressed("click"): var obj = spawn_object.instance() obj.position = get_position() diff --git a/Player.tscn b/Player.tscn index 4dcae32..8491e22 100644 --- a/Player.tscn +++ b/Player.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://KinematicBody2D.gd" type="Script" id=1] +[ext_resource path="res://Player.gd" type="Script" id=1] [ext_resource path="res://assets/htm_tex.png" type="Texture" id=2] [node name="Area2D" type="Area2D"] |
