Sun, Shovel, Fastforward, GUI Improvements
This commit is contained in:
parent
26c3aeb7e9
commit
63935d5978
28 changed files with 546 additions and 45 deletions
31
scripts/Sun.cs
Normal file
31
scripts/Sun.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Sun : Area2D
|
||||
{
|
||||
[Export] public int amount = 25;
|
||||
[Export] private Timer _deathTimer;
|
||||
[Export] private AnimationPlayer _rotation;
|
||||
[Export] private AnimationPlayer _fade;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_rotation.SpeedScale = 1.0f + GD.Randf() / 2.0f;
|
||||
}
|
||||
public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx)
|
||||
{
|
||||
if (@event.IsActionPressed("primary_action"))
|
||||
{
|
||||
LevelController.Instance.LevelData.AddSun(amount);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_deathTimer.TimeLeft/_deathTimer.WaitTime <= 0.25)
|
||||
{
|
||||
_fade.Play("main");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue