Added new animations
This commit is contained in:
@@ -1,6 +1,25 @@
|
||||
[gd_resource type="SpriteFrames" format=3 uid="uid://doxc4pl5hvs6k"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bv4gsgya7wp4d" path="res://sprites/atlas/demoman_walking.png" id="1_1t22f"]
|
||||
[ext_resource type="Texture2D" uid="uid://dy7fh0eg6qulr" path="res://sprites/atlas/demoman_idles.png" id="1_c2ath"]
|
||||
[ext_resource type="Texture2D" uid="uid://cl3uy4d6lgspe" path="res://sprites/man_falls.png" id="1_kdeld"]
|
||||
[ext_resource type="Texture2D" uid="uid://cr5bdv3hgmd4q" path="res://sprites/man_jumps.png" id="3_a1t44"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w1sc6"]
|
||||
atlas = ExtResource("1_c2ath")
|
||||
region = Rect2(0, 0, 32, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mcxxx"]
|
||||
atlas = ExtResource("1_c2ath")
|
||||
region = Rect2(0, 64, 32, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nf227"]
|
||||
atlas = ExtResource("1_c2ath")
|
||||
region = Rect2(32, 0, 32, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sbabb"]
|
||||
atlas = ExtResource("1_c2ath")
|
||||
region = Rect2(32, 64, 32, 64)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_c2ath"]
|
||||
atlas = ExtResource("1_1t22f")
|
||||
@@ -24,12 +43,35 @@ region = Rect2(64, 0, 32, 64)
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [],
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_kdeld")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"fall",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w1sc6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_mcxxx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nf227")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sbabb")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [],
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_a1t44")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"jump",
|
||||
"speed": 5.0
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dy7fh0eg6qulr"
|
||||
path="res://.godot/imported/demoman_idles.png-a329588d12d5e8eda94ae9b9fc61068e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/atlas/demoman_idles.png"
|
||||
dest_files=["res://.godot/imported/demoman_idles.png-a329588d12d5e8eda94ae9b9fc61068e.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cl3uy4d6lgspe"
|
||||
path="res://.godot/imported/man_falls.png-61beb99173ba0b99454c416e7ba44020.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/man_falls.png"
|
||||
dest_files=["res://.godot/imported/man_falls.png-61beb99173ba0b99454c416e7ba44020.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cr5bdv3hgmd4q"
|
||||
path="res://.godot/imported/man_jumps.png-70ad3c36f80f10d1a96a8706ccbc76b6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/man_jumps.png"
|
||||
dest_files=["res://.godot/imported/man_jumps.png-70ad3c36f80f10d1a96a8706ccbc76b6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -78,16 +78,30 @@ public partial class PlayerPhysicsController : CharacterBody2D {
|
||||
public override void _Process(double delta) {
|
||||
var grounded = this.IsOnFloor();
|
||||
var absvel = new Vector2(Mathf.Abs(Velocity.X), Mathf.Abs(Velocity.Y));
|
||||
Sprite.FlipH = Velocity.X < 0;
|
||||
if (grounded && absvel.X > 0) {
|
||||
Sprite.Play("walk", absvel.X switch {
|
||||
var xAxis = Input.GetAxis("move_left", "move_right");
|
||||
Sprite.FlipH = xAxis < 0;
|
||||
if (grounded && absvel.X > 0.1) {
|
||||
Sprite.Animation = "walk";
|
||||
Sprite.SpeedScale = absvel.X switch {
|
||||
< 10 => 1,
|
||||
< 150 => 2,
|
||||
< 300 => 4,
|
||||
_ => 1
|
||||
});
|
||||
} else if (grounded && absvel.X < epsilon && absvel.Y < epsilon) {
|
||||
Sprite.Play("idle");
|
||||
};
|
||||
} else {
|
||||
Sprite.SpeedScale = 1;
|
||||
}
|
||||
|
||||
if (grounded && absvel.X < 0.1) {
|
||||
Sprite.Animation = "idle";
|
||||
}
|
||||
|
||||
if (!grounded && Velocity.Y > 0.1) {
|
||||
Sprite.Animation = "fall";
|
||||
}
|
||||
|
||||
if (!grounded && Velocity.Y < 0.1) {
|
||||
Sprite.Animation = "jump";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user