Author Topic: Tilemapper acting odd.  (Read 2346 times)

0 Members and 1 Guest are viewing this topic.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Tilemapper acting odd.
« on: December 17, 2013, 11:22:19 pm »
I'm writing a game in HaXe.  But really any language expertise is needed to figure this out.  Its something in my logic.

My problem is that one level (01.level) loads correctly, but another (02.level) does not.  Screenshots below.

02.level

01.level


The files
Spoiler For 01.level:
Code: [Select]
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,2,0,0,0,0,0,0,1,3,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,1
1,9,0,0,1,1,1,1,1,0,1,0,1,1,1,1,0,1,0,1
1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1
1,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1
1,3,1,0,1,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1
1,0,1,0,0,0,1,0,1,0,0,4,0,0,0,0,0,0,0,1
1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1
1,0,0,4,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1
1,0,0,0,0,0,0,0,0,4,0,0,0,0,0,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Spoiler For 02.level:
Code: [Select]
11111111111111111111
19111111000011000311
10100000011011010001
10101111131000011001
10001100001111111001
11111101100001111011
11160000000000001001
11111101101101111011
11000101101001111001
11010001101011111101
11011111111000000101
12011111111111110001
11111111111111111111

Now they look different, but it parses both correctly.

The code I have is the following
Code: [Select]
function drawMap() {
var psudoi:Int = 0;
var psudox:Int = 0;
var psudoy:Int = 0;
for (i in 0...map.getMap().length) {
if (i > 20*psudoy-1) {
psudoy = psudoy + 1;
psudox = 0;
}
if (map.getMap()[i] == 1) {
add(new Block(psudox*32,(psudoy-1)*32));
}
if (map.getMap()[i] == 2) {
add(new Player(psudox*32,(psudoy-1)*32));
}
if (map.getMap()[i] == 3) {
add(new Enemy(psudox*32,(psudoy-1)*32,2));
}
if (map.getMap()[i] == 4) {
add(new Enemy(psudox*32,(psudoy-1)*32,0));
}
if (map.getMap()[i] == 6) {
add(new Enemy(psudox*32,(psudoy-1)*32,1));
}
if (map.getMap()[i] == 9) {
add(new EndPortal(psudox*32,(psudoy-1)*32));
}
psudox = psudox + 1;
}
}

It works for one, but the other no.  Am I just getting lucky with one?  I only have 2 of the 15 or 30 levels done, so I can't try another.
EDIT IM AN IDIOT
« Last Edit: December 17, 2013, 11:53:11 pm by XVicarious »