Java Tiled Map Game (LibGDX) | Episode 7 - object layers

preview_player
Показать описание
Welcome to the last episode of the mini tutorial series about tile maps in LibGDX.
This time, we'll create some objects in an object layer and render their shapes. This can be used to do pretty much anything, let out your creativity.

Thanks a lot for watching this series, I hope it was helpful to you! :)

Рекомендации по теме
Комментарии
Автор

Sure. You'd have to put the images in the object properties using Strings or something to describe which image should be drawn. Then you can render them by setting their bounds to those of the rectangle of a map object.

dermetfan
Автор

Thank you for the Series!!

A lot of useful information and sample game code for programmers trying to get into the gaming realm!

donjuan
Автор

Yes, just check with which kind of tile you collide, so for example if it has a coin property. If so, give the player one coin and remove the coin using cell.setTile(null) or in case you have an air tile, cell.setTile(airTile).
It's basically the same idea as in my reply to JJStuffEngineering's comment.

dermetfan
Автор

Tiles don't have a visibility property. You could get the cell, save the tile that is in it, put a transparent/background tile in and later put the normal tile back in.

dermetfan
Автор

Map layers are always a grid. In each cell, there CAN be a tile.
To remove a block, you could use layer.getCell(x, y).setTile(null) or put an air tile in. To place blocks, just put another tile like grass in the cell: layer.getCell(x, y).setTile(grassTile).
It makes no difference if the map was generated or not.

dermetfan
Автор

i'm very glad that you've uploaded it :-)

Roman
Автор

Dermet i finnally arrived at the 7th video!!!
Great series as the main one!
SO if i want to join box2D and Tiled, i should use that topic as a "tutorial", right? Because othwerwise will be a pain. Im just unsure how to mix collision of box2d with collision of tiled, but i guess the tutorial explain that!

YAY LETS GO READ!

EverlastingSky
Автор

ok thank you :3, actually i made it wait until the deltatime gets to the average number then start the game, & it worked well, thanks for those good tutos dude

IsmaelBirje
Автор

hmm yeah it seems like it was cause because the camera had decimals... I cast them to int seems to have been fixed . Thank you for replying (even though I kind of didn't check and was coming back here to say what I found) but still thx again (you've helped me soooo many times... I feel like I should be helping you somehow...)

YumIsHere
Автор

Maybe you could use two cameras for parallax scrolling. You'd have to move the cameras to let the background scroll. Set the view of the tiled map renderer to the first camera and render. Then, set it to the second camera and render again. The second camera would have to be positioned right after the first camera's right viewport edge. If the second camera is too far left so you can see a black border, the first camera goes after the second one, and so on. I didn't try it but that's my idea.

dermetfan
Автор

Yes, take the closed-door tiles out and and put the open-door tiles in, player walks through, put the closed-door tiles back in.

dermetfan
Автор

You probably forgot to check if getCell returned null. Because Android devices are slower, the player could fall through the ground because of a big delta on the first few updates (this is called "tunneling"). You could clamp the delta or set the player position later.

dermetfan
Автор

thanks, great tutorials..
is it possible to use TiledMaps for Parallax scrolling. I just want to repeat background (start again from begining of map) when my actor comes to the end of the map. I saw ParallaxBackground class in libgdx forums but i couldn't find any way to use that with Tiledmap. and of course i am not sure it is the best way for this kind of games?

thesadoman
Автор

you're tutorials are really helping me a lot and i'm learning a lot.
i have some question and i hope you'll answer :)
can i add a mouselistener to an object? if no, is there anyway that i can add a sprite or something that will allow me to click it while rendering the tiled map? i really thank you for your tutorials. :)

beginner-dvrm
Автор

I zoomed in a little bit but sure I can zoom in some more. Thanks for the feedback.

dermetfan
Автор

Is it possible to change the visibility of a tile when the player collides with a tile with a property such as "button"? I want to be able to have the player run over a button tile some tiles will disappear to create a door.

jijik
Автор

Would that work for say i had a door that is closed so i cannot go through it but when i click the button i could go through the door?

jijik
Автор

thank you for making this, it's gonna be a big help

gonzo
Автор

Muy buena tu serie de tutoriales! Me ayudaron mucho! Saludos desde Argentina!!!


Very good your tutorial series! They helped me a lot! Greetings from Argentina! Sorry for my English!

memaluna
Автор

is it possible to use an image object in Tiled Map Editor and then following the same approach described in this video render them?

natalio