mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-25 22:24:17 +00:00
🔧 Add sprites to the player (back is still missing)
This commit is contained in:
parent
cdb57f90e6
commit
480e172307
6 changed files with 47 additions and 12 deletions
|
@ -2,6 +2,9 @@ extends Node
|
||||||
class_name PlayerMovement
|
class_name PlayerMovement
|
||||||
|
|
||||||
|
|
||||||
|
signal moving_in_direction(direction)
|
||||||
|
|
||||||
|
|
||||||
export var movement_per_second: float
|
export var movement_per_second: float
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,4 +22,5 @@ func _physics_process(_delta):
|
||||||
if direction.length() > 1:
|
if direction.length() > 1:
|
||||||
direction.normalized()
|
direction.normalized()
|
||||||
|
|
||||||
|
emit_signal("moving_in_direction", direction)
|
||||||
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
var _motion: Vector2 = parent.move_and_slide(direction * movement_per_second, Vector2.ZERO)
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/CharacterFront.png-086504ef28b2298368e1e8c99d2c6d8c.stex"
|
path="res://.import/CharacterFront.png-845655f7c30d9b4c6e480912b353d1f6.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://src/mechanics/CharacterFront.png"
|
source_file="res://src/entities/players/CharacterFront.png"
|
||||||
dest_files=[ "res://.import/CharacterFront.png-086504ef28b2298368e1e8c99d2c6d8c.stex" ]
|
dest_files=[ "res://.import/CharacterFront.png-845655f7c30d9b4c6e480912b353d1f6.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/CharacterFrontLeft.png-a3042b9811da49120539c1fc0f371a48.stex"
|
path="res://.import/CharacterFrontLeft.png-114f9621beadf66601a533677fac5ae7.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://src/mechanics/CharacterFrontLeft.png"
|
source_file="res://src/entities/players/CharacterFrontLeft.png"
|
||||||
dest_files=[ "res://.import/CharacterFrontLeft.png-a3042b9811da49120539c1fc0f371a48.stex" ]
|
dest_files=[ "res://.import/CharacterFrontLeft.png-114f9621beadf66601a533677fac5ae7.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -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/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/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/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/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]
|
[sub_resource type="CapsuleShape2D" id=3]
|
||||||
extents = Vector2( 16, 16 )
|
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="PhaseOnePlayer" instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
|
[node name="FourSidedSprite" type="AnimatedSprite" parent="Shape" index="0"]
|
||||||
texture = ExtResource( 2 )
|
frames = SubResource( 2 )
|
||||||
|
animation = "left"
|
||||||
|
script = ExtResource( 7 )
|
||||||
|
|
||||||
[node name="Listener" type="Listener2D" parent="." index="1"]
|
[node name="Listener" type="Listener2D" parent="." index="1"]
|
||||||
current = true
|
current = true
|
||||||
|
@ -23,3 +52,5 @@ current = true
|
||||||
bullet = ExtResource( 3 )
|
bullet = ExtResource( 3 )
|
||||||
cooldown = 0.1
|
cooldown = 0.1
|
||||||
rapid_fire = true
|
rapid_fire = true
|
||||||
|
|
||||||
|
[connection signal="moving_in_direction" from="PlayerMovement" to="Shape/FourSidedSprite" method="turn"]
|
||||||
|
|
Loading…
Reference in a new issue