Skip to content

Commit

Permalink
Updating deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MugenTwo committed Jul 16, 2020
1 parent c811e32 commit 677b25a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Scripts/Ball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void _Process(float delta)
{
this.currentPosition += currentDirection * speed * delta;

SetPosition(this.currentPosition);
this.Position = this.currentPosition;
}

}
2 changes: 1 addition & 1 deletion Scripts/Exit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Exit : Area2D

public void OnExitAreaEntered(Area2D area)
{
if (area.GetName().Equals("ball"))
if (area.Name.Equals("ball"))
{
Ball ball = area as Ball;
ball.Reset();
Expand Down
8 changes: 4 additions & 4 deletions Scripts/Paddle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public override void _Ready()

public override void _Process(float delta)
{
String name = GetName();
Vector2 currentPosition = GetPosition();
String name = this.Name;
Vector2 currentPosition = this.Position;

if (Input.IsActionPressed(name + INPUT_MOVE_UP_SUFFIX) && currentPosition.y > 40)
{
Expand All @@ -32,12 +32,12 @@ public override void _Process(float delta)
currentPosition = new Vector2(currentPosition.x, currentPosition.y + speed * delta);
}

SetPosition(currentPosition);
this.Position = currentPosition;
}

public void OnPaddleAreaEntered(Area2D area)
{
if (area.GetName().Equals("ball"))
if (area.Name.Equals("ball"))
{
Ball ball = area as Ball;
Vector2 newDirection = new Vector2(ballDirection, this.randomNumberGenerator.Randf() * 2 - 1).Normalized();
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Wall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Wall : Area2D
private int yDirection = 1;
public void OnWallAreaEntered(Area2D area)
{
if (area.GetName().Equals("ball"))
if (area.Name.Equals("ball"))
{
Ball ball = area as Ball;
ball.currentDirection = new Vector2(ball.currentDirection.x, yDirection);
Expand Down

0 comments on commit 677b25a

Please sign in to comment.