Wednesday, July 28, 2010

Going Going Going Gaming

Well, I am still working on a Ninjas game tutorial from over at Flixel.org. There are some components of Flixel that are not currently working on Flixel Android, namely FlxTilemap. I spent a few days trying to work out all of the errors in the lines of code before deciding my brain already hurt and needed a rest, so I started working on modifying a random tile painter which works; however, I am still having issues translating the block collision detection, which caused my brain to hurt even more. I mean it looks simple enough:
[code]
for each (var existingBlock:FlxBlock in levelBlocks)
{
collisionWithExistingBlocks = existingBlock.overlaps(newRandomBlock);

if (collisionWithExistingBlocks) break;
}
++loopCount;
}
while (collisionWithExistingBlocks && loopCount < MAXIMUM_RANDOM_PLACEMENT_ATTEMPTS);

this.levelBlocks.add(this.add(newRandomBlock)); }
[/code]


Yeah so much for a simple translation, since the android / java sdk does not like the FOR EACH statement, so I tried a few variations of this theme, but to no avail


[code]
for(int i = 0; i < this.map.lastIndexOf(newRandomBlock); ++i)
//for(int i = this.map.indexOf(existingBlock); i < this.map.lastIndexOf(existingBlock); i++)
{
FlxBlock existingBlock = (FlxBlock) map.get(i);
collisionWithExistingBlocks = existingBlock.overlaps(newRandomBlock);
if (collisionWithExistingBlocks) break;
}

++loopCount;
}
while (collisionWithExistingBlocks && loopCount < MAXIMUM_RANDOM_PLACEMENT_ATTEMPTS);

this.map.add(this.add(newRandomBlock));
}
[/code]


So, I am waiting for that eureka! moment to happen in which suddenly the fog of why its not working correctly hits me and I say BUT of course, while I research Java For Loops. Unfortunately I cant use a =< method because thats a boolean not an int and the commented statement did not work either. So I am thinking the block arrays never collide since it never actual maps to the last block. I also tried FlxG.collideArrayLists(newRandomBlock, existingBlock) however, I can not set a break because that is not part of a loop it would seem, which will not let me compile. Maybe I will try it anyway and see if it implies a break inside of FlxG core. Do not know; however, I did add the enemies and working on fixing up the spark.png since a 1x1 pixel causes Android to do crazy things.

Also been playing around on the Storm8 games (ALL of them to be exact). I like the format of the development and the text of the game. Its a like a mini game I can play for 5 minutes an hour and then not touch it for 4 hours and then come back and be pleasantly surprised. Just a word of advice, not always having a HUGE hoard is not a bad thing. Your companions need to grow with your equipment lest you be unable to defeat other players. My Ninja horde is 50 strong and I only have enough equipment for 10, OUCH. However, in the Rock Band game, I have a band of 4 and enough equipment for all 4 members to dominate everyone. So equipment / abilities have to grow with the number of players in your horde or you can not defeat other players.

No comments:

Post a Comment