|
Post by nemezes on Dec 9, 2019 7:50:02 GMT -5
I take the code from here: smd.originalvgo.com/smd/viewtopic.php?f=6&t=19 and made some adaptations to work with imagenesis and SecondBASIC (port it to BEX is easy). I used the free program TILED to prepare my image to use. To convert using imagenesis, I use the option optimized. -> fundo_tile.bin was made using "export tile data" -> fundo_paleta.bin was made using "export palette data" -> fundo_tilemap.bin was made using "export tile map" as the background image is the same of collision map, to generate the collision map (fundo_colisao.bin) I used the same fundo_tilemap.bin you can turn on/off gravity by pressing B. when gravity is on, you can jump by pressing C. later I will try to add comments in english and to make an example with the background different from collision map. all comments in the code are in portuguese. here is a video preview: Attachments:codigo plataforma v5.zip (178.41 KB)
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 9, 2019 13:21:16 GMT -5
Nice demo! The creator of SecondBASIC made a blog entry on how to utilize collision maps efficiently using a 1D a array that's separate from a background map: www.second-dimension.com/blog/8/You can also create a collision map if your tiles are ordered properly (my favorite way to do it as it's 1 map). For example, suppose you have 10 floor tiles (can jump through from the bottom) and 10 wall tiles (where you clonk your head). You pull the (x,y) of the camera + character to read the map data. Now suppose your floor and wall tiles are tile numbers 1 through 20 (1-10 = floor, 11-20 = wall): ' maths to get your camera position in relation to the map (stored in the offset variable, generally y*MaxX+x+CharX) Reload MyMap, offset ReadInt FloorTileNum
If FloorTileNum > 0 and FloorTileNum <= 20 Then gravity = 0 ' or walking, if this is part of your walk routine)
|
|