From 8cf6372d8b6e0d7c80ccfc101bbc1d38c2fb51b3 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Tue, 13 Dec 2022 20:30:53 +0100 Subject: [PATCH] changed some player speed parameters --- scenes/player.tscn | 6 +++--- src/scene-scripts/player.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scenes/player.tscn b/scenes/player.tscn index e9959c4..546b901 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -40,17 +40,17 @@ animations = [{ "frames": [SubResource("AtlasTexture_tirvd"), SubResource("AtlasTexture_0qv2m"), SubResource("AtlasTexture_tirvd"), SubResource("AtlasTexture_qomfj")], "loop": true, "name": &"move_down", -"speed": 8.0 +"speed": 5.0 }, { "frames": [SubResource("AtlasTexture_ulejc"), SubResource("AtlasTexture_1x805")], "loop": true, "name": &"move_side", -"speed": 8.0 +"speed": 5.0 }, { "frames": [SubResource("AtlasTexture_x338k"), SubResource("AtlasTexture_6ynw8"), SubResource("AtlasTexture_x338k"), SubResource("AtlasTexture_2yirn")], "loop": true, "name": &"move_up", -"speed": 8.0 +"speed": 5.0 }] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_38v5o"] diff --git a/src/scene-scripts/player.cs b/src/scene-scripts/player.cs index 4ce658f..273b894 100644 --- a/src/scene-scripts/player.cs +++ b/src/scene-scripts/player.cs @@ -4,7 +4,7 @@ using System; public partial class player : CharacterBody2D { [Export] public string playerName; - [Export] public int speed = 400; + [Export] public int speed = 200; public float rayCastLength; public Vector2 movement; public AnimatedSprite2D animatedSprite; @@ -45,14 +45,14 @@ public partial class player : CharacterBody2D { animatedSprite.Animation = "move_side"; animatedSprite.FlipH = movement.x < 0.5; - animatedSprite.SpeedScale = Math.Abs(movement.x); + animatedSprite.SpeedScale = Math.Abs(movement.x * speed/150); } else if (Math.Round(movement.y, 0) != 0) { if (movement.y > 0.05) animatedSprite.Animation = "move_down"; if (movement.y < 0.05) animatedSprite.Animation = "move_up"; animatedSprite.FlipH = false; - animatedSprite.SpeedScale = Math.Abs(movement.y); + animatedSprite.SpeedScale = Math.Abs(movement.y * speed/150); } } }