file refactor
This commit is contained in:
parent
da5a3e874b
commit
bffb012a26
175 changed files with 1086 additions and 1107 deletions
29
scripts/level/SunSpawner.cs
Normal file
29
scripts/level/SunSpawner.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class SunSpawner : Node
|
||||
{
|
||||
[Export]
|
||||
public int MinSun = 25;
|
||||
[Export]
|
||||
public int MaxSun = 25;
|
||||
|
||||
[Export]
|
||||
private PackedScene SunScene;
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
float x = GD.Randf()*9*Utility.TileWidth;
|
||||
uint y = GD.Randi() % 5;
|
||||
|
||||
var sun = SunScene.Instantiate<Sun>();
|
||||
PoolContainer.Instance.Projectiles.AddChild(sun);
|
||||
|
||||
sun.GlobalPosition = new Vector2(Utility.LeftFieldBoundary.X + x, -90);
|
||||
|
||||
var moveTween = CreateTween();
|
||||
moveTween.TweenProperty(sun,"global_position", new Vector2(Utility.LeftFieldBoundary.X + x,
|
||||
Utility.LeftFieldBoundary.Y + Utility.TileHeight * y + Utility.TileHeight/2.0f),9-y);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue