get background (hit area) animations working

This commit is contained in:
msk
2023-09-29 22:37:40 -07:00
parent 5a9278e8aa
commit 72e789c099
7 changed files with 114 additions and 36 deletions
+7 -5
View File
@@ -18,21 +18,22 @@ namespace WacK.Things.TunnelObjects
public partial class Background : Node
{
[Export]
private ColorRect firstSegment;
private List<ColorRect> segments = new(60);
private TextureRect firstSegment;
private List<TextureRect> segments = new(60);
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
var segmentsNode = FindChild("Segment Masks");
firstSegment.Visible = false;
segments.Add(firstSegment);
for (int i = 1; i < 60; ++i)
{
var n = (ColorRect)firstSegment.Duplicate();
var n = (TextureRect)firstSegment.Duplicate();
segmentsNode.AddChild(n);
segments.Add(n);
n.Name = i.ToString();
n.SetPosition(new Vector2(i * Constants.BASE_2D_RESOLUTION / 60, 0));
n.SetPosition(new Vector2(i * Constants.BASE_2D_RESOLUTION / 60, Constants.BASE_2D_RESOLUTION));
}
}
@@ -43,7 +44,7 @@ namespace WacK.Things.TunnelObjects
// GD.Print($"{direction} = {state}. Even? {size % 2 == 0}");
double timer = 0;
double time = .5f;
double time = .1f;
int centerSeg = pos + size/2;
while (timer < time)
@@ -79,6 +80,7 @@ namespace WacK.Things.TunnelObjects
}
await ToSignal(GetTree(), "process_frame");
}
GD.Print("Finished BG anim!");
}
}
}
+3 -3
View File
@@ -23,7 +23,7 @@ namespace WacK.Things.TunnelObjects
{
longThing = new Node2D();
holdScroll.AddChild(longThing);
longThing.Position = new Vector2(0, (float)-holdNoteData.time * Play.scrollPxPerSec);
longThing.Position = new Vector2(0, (float)-holdNoteData.time * Play.ScrollPxPerSec);
if (holdNoteData.points.Count > 0)
{
@@ -31,7 +31,7 @@ namespace WacK.Things.TunnelObjects
float segmentPos = 0;
foreach (var (_, curNote) in holdNoteData.points)
{
var curLength = Play.scrollPxPerSec * (float)(curNote.time - lastHold.time);
var curLength = Play.ScrollPxPerSec * (float)(curNote.time - lastHold.time);
var segment = CreateSegment(lastHold, curNote);
longThing.AddChild(segment);
segment.Position = new Vector2(0, segmentPos);
@@ -50,7 +50,7 @@ namespace WacK.Things.TunnelObjects
{
float minuteSize = Constants.BASE_2D_RESOLUTION / 60;
var length = Play.scrollPxPerSec * (float)(destination.time - origin.time);
var length = Play.ScrollPxPerSec * (float)(destination.time - origin.time);
var verts = new Vector2[4];
int originPos;