Moved movement speed to globals
idk why I didnt do this already but whatever
This commit is contained in:
1 parent
03c6381e34
commit
80646fadbf
2 files changed
+4
-3
No files matched your search
+2
-3
@@ -2,7 +2,6 @@ using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Player : Node2D {
|
||||
private float MovementSpeed = 800f;
|
||||
private float ScreenBorders = 120f;
|
||||
|
||||
public override void _Ready() {
|
||||
@@ -19,13 +18,13 @@ public partial class Player : Node2D {
|
||||
|
||||
if ((Input.IsKeyPressed((Key)Key.Left) || Input.IsKeyPressed((Key)Key.A)) && Pos.X > ScreenBorders) {
|
||||
GetNode<Sprite2D>("Texture").FlipH = false;
|
||||
Pos.X -= MovementSpeed * (float)delta;
|
||||
Pos.X -= Globals.MovementSpeed * (float)delta;
|
||||
}
|
||||
|
||||
float ScreenWidth = (WindowSize.X / WindowScale.X) - ScreenBorders;
|
||||
if ((Input.IsKeyPressed((Key)Key.Right) || Input.IsKeyPressed((Key)Key.D)) && Pos.X < ScreenWidth) {
|
||||
GetNode<Sprite2D>("Texture").FlipH = true;
|
||||
Pos.X += MovementSpeed * (float)delta;
|
||||
Pos.X += Globals.MovementSpeed * (float)delta;
|
||||
}
|
||||
|
||||
Position = Pos;
|
||||
|
||||
Reference in new issue
Block a user