Unable to load objects to level 2

23 views
Skip to first unread message

Prash

unread,
Jul 10, 2015, 10:04:56 AM7/10/15
to haxef...@googlegroups.com
Hey everyone, I am a beginner. I am trying to make a platformer game with 2 levels. I made the tilemaps using tiled and exported them to csv format. I used the csv files to load objects as well. The first level is working fine but the second level isn't. The second level is loaded and displayed but when I try to load the player or anything else, I get a black screen. I have attached the source code and the two maps.This is how I load the objects.
function addObjects():Void
   
{
        coins
= new FlxGroup();
        add
(coins);
        enemies
= new FlxGroup();
        add
(enemies);
       
var objectData:String = Assets.getText("assets/data/Oj_"+Reg.stage+".csv");
       
var rows:Array<Dynamic> = objectData.split("\n");
       
for (y in 0...rows.length) {
           
var objectsString:Array<Dynamic> = rows[y].split(",");
           
var objects:Array<Dynamic> = new Array();
           
for (i in 0...objectsString.length) objects.push(Std.parseInt(objectsString[i]));
           
for (x in 0...objects.length)
           
{
               
switch (objects[x])
               
{
                   
case 896 : addPlayer(x,y);
                   
case 897 :addCoin(x,y);
                   
case 898 :addDumbEnemy(x,y);
                   
case 899 :addExit(x,y);
                   
//case 900 :addFlyingEnemy(x,y);
               
}
           
}
       
}
   
}




Game.tar.gz
Map_1.tmx.tar.gz
Map_2.tmx.tar.gz
Reply all
Reply to author
Forward
0 new messages