Int must be Bool



  • I want to make a game with at least two levels. To that end, I wrote a function to check the value of currentRoom, which can apparently only be a boolean if I want to use it with FlxOgmo3Loader. Why is that? Ogmo Loader

    		var room:FlxOgmo3Loader;
    
    		if (currentRoom = true)```
    
    When I tried making currentRoom an int, Code informed me that "Int should be Bool".


  • I think the best people to answer that question are either Austin East and Will Blanton who have both worked on Ogmo. They frequent the HaxeFlixel Discord channel so if you have access to it I highly suggest you ask your question there.

    https://discord.gg/Bqr8YW



  • @jgedri said in Int must be Bool:

    To that end, I wrote a function to check the value of currentRoom, which can apparently only be a boolean if I want to use it with FlxOgmo3Loader

    What exactly do you mean by this? is this a property you are trying to add in the editor for a level or a restriction when using the code FlxOgmo3Loader? I'll need more info to help



  • It's a property I want to add in the editor.

    	{
    		var currentRoom:Bool;
    		var room:FlxOgmo3Loader;
    
    		if (currentRoom = true)
    		{
    			// Load the first map
    			room = new FlxOgmo3Loader(AssetPaths.turnBasedRPG__ogmo, AssetPaths.room_001__json);
    		}
    		else
    		{
    			// Load the second map
    			room = new FlxOgmo3Loader(AssetPaths.turnBasedRPG__ogmo, AssetPaths.room_002__json);
    		}
    	}


  • @jgedri
    the Int should be Bool error is because in your if you're assigning currentRoom = true, not checking the equality. You need ==

    if (currentRoom == true)



  • Sweet! Though Int is obviously better if the project ends up having more than three levels.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.