diff --git a/src/behaviours/movement/PlayerMovement.gd b/src/behaviours/movement/PlayerMovement.gd index f6ac92b..8667d43 100644 --- a/src/behaviours/movement/PlayerMovement.gd +++ b/src/behaviours/movement/PlayerMovement.gd @@ -2,6 +2,9 @@ extends Node class_name PlayerMovement +signal moving_in_direction(direction) + + export var movement_per_second: float @@ -19,4 +22,5 @@ func _physics_process(_delta): if direction.length() > 1: direction.normalized() + emit_signal("moving_in_direction", direction) var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO) diff --git a/src/mechanics/CharacterFront.png b/src/entities/players/CharacterFront.png similarity index 100% rename from src/mechanics/CharacterFront.png rename to src/entities/players/CharacterFront.png diff --git a/src/mechanics/CharacterFront.png.import b/src/entities/players/CharacterFront.png.import similarity index 68% rename from src/mechanics/CharacterFront.png.import rename to src/entities/players/CharacterFront.png.import index 7c16965..e868946 100644 --- a/src/mechanics/CharacterFront.png.import +++ b/src/entities/players/CharacterFront.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/CharacterFront.png-086504ef28b2298368e1e8c99d2c6d8c.stex" +path="res://.import/CharacterFront.png-845655f7c30d9b4c6e480912b353d1f6.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/mechanics/CharacterFront.png" -dest_files=[ "res://.import/CharacterFront.png-086504ef28b2298368e1e8c99d2c6d8c.stex" ] +source_file="res://src/entities/players/CharacterFront.png" +dest_files=[ "res://.import/CharacterFront.png-845655f7c30d9b4c6e480912b353d1f6.stex" ] [params] diff --git a/src/mechanics/CharacterFrontLeft.png b/src/entities/players/CharacterFrontLeft.png similarity index 100% rename from src/mechanics/CharacterFrontLeft.png rename to src/entities/players/CharacterFrontLeft.png diff --git a/src/mechanics/CharacterFrontLeft.png.import b/src/entities/players/CharacterFrontLeft.png.import similarity index 67% rename from src/mechanics/CharacterFrontLeft.png.import rename to src/entities/players/CharacterFrontLeft.png.import index 3e7b763..bad89a5 100644 --- a/src/mechanics/CharacterFrontLeft.png.import +++ b/src/entities/players/CharacterFrontLeft.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/CharacterFrontLeft.png-a3042b9811da49120539c1fc0f371a48.stex" +path="res://.import/CharacterFrontLeft.png-114f9621beadf66601a533677fac5ae7.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/mechanics/CharacterFrontLeft.png" -dest_files=[ "res://.import/CharacterFrontLeft.png-a3042b9811da49120539c1fc0f371a48.stex" ] +source_file="res://src/entities/players/CharacterFrontLeft.png" +dest_files=[ "res://.import/CharacterFrontLeft.png-114f9621beadf66601a533677fac5ae7.stex" ] [params] diff --git a/src/entities/players/PhaseOnePlayer.tscn b/src/entities/players/PhaseOnePlayer.tscn index 7660ecf..49c9725 100644 --- a/src/entities/players/PhaseOnePlayer.tscn +++ b/src/entities/players/PhaseOnePlayer.tscn @@ -1,20 +1,49 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://src/entities/players/AbstractPlayer.tscn" type="PackedScene" id=1] [ext_resource path="res://src/mechanics/White.png" type="Texture" id=2] [ext_resource path="res://src/entities/bullets/ArrowAlternative.tscn" type="PackedScene" id=3] [ext_resource path="res://src/behaviours/spawning/SpawnOnShoot.tscn" type="PackedScene" id=4] +[ext_resource path="res://src/entities/players/CharacterFrontLeft.png" type="Texture" id=5] +[ext_resource path="res://src/entities/players/CharacterFront.png" type="Texture" id=6] +[ext_resource path="res://src/behaviours/graphics/FourSidedSprite.gd" type="Script" id=7] -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 16, 16 ) +[sub_resource type="CapsuleShape2D" id=3] +radius = 9.0 +height = 14.0 + +[sub_resource type="SpriteFrames" id=2] +animations = [ { +"frames": [ ExtResource( 5 ) ], +"loop": true, +"name": "left", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ) ], +"loop": true, +"name": "right", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ) ], +"loop": true, +"name": "up", +"speed": 5.0 +}, { +"frames": [ ExtResource( 6 ) ], +"loop": true, +"name": "down", +"speed": 5.0 +} ] [node name="PhaseOnePlayer" instance=ExtResource( 1 )] [node name="Shape" type="CollisionShape2D" parent="." index="0"] -shape = SubResource( 1 ) +shape = SubResource( 3 ) -[node name="Sprite" type="Sprite" parent="Shape" index="0"] -texture = ExtResource( 2 ) +[node name="FourSidedSprite" type="AnimatedSprite" parent="Shape" index="0"] +frames = SubResource( 2 ) +animation = "left" +script = ExtResource( 7 ) [node name="Listener" type="Listener2D" parent="." index="1"] current = true @@ -23,3 +52,5 @@ current = true bullet = ExtResource( 3 ) cooldown = 0.1 rapid_fire = true + +[connection signal="moving_in_direction" from="PlayerMovement" to="Shape/FourSidedSprite" method="turn"]