Just wondering is this possible?
Right now i'm trying to create a maze like level for my game. I've read around that tiled is a nice tilemap and physics editor software but it seems rather too much since this is just a mini game which involves only one or two images for the design of the maze so i figured that tile maps wouldn't be that much used.
Is it possible to create a simple grid map using array in Gideros? Where 1 will be an image that a physics body can attach to while 0 will be a transparent image of the same size where there is no physics body (walkable path) So basically it's just 2 pics.
Comments
Not so related, but there were even pathfinding implementations in lua:
http://www.giderosmobile.com/forum/discussion/1081/jumper-very-fast-pathfinder-for-2d-grid-based-games
What i don't get right now is how to make the for loop go through all the values of the array. Would this work?
https://play.google.com/store/apps/details?id=com.debia.mobiledungeon
@unlying i've checked the screenshots looks real nice. How'd you do it? Using arrays like what i plan?
i have the code
I tried to create a collision event which will set the X and Y of the player object to the X and Y of the path in collision but it doesn't even trigger the collision.
And as for why collisions do not occur, then would need to see more code.
There are cases, that collisions do not occur between two static bodies, or between to sensors, but as I understood you have a dynamic body and static sensor, all should be working here.
And you set path body as isSensor = false, wasn't it supposed to be true?
And I think you should set fixedRotation to body and not the fixture.
i've set it to false just to test if the objects are hitting or something.
oh and collisions seems to be only working for "walls" in the most lowest part of the maze probably the last created by the for loop. Could it be possible the upper levels of the array are losing their body names? Because i've tried making a sensor body outside the for loop and it registers the collision even with the name "path"
Only thing comes to a mind, that I see you are reusing same shape for every object. Maybe internally each body needs it's own shape and not referencing to the same on?
Just and idea
Would it be possible to create a unique sprite in every loop? I tried to make sprite_name[i][j] but as expected it wouldn't work. I'm thinking that maybe if the path were given their own sprite and their sprites are given the same name then it could work
Nothing seems to be wrong there.
If you want you can post your project here or email it to me (my user name) at gmail.com and I can take a look. But I could only probably do it tomorrow.
What i find weird is how only the lowest layer of the array gets the names for their bodies while others even though they are supposed to have their own, lost theirs.