Ogmo Tilemap not showing in the game

Viewed 27

So I am doing the haxe flixel TurnBasedRPG tutorial I am pretty much a noob so I wont be surprised if this is just a stupid mistake I did. But when I try to put my ogmo tilemap into the game, it doesnt show Here is my Playstate.hx file

package;

import flixel.FlxG;
import flixel.FlxState;
import flixel.addons.editors.ogmo.FlxOgmo3Loader.EntityData;
import flixel.addons.editors.ogmo.FlxOgmo3Loader;
import flixel.tile.FlxTilemap;

class PlayState extends FlxState
{
    var player:Player;
    var map:FlxOgmo3Loader;
    var walls:FlxTilemap;

    override public function create()
    {
        map = new FlxOgmo3Loader(AssetPaths.HaxeFlixel_Tutorial__ogmo, AssetPaths.level_1__json);
        walls = map.loadTilemap(AssetPaths.tiles__png, "walls");
        walls.follow();
        walls.setTileProperties(1, NONE);
        walls.setTileProperties(2, ANY);

        player = new Player();
        map.loadEntities(placeEntities, "entities");
        add(walls);
        add(player);
        super.create();
    }

    function placeEntities(entity:EntityData)
    {
        if (entity.name == "player")
        {
            player.setPosition(entity.x, entity.y);
        }
    }

    override public function update(elapsed:Float)
    {
        super.update(elapsed);
        FlxG.collide(player, walls);
    }
}

Player.hx:

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.math.FlxPoint;
import flixel.util.FlxColor;

class Player extends FlxSprite
{
    static inline var SPEED:Float = 200;

    public function new(x:Float = 0, y:Float = 0)
    {
        super(x, y);
        loadGraphic(AssetPaths.player__png, true, 16, 16);
        drag.x = drag.y = 1600;
        setSize(8, 8);
        offset.set(4, 4);
        setFacingFlip(LEFT, false, false);
        setFacingFlip(RIGHT, true, false);
        animation.add("lr", [3, 4, 3, 5], 6, false);
        animation.add("u", [6, 7, 6, 8], 6, false);
        animation.add("d", [0, 1, 0, 2], 6, false);
    }

    function updateMovement()
    {
        var up:Bool = false;
        var down:Bool = false;
        var left:Bool = false;
        var right:Bool = false;
        var newAngle:Float = 0;

        right = FlxG.keys.anyPressed([RIGHT, D]);
        down = FlxG.keys.anyPressed([DOWN, S]);
        left = FlxG.keys.anyPressed([LEFT, A]);
        up = FlxG.keys.anyPressed([UP, W]);

        if (up || down || left || right)
        {
            if (up && down)
            {
                up = down = false;
            }

            if (left && right)
            {
                left = right = false;
            }

            if (up)
            {
                newAngle = -90;
                if (left)
                    newAngle -= 45;
                else if (right)
                    newAngle += 45;
                facing = UP;
            }
            else if (down)
            {
                newAngle = 90;
                if (left)
                    newAngle += 45;
                else if (right)
                    newAngle -= 45;
                facing = DOWN;
            }
            else if (left)
            {
                newAngle = 180;
                facing = LEFT;
            }
            else if (right)
            {
                newAngle = 0;
                facing = RIGHT;
            }

            // determine our velocity based on angle and speed
            velocity.set(SPEED, 0);
            velocity.rotate(FlxPoint.weak(0, 0), newAngle);

            // if the player is moving (velocity is not 0 for either axis), we need to change the animation to match their facing
            if ((velocity.x != 0 || velocity.y != 0) && touching == NONE)
            {
                switch (facing)
                {
                    case LEFT, RIGHT:
                        animation.play("lr");
                    case UP:
                        animation.play("u");
                    case DOWN:
                        animation.play("d");
                    case _:
                }
            }
        }
    }

    override function update(elapsed:Float)
    {
        updateMovement();
        super.update(elapsed);
    }
}


If you want to see any other file please ask me because I have been stuck on this for 3 hours now

0 Answers
Related