This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Scene of Game
Rodion edited this page Jul 11, 2018
·
1 revision
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"
- 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
- Firstly, add
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
craftersmine GameEngine. Made with ❤ by craftersmine © 2018
- Getting started
- Basics
- Creating main game window
- Making game able to launch
- Creating scene of game
- Creating and using game content packages
- Creating first game object
- Using event methods
- Using Keyboard input
- Using XInput gamepad input
- Using sounds in your game