Map for broser game uisng php/ Jquery
Posted: Fri Aug 17, 2012 1:09 pm
Greeting to all.
This i one piece of code that i have finished these days. It is map for browser based game, bit different than maps that are used in halls tutorials. it is nothing special, but someone could find something usefully there.
Map is loaded from Tiled file format, with CSV type of data. Data about tiles is not loaded from big file , it loads tiles from individual files. It can be for sure modified to be used with similar Tile map formats from other programs. Only modification is that i have removed end of lines in layer where tile codes are kept, because it have made problems with generating of map.
Code reads one big map,but show only defined window. Using cursor key on keyboard you move player over the scree. When player crosses edge whole screen moves in that direction.
I have not shown code in post, instead i have included whole code and tiles as attachment. Just unpack in web server directory and start map_example.php. Code is independent from database but can be easily connected to.
There are lot of area for improvement, if I do something major i will post it. Also if someone can make it cleaner code, universal or better, can post it here for all users.
Edit: Was long absent from forum, uploaded again code.
This i one piece of code that i have finished these days. It is map for browser based game, bit different than maps that are used in halls tutorials. it is nothing special, but someone could find something usefully there.
Map is loaded from Tiled file format, with CSV type of data. Data about tiles is not loaded from big file , it loads tiles from individual files. It can be for sure modified to be used with similar Tile map formats from other programs. Only modification is that i have removed end of lines in layer where tile codes are kept, because it have made problems with generating of map.
Code reads one big map,but show only defined window. Using cursor key on keyboard you move player over the scree. When player crosses edge whole screen moves in that direction.
I have not shown code in post, instead i have included whole code and tiles as attachment. Just unpack in web server directory and start map_example.php. Code is independent from database but can be easily connected to.
There are lot of area for improvement, if I do something major i will post it. Also if someone can make it cleaner code, universal or better, can post it here for all users.
Edit: Was long absent from forum, uploaded again code.