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
+23
View File
@@ -0,0 +1,23 @@
using Godot;
using System;
using Object = Godot.Object;
public class World : Node2D
{
//-260 240
private Sprite spriteBackground;
private PackedScene prefabObstacle = GD.Load<PackedScene>("res://Obstacle.tscn");
private Random random = new Random();
public override void _Ready()
{
spriteBackground = GetNode<Sprite>("Background");
}
private void _on_Timer_timeout()
{
Area2D instance = prefabObstacle.Instance() as Area2D;
instance.Position = new Vector2(instance.Position.x, random.Next(-260, 140));
spriteBackground.AddChild(instance);
}
}