Level Scene
The level scene is the heart of the game. This scene will manage all the different game objects and interactions.
Prerequisites
One of our game mechanics is the game speed, and it's important that every object can retrieve the current game speed. That's why we need to add two extra fields to the RenderContext
class, one for the current game speed and another one for the initial game speed.
public float GameSpeed { get; set; } public float InitialGameSpeed { get; set; }
Level Scene
Create a new class called LevelScene
that inherits from GameScene
.
public class LevelScene:GameScene
In the constructor, you need to pass the scene name to the base class, name it "Level
".
public LevelScene():base("Level"){}
We also need to add this GameScene
to the SceneManager
class in the Initialize
method of our MainGame
class.
SceneManager.AddGameScene(new LevelScene());
That's all we can do at the moment. Let's create some game objects so we can fill up this level scene.
Background
To give our game some extra...