This commit is contained in:
firefighter198
2021-08-11 00:26:20 +02:00
parent 7424309dac
commit 7146b2639c
44 changed files with 867 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
using Godot;
using System;
public class Obstacle : Area2D
{
private const float moveSpeed = 145f;
private void _on_Pipe_player_entered(object body)
{
if (body is Player)
{
Player player = body as Player;
player.die();
}
}
private void _on_Obstacle_player_exited(object body)
{
if (body is Player)
{
Player player = body as Player;
player.score_increase();
}
}
public override void _PhysicsProcess(float delta)
{
Translate(new Vector2(-moveSpeed * delta, 0));
if (Position.x < -200)
{
QueueFree();
}
}
}