Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Creating Scene of Game

Rodion edited this page Jul 11, 2018 · 1 revision

Creating Scene of Game

Scene is represents game level, menu, loading screen, etc.

  • Create new Class file in your project at Solution Explorer and name it e.g. "GameScene.cs"

Creating Class file

  • Add main using directives
using craftersmine.GameEngine.System;
using craftersmine.GameEngine.Content;
using craftersmine.GameEngine.Input;
using craftersmine.GameEngine.Utils;
  • Make class inherited from Scene
public class GameScene : Scene
{

}
  • Let's create GameScene constructor inside class body
public GameScene()
{
    this.Id = 0; // This id is scene key. With that key scene can be showed at game window
}
  • Let's set other scene background color
    • Firstly, add using System.Drawing; directive above other directives
    • Add line at class constructor body
this.SetBackgroundColor(Color.LightBlue);
  • Go to "MainWindow.cs" and add 2 lines into MainWindow constructor
this.AddScene(new GameScene()); // Adds scene at game window
this.ShowScene(0); // Shows lately added scene with assigned id

Now if you launch your project you're see light blue window instead black

Clone this wiki locally