Arcade
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Step 1: Getting Things Running
  • 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.
using GameAPI;
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;
using System.Collections.Generic;
using GameAPI;
namespace Games.TestGame
{
public class GameStage : Stage
{
// called when this stage is created
public GameStage(Main game) : base(game)
{
Debug.Log("GameStage created");
}
// called when this stage is entered
protected override void OnEnter()
{
Debug.Log("GameStage entered");
}
// called each tick
protected override void OnUpdate()
{
base.OnUpdate();
}
// called when this stage is rendered
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.
part1-1.png

Back to Index :: Next Page