Invalid field access : add - Tutorial part 8 error



  • Hi, I'm relatively new to programming and have just started following the tutorial for HaxeFlixel. Everything has been going great so far but I've been stuck on part 8 with the coins because I keep getting an error regarding the placeEntities function. Here is how I have it set up, as I interpreted from the tutorial:

    function placeEntities(entityName:String, entityData:Xml):Void {
    var x:Int = Std.parseInt(entityData.get("x"));
    var y:Int = Std.parseInt(entityData.get("y"));
    if (entityName == "player") {
    _player.x = x;
    _player.y = y;
    } else if (entityName == "coin") {
    _grpCoins.add(new Coin(x + 4, y + 4));
    }
    }

    I have tried changing things, I have looked over everything in the tutorial and compared to how I typed out to ensure there aren't any small typos or anything but I can't figure out what's wrong. I know it's probably going to end up being something really simple and stupid but it's really frustrating aha.



  • @revspennicus
    What does the error say? It might help to have a look at the complete source to compare what you have. And make sure you have all assets and data files in the right place, etc.

    https://github.com/HaxeFlixel/flixel-demos/tree/master/Tutorials/TurnBasedRPG


Log in to reply
 

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