sun is now scored on hover
This commit is contained in:
parent
e52c98470b
commit
0d0e16afa2
3 changed files with 24 additions and 15 deletions
|
|
@ -115,7 +115,7 @@ _data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"]
|
||||||
radius = 19.0
|
radius = 27.0
|
||||||
|
|
||||||
[node name="Sun" type="Area2D" node_paths=PackedStringArray("_deathTimer", "_rotation", "_fade")]
|
[node name="Sun" type="Area2D" node_paths=PackedStringArray("_deathTimer", "_rotation", "_fade")]
|
||||||
material = SubResource("ShaderMaterial_u0o5k")
|
material = SubResource("ShaderMaterial_u0o5k")
|
||||||
|
|
|
||||||
|
|
@ -21,23 +21,11 @@ public partial class Sun : Area2D
|
||||||
}
|
}
|
||||||
public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx)
|
public override void _InputEvent(Viewport viewport, InputEvent @event, int shapeIdx)
|
||||||
{
|
{
|
||||||
if (scoring) return;
|
if (Settings.SunClick == false || scoring) return;
|
||||||
|
|
||||||
if (@event.IsActionPressed("primary_action"))
|
if (@event.IsActionPressed("primary_action"))
|
||||||
{
|
{
|
||||||
|
ScoreSun();
|
||||||
_fade.Stop();
|
|
||||||
scoring = true;
|
|
||||||
|
|
||||||
GetNode<ChannelPlayer>("SunPlayer").Play();
|
|
||||||
var tween = CreateTween();
|
|
||||||
tween.TweenInterval(0.1);
|
|
||||||
tween.TweenProperty(this, "global_position", GetCanvasTransform().AffineInverse() * (Counter.GlobalPosition + Counter.PivotOffset), 0.5).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
|
||||||
tween.TweenCallback(Callable.From(() =>
|
|
||||||
{
|
|
||||||
RuntimeLevelData.Instance.AddSun(amount);
|
|
||||||
QueueFree();
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,4 +37,24 @@ public partial class Sun : Area2D
|
||||||
_fade.Play("main");
|
_fade.Play("main");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override void _MouseEnter()
|
||||||
|
{
|
||||||
|
if (Settings.SunClick) return;
|
||||||
|
ScoreSun();
|
||||||
|
}
|
||||||
|
private void ScoreSun()
|
||||||
|
{
|
||||||
|
_fade.Stop();
|
||||||
|
scoring = true;
|
||||||
|
|
||||||
|
GetNode<ChannelPlayer>("SunPlayer").Play();
|
||||||
|
var tween = CreateTween();
|
||||||
|
tween.TweenInterval(0.1);
|
||||||
|
tween.TweenProperty(this, "global_position", GetCanvasTransform().AffineInverse() * (Counter.GlobalPosition + Counter.PivotOffset), 0.5).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
||||||
|
tween.TweenCallback(Callable.From(() =>
|
||||||
|
{
|
||||||
|
RuntimeLevelData.Instance.AddSun(amount);
|
||||||
|
QueueFree();
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,5 @@ public partial class Settings : Node
|
||||||
public static double SFX = 1.0f;
|
public static double SFX = 1.0f;
|
||||||
public static double Music = 1.0f;
|
public static double Music = 1.0f;
|
||||||
public static bool Splash = false;
|
public static bool Splash = false;
|
||||||
|
public static bool SunClick = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue