Can't Test Game
opened this issue · comments
So, when I try to test the game, it pops up an error saying:
"source/Main.hx:15: characters 35-49 : Type not found : GJToastManager"
is there any way to fix this?
Heres the code:
`package;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxState;
import openfl.Assets;
import openfl.Lib;
import openfl.display.FPS;
import openfl.display.Sprite;
import openfl.events.Event;
import GameJolt.GameJoltAPI;
class Main extends Sprite
{
public static var gjToastManager:GJToastManager; // Mmm crispy toast
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
var initialState:Class = TitleState; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var framerate:Int = 60; // How many frames per second the game should run at.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
public static var fpsVar:FPS;
public static var gjToastManager:GJToastManager;
public static function main():Void
{
Lib.current.addChild(new Main());
}
public function new()
{
super();
if (stage != null)
{
init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
private function init(?E:Event):Void
{
if (hasEventListener(Event.ADDED_TO_STAGE))
{
removeEventListener(Event.ADDED_TO_STAGE, init);
}
setupGame();
}
private function setupGame():Void
{
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;
gjToastManager = new GJToastManager();
addChild(gjToastManager);
if (zoom == -1)
{
var ratioX:Float = stageWidth / gameWidth;
var ratioY:Float = stageHeight / gameHeight;
zoom = Math.min(ratioX, ratioY);
gameWidth = Math.ceil(stageWidth / zoom);
gameHeight = Math.ceil(stageHeight / zoom);
}
#if !debug
initialState = TitleState;
#end
ClientPrefs.loadDefaultKeys();
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
#if !mobile
fpsVar = new FPS(10, 3, 0xFFFFFF);
addChild(fpsVar);
if(fpsVar != null) {
fpsVar.visible = ClientPrefs.showFPS;
}
#end
#if html5
FlxG.autoPause = false;
FlxG.mouse.visible = false;
#end
}
}`
you only need to do import Gamejolt;
, not import GameJolt.GameJoltAPI;
*fixed the error in the readme.md, my bad