changed some player speed parameters

This commit is contained in:
2022-12-13 20:30:53 +01:00
parent 771b2e801e
commit 8cf6372d8b
2 changed files with 6 additions and 6 deletions

View File

@@ -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"]

View File

@@ -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);
}
}
}