you are suppose to pass the tile number in x direction and y direction and not the x and y position or point the easiest way to do so is divide x and y position with tile width and height and use math.floor
you are suppose to pass the tile number in x direction and y direction and not the x and y position or point the easiest way to do so is divide x and y position with tile width and height and use math.floor
I find out that you are right
however I can't get the x and y position of the tile, and how can I get the tilemap instance of the tile ? please help
1. Have an offset this is to take care of two issues, one as albert mentioned of moving tilemaps and the other if the tiles are not full screen, i.e. could have some space from the top of the left, the offsetX and offsetY can be used to cater for that.
how should be but under Gideros Player on Android and as a standalone exported APK? Under Windows Gideros Player seems that we have good values (1,1) [EDIT: I've recently thought that there is also buggy] Anyway there are different values on real device and under Windows... Tested on Gideros Mobile SDK 2012.09.10.
Comments
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Not work well
should I use PRE_SOLVE event to detect whether the hero contact the rock?
Games: Android
you are suppose to pass the tile number in x direction and y direction and not the x and y position or point the easiest way to do so is divide x and y position with tile width and height and use math.floor
level.lua:132: attempt to call method 'clearTile' (a nil value)
Games: Android
at the other hand are you using this one http://giderosmobile.com/forum/discussion/999/tiled-example-with-tile-layer-object-layer-and-box2d-collisions#Item_19
?
that's impossible
@hgvyas123
I'm sure Tilemap is not nil because I can get object from it and determine whether it's a rock
may be I'm not code right
Games: Android
you are suppose to pass the tile number in x direction and y direction and not the x and y position or point the easiest way to do so is divide x and y position with tile width and height and use math.floor
I find out that you are right
however I can't get the x and y position of the tile, and how can I get the tilemap instance of the tile ? please help
Games: Android
and as i asked b4 r u using this?
http://giderosmobile.com/forum/discussion/999/tiled-example-with-tile-layer-object-layer-and-box2d-collisions#Item_19
The reason I ask is that if you can use the Tilemap to determine if the tile is a rock then surely you can just clear the tile you just interrogated.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
@hgvyas123
yes, I used that but not the extactly same
@Scouser
I determine it's a rock by its type
thanks u guys~
Games: Android
put this function in tiled_map
at the end of the init hold all your maps reference like
myMap:clearTileAt(math.ceil(event.x/32),math.ceil(event.y/32))
where 32 is width and height of my tile
my mistake floor gives little different value
Games: Android
in my example i had copied and pasted code from my test project where i am removing tile on the touch event
1. Have an offset this is to take care of two issues, one as albert mentioned of moving tilemaps and the other if the tiles are not full screen, i.e. could have some space from the top of the left, the offsetX and offsetY can be used to cater for that.
2. You could have a look at these articles for more information
http://howto.oz-apps.com/2012/11/games-with-grids-tilemaps.html
http://howto.oz-apps.com/2012/12/working-with-grids-part-ii.html
Likes: hgvyas123
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
thank you guys~the problem solved!!
Games: Android
have you noticed that
Anyway there are different values on real device and under Windows...
Tested on Gideros Mobile SDK 2012.09.10.
https://play.google.com/store/apps/developer?id=My+name+is+Originality