Here's a little demo featuring a Tiled tile map with a tile layer for the graphics and an object layer for building physics collision zones and storing properties.
Grab the ball and chuck it about, see the various collisions and scores printed out, set the debug flag in the code to see debug drawing and object info.
Thanks go to
@atilim for the initial tile stuff and Gideros collision example
and to
@ar2rsawseen for the main physics stuff and appcodingeasy.
All files including a gproj and the Tiled tmx are included.
cheers
evs
Comments
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon
cheers
evs
I've got a basic camera working with your example. It works great. I will have my complete platform game done within a couple weeks with all new original tile sets and sprites too.
Thanks again.
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon
@glennbjr I've downloaded the tileset from here http://code.google.com/p/pacman-in-love/source/browse/trunk/assets/sprites/tileset-platformer.png But I don't know if he is the real owner or not.
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon
Save a copy in its native .tmx format for future editing
and then from the File menu of Tiled choose export and select Lua as the format - Done!
HTH
cheers
evs
My apps: http://www.yummyyellow.com
I've recently been playing with Tiled and importing TileMaps into Gideros.
I'm having trouble wrapping my head around doing tile based collision detection. Ideally, I would like to be able to determine what tiles are near the player, and then follow through with some collision detection logic, rather than cycling through all the tiles or objects on the screen.
Alternatively, I'm thinking of outlining all of the obstacles with objects in an object layer, and then cycling through those with collision detection logic. This wouldn't be tile based I suppose, but the appearance of the map would come from the tile map I guess.
What have other people done? I'd like to figure this out, but I'm finding the tile map examples very confusing :S
EDIT: I should mention that I would like to avoid using Box2D for solving collisions, as it feels like that would be swatting a fly with a hammer so to speak.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
There was a tiled map library provided here that I improved upon which enabled me to do some cool stuff. I'll comment and post ASAP.
I liked the example above but need to have a bigger map which has a scrolling viewport/camera.
How did you manage to implement the camera? I have a tilemap which I have created box2d objects from the "Object" layer in the tilemap, and I can scroll this around according to my main character's sprite position, however the actual graphic tiles which are on the "Tiles" layer remain fixed to the screen. Is there a way to link or group the layers? or do they need to be moved at the same time?
Any help or code would be great.
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon