mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-31 00:05:02 -07:00
Added platform generator class to platform.cs.
This commit is contained in:
@@ -63,16 +63,6 @@ namespace LunaLightXMG
|
||||
random = new Random(42);
|
||||
}
|
||||
|
||||
private void OnClientSizeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
if (!resizing && Window.ClientBounds.Width > 0 && Window.ClientBounds.Height > 0)
|
||||
{
|
||||
resizing = true;
|
||||
CalculateRenderDestination();
|
||||
resizing = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
// Set initial window size
|
||||
@@ -87,71 +77,8 @@ namespace LunaLightXMG
|
||||
// Play music
|
||||
PlayBackgroundMusic(sinkBeats);
|
||||
|
||||
// Test initialize platforms -- this should be abstracted to a class
|
||||
// Also, I'm assuming using a tool like tiled will prevent having to
|
||||
// manually input platforms like below...
|
||||
platforms = new Platform[]
|
||||
{
|
||||
// platforms
|
||||
new Platform(new Vector2(48, 128), 16, 16),
|
||||
new Platform(new Vector2(64, 128), 16, 16),
|
||||
new Platform(new Vector2(96, 96), 16, 16),
|
||||
new Platform(new Vector2(112, 96), 16, 16),
|
||||
new Platform(new Vector2(192, 128), 16, 16),
|
||||
new Platform(new Vector2(208, 128), 16, 16),
|
||||
new Platform(new Vector2(240, 96), 16, 16),
|
||||
new Platform(new Vector2(256, 96), 16, 16),
|
||||
new Platform(new Vector2(192, 64), 16, 16),
|
||||
new Platform(new Vector2(208, 64), 16, 16),
|
||||
new Platform(new Vector2(144, 32), 16, 16),
|
||||
new Platform(new Vector2(160, 32), 16, 16),
|
||||
new Platform(new Vector2(288, 128), 16, 16),
|
||||
new Platform(new Vector2(16, 96), 16, 16),
|
||||
|
||||
// bottom
|
||||
new Platform(new Vector2(16, 160), 16, 16),
|
||||
new Platform(new Vector2(32, 160), 16, 16),
|
||||
new Platform(new Vector2(48, 160), 16, 16),
|
||||
new Platform(new Vector2(64, 160), 16, 16),
|
||||
new Platform(new Vector2(80, 160), 16, 16),
|
||||
new Platform(new Vector2(96, 160), 16, 16),
|
||||
new Platform(new Vector2(112, 160), 16, 16),
|
||||
new Platform(new Vector2(128, 160), 16, 16),
|
||||
new Platform(new Vector2(144, 160), 16, 16),
|
||||
new Platform(new Vector2(160, 160), 16, 16),
|
||||
new Platform(new Vector2(176, 160), 16, 16),
|
||||
new Platform(new Vector2(192, 160), 16, 16),
|
||||
new Platform(new Vector2(208, 160), 16, 16),
|
||||
new Platform(new Vector2(224, 160), 16, 16),
|
||||
new Platform(new Vector2(240, 160), 16, 16),
|
||||
new Platform(new Vector2(256, 160), 16, 16),
|
||||
new Platform(new Vector2(272, 160), 16, 16),
|
||||
new Platform(new Vector2(288, 160), 16, 16),
|
||||
|
||||
// left side
|
||||
new Platform(new Vector2(0, 0), 16, 16),
|
||||
new Platform(new Vector2(0, 16), 16, 16),
|
||||
new Platform(new Vector2(0, 32), 16, 16),
|
||||
new Platform(new Vector2(0, 48), 16, 16),
|
||||
new Platform(new Vector2(0, 64), 16, 16),
|
||||
new Platform(new Vector2(0, 80), 16, 16),
|
||||
new Platform(new Vector2(0, 96), 16, 16),
|
||||
new Platform(new Vector2(0, 112), 16, 16),
|
||||
new Platform(new Vector2(0, 128), 16, 16),
|
||||
new Platform(new Vector2(0, 144), 16, 16),
|
||||
|
||||
// right side
|
||||
new Platform(new Vector2(304, 0), 16, 16),
|
||||
new Platform(new Vector2(304, 16), 16, 16),
|
||||
new Platform(new Vector2(304, 32), 16, 16),
|
||||
new Platform(new Vector2(304, 48), 16, 16),
|
||||
new Platform(new Vector2(304, 64), 16, 16),
|
||||
new Platform(new Vector2(304, 80), 16, 16),
|
||||
new Platform(new Vector2(304, 96), 16, 16),
|
||||
new Platform(new Vector2(304, 112), 16, 16),
|
||||
new Platform(new Vector2(304, 128), 16, 16),
|
||||
new Platform(new Vector2(304, 144), 16, 16)
|
||||
};
|
||||
// Generate random platforms - test this idea out...
|
||||
platforms = PlatformGenerator.CreatePlatforms(14);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +96,7 @@ namespace LunaLightXMG
|
||||
// Spawn 10 enemies at the start of the level
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 spawnPosition = new Vector2(16 + i*3,16);
|
||||
Vector2 spawnPosition = new Vector2(16 + i*3,-16);
|
||||
Enemy enemy = new Enemy(spawnPosition, GetRandomValueBetween1And3());
|
||||
enemy.LoadContent(Content);
|
||||
enemies.Add(enemy);
|
||||
@@ -257,6 +184,16 @@ namespace LunaLightXMG
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClientSizeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
if (!resizing && Window.ClientBounds.Width > 0 && Window.ClientBounds.Height > 0)
|
||||
{
|
||||
resizing = true;
|
||||
CalculateRenderDestination();
|
||||
resizing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateRenderDestination()
|
||||
{
|
||||
Point size = GraphicsDevice.Viewport.Bounds.Size;
|
||||
|
||||
Reference in New Issue
Block a user