ac9ts Active Member Licensed User Longtime User Sep 20, 2018 #1 When I start learning new concepts, I like to take examples and modify them to see how things work. I took HelloWorld_TileMap as a starting point. I wanted to see how to add a tiled background to it. I modified the hello world.json with a simple tile set. It all looks fine when loading it back into Tiled. In the Game class, I changed Code: Copy TileMap.Initialize(X2, File.DirAssets, "hello world.json", Null) to Code: Copy TileMap.Initialize(X2, File.DirAssets, "hello world.json", ivGround) The background is white (the gradient background sub was commented out). I'm not sure if it's the json file or my code. There are no errors displayed in the logs. I must be doing something simple but I can't seem to find it. Code is attached. Attachments BrokenHello.zip BrokenHello.zip 169.5 KB · Views: 637
When I start learning new concepts, I like to take examples and modify them to see how things work. I took HelloWorld_TileMap as a starting point. I wanted to see how to add a tiled background to it. I modified the hello world.json with a simple tile set. It all looks fine when loading it back into Tiled. In the Game class, I changed Code: Copy TileMap.Initialize(X2, File.DirAssets, "hello world.json", Null) to Code: Copy TileMap.Initialize(X2, File.DirAssets, "hello world.json", ivGround) The background is white (the gradient background sub was commented out). I'm not sure if it's the json file or my code. There are no errors displayed in the logs. I must be doing something simple but I can't seem to find it. Code is attached.
Erel B4X founder Staff member Licensed User Longtime User Sep 21, 2018 #2 You need to do two things: 1. Call in Game.Tick: Code: Copy TileMap.DrawScreen(Array("Tile Layer 1"), GS.DrawingTasks) 2. Call in Game.DrawingComplete: Code: Copy Public Sub DrawingComplete TileMap.DrawingComplete End Sub Examples with tile map background: mario, monster truck and Tiles Map. I recommend you to start the game development with B4J. The test cycle is faster. You can later add B4A and B4i projects that reference the same modules.
You need to do two things: 1. Call in Game.Tick: Code: Copy TileMap.DrawScreen(Array("Tile Layer 1"), GS.DrawingTasks) 2. Call in Game.DrawingComplete: Code: Copy Public Sub DrawingComplete TileMap.DrawingComplete End Sub Examples with tile map background: mario, monster truck and Tiles Map. I recommend you to start the game development with B4J. The test cycle is faster. You can later add B4A and B4i projects that reference the same modules.