This commit is contained in:
Simon Lübeß
2022-02-14 20:36:48 +01:00
parent c8cc2f442a
commit aa70d99e31
6 changed files with 29 additions and 12 deletions
+3
View File
@@ -6,3 +6,6 @@ Name = "Sandbox"
TargetType = "BeefGUIApplication"
StartupObject = "GlitchyEngine.Program"
ProcessorMacros = ["NOT_GAMMA_TEST", "SANDBOX_2D"]
[Platform.Windows]
IconFile = "$(ProjectDir)/content/RocketGame/RocketIcon.ico"
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+18 -7
View File
@@ -35,6 +35,8 @@ namespace Sandbox
FontRenderer.PreparedText pressSpaceToStart ~ _.ReleaseRef();
FontRenderer.PreparedText pressSpaceToRestart ~ _.ReleaseRef();
ColorHSV worldColor = .(0, 0.5f, 1.0f);
[AllowAppend]
public this() : base("Example")
{
@@ -88,7 +90,7 @@ namespace Sandbox
Vector4 v = .();
v.X = startRandom.Next(-1000, 1000) / 2000f * _camera.Width;
v.Y = startRandom.Next(-1000, 1000) / 2000f * _camera.Height;
v.Z = startRandom.Next(0, 999) / 1000.0f;
v.Z = startRandom.Next(0, 1000) / 2000.0f;
v.W = startRandom.Next(1000, 3000) / 1000.0f;
points[i] = v;
@@ -98,7 +100,12 @@ namespace Sandbox
private float lastObstacle = 0.0f;
public override void Update(GameTime gameTime)
{
{
worldColor.H += gameTime.DeltaTime * 18 * _rocket.FlightSpeed;
worldColor.H %= 360.0f;
ColorRGBA wColor = .((ColorRGB)worldColor, 1.0f);
float screenWidth = _camera.Width;
Obstacle.ScreenWidth = screenWidth / 2.0f;
@@ -147,19 +154,23 @@ namespace Sandbox
Renderer2D.BeginScene(_camera, .BackToFront);
Renderer2D.DrawQuad(Vector3(0, 2.75f, 1), Vector2(screenWidth, 1), 0, .White);
Renderer2D.DrawQuad(Vector3(0, 2.75f, 1), Vector2(screenWidth, 1), 0, wColor);
Renderer2D.DrawQuad(Vector3(0, -2.75f, 1), Vector2(screenWidth, 1), 0, .White);
Renderer2D.DrawQuad(Vector3(0, -2.75f, 1), Vector2(screenWidth, 1), 0, wColor);
for (Obstacle obs in _obstacles)
{
obs.Draw();
obs.Draw(wColor);
}
_rocket.Draw();
FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0, 1.5f, 1, .Black);
FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0.1f, 1.6f, 1, .(230, 230, 230));
var scorePrep = FontRenderer.PrepareText(_font, scope $"{_rocket.Score}", 1.0f);
FontRenderer.DrawText(scorePrep, -scorePrep.AdvanceX / 2, 1.5f, .Black);
FontRenderer.DrawText(scorePrep, -scorePrep.AdvanceX / 2 + 0.1f, 1.6f, .(230, 230, 230));
scorePrep.ReleaseRef();
if (!_rocket.Started)
{
+3 -3
View File
@@ -31,16 +31,16 @@ namespace Sandbox
static Matrix mat = Matrix.Scaling(2.5f, 5, 1) * Matrix.RotationZ(MathHelper.PiOverFour);
public void Draw()
public void Draw(ColorRGBA color)
{
Matrix matty = mat;
matty.Translation.X = Position.X;
matty.Translation.Y = Position.Y - HoleSize;
Renderer2D.DrawQuad(matty, Color.White);
Renderer2D.DrawQuad(matty, color);
matty.Translation.Y = Position.Y + HoleSize;
Renderer2D.DrawQuad(matty, Color.White);
Renderer2D.DrawQuad(matty, color);
}
}
}
+2 -2
View File
@@ -138,11 +138,11 @@ namespace Sandbox
_speed = newSpeed;
_position = newPosition;
float ang = Math.Atan2(_speed.Y, 10) - MathHelper.PiOverTwo;
float ang = Math.Atan2(_speed.Y, 5) - MathHelper.PiOverTwo;
_rotation = ang;
_direction = Vector2.Normalize(_speed + .(10, 0));
_direction = Vector2.Normalize(_speed + .(5, 0));
_rocketLine = .(_position - _direction / 2.8f, _position + _direction / 2.4f);
}
+3
View File
@@ -18,6 +18,9 @@ namespace Sandbox
{
public this()
{
Window.Title = "Single Stage to Highscore";
Window.SetIcon("content/RocketGame/RocketIcon.ico");
/*#if GAMMA_TEST
PushLayer(new GammaTestLayer());
#elif SANDBOX_2D