- Create a new folder called
TestGame
(or whatever) inside the BBDK/Games
folder.
- Create 2 more folders inside
Games/TestGame
: Scripts
and Resources
. These folders aren't necessary, they're just for organization.
- Create a file called "Main.cs" inside
TestGame/Scripts
.
namespace Games.TestGame
{
[GameInfo(
Title = "TestGame",
AuthorName = "YourName",
AuthorContact = "your@email.com",
UpdateRate = 60
)]
[GraphicsInfo(Width = 256, Height = 192)]
public class Main : Game
{
}
}
You should now be able to choose your game from the drop down list when running the BBDK. Nothing will happen yet though, it should just show a black screen. If you are on Linux or Mac OS X and get a SystemException, make sure you have installed the Mono runtime.
- We'll now create a new Stage for the game. Stages are like Unity's Scenes, used to represent different levels or modes in a game. Create
GameStage.cs
in the TestGame/Scripts
folder:
using System.Collections.Generic;
namespace Games.TestGame
{
public class GameStage : Stage
{
public GameStage(Main game) : base(game)
{
Debug.Log("GameStage created");
}
protected override void OnEnter()
{
Debug.Log("GameStage entered");
}
protected override void OnUpdate()
{
base.OnUpdate();
}
protected override void OnRender()
{
base.OnRender();
}
}
}
- Edit
Main.cs
so that the game starts with the GameStage.
public class Main : Game
{
protected override void OnReset()
{
SetStage(new GameStage(this));
}
}
- Turn on the BBDK's console (the
>_
button on the left side) so you can see the debug messages and know that the game is in fact working, despite nothing showing up.
Back to Index :: Next Page