Sprite/Tile YSort effect and Camera Movement - Printable Version +- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum) +-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3) +--- Forum: Game development topics (http://tilengine.org/forum/forumdisplay.php?fid=13) +--- Thread: Sprite/Tile YSort effect and Camera Movement (/showthread.php?tid=575) |
Sprite/Tile YSort effect and Camera Movement - Uneven_Prankster - 05-06-2020 Currently, I have successfully managed to implement collision detection by making using of a TMX library (I advise loading collision objects be a future feature of Tilengine) however I have been unable to pull off a convincing enough in-front-of/behind effect for the protagonist and walls, as it makes use of layer priority, which only works so well while the protagonist is behind the upper part of the wall found in the prioritized layer. I suppose I may scrap having such situations at all for the better of continuing work without much hassle, but I am curious about doing this even then. Another thing is that I wish to implement a camera similar to that of games such as Earthbound. However, I am not skilled at this and therefore having it center around the character results in the position of the player being stored becoming inaccurate, which prevents collision detection from working correctly. I'm also curious about this. Example screenshot from Earthbound for the SNES. RE: Sprite/Tile YSort effect and Camera Movement - megamarc - 05-07-2020 Hi! I've moved this question to "Game development topics" because its topic is more about gameplay implementation than tilengine specific. What you're attempting is not the easiest of gameplay mechanics. Unlike pure 2D games (either sidescrolling or top-down), you're dealing with 3/4 perspective here, that's a form of pseudo-3D, or 2.5D. Here the Y axis combines both height and depth. Usually you have to split your map in two layers:
Perspective in Earthbound is even trickier, as the x axis is also affected with this front/back scheme depending on which side of an extruded object your player is (left is back, right is front). In broad sense, Tilengine is a graphics engine, not a game engine, so it doesn't feature gameplay-domain abstractions such as actors, player/level collisions, and so. The same concept as 2D graphic chipsets, they didn't provide these features (they just provided graphic output), it was the game code that implemented them. However Tilengine provides necessary tools to build these features on top of it. Tile-based gameplay don't usually require external collision data, as the collision information is stored in the tile itself, either in its ID or in its "type" standard property. Tilengine can already load "object" layers from Tiled (introduced in release 2.5.0), albeit it only loads "Tile" objects because it's the type of entity that Tilengine uses to draw object layers. Consider if free-form collision objects are the right tool for you task. As always, if you put code and assets, I can take a look at them RE: Sprite/Tile YSort effect and Camera Movement - Uneven_Prankster - 05-07-2020 (05-07-2020, 02:25 AM)megamarc Wrote: In broad sense, Tilengine is a graphics engine, not a game engine, so it doesn't feature gameplay-domain abstractions such as actors, player/level collisions, and so. The same concept as 2D graphic chipsets, they didn't provide these features (they just provided graphic output), it was the game code that implemented them. However Tilengine provides necessary tools to build these features on top of it. Tile-based gameplay don't usually require external collision data, as the collision information is stored in the tile itself, either in its ID or in its "type" standard property. Tilengine can already load "object" layers from Tiled (introduced in release 2.5.0), albeit it only loads "Tile" objects because it's the type of entity that Tilengine uses to draw object layers. Consider if free-form collision objects are the right tool for you task. I see! I think it's a bit easier for me to think of things by treating Tilengine more as a graphics API xD But yes, currently I would appreciate help with this type of tile scenario. I should also adjust the collision box better for when the protagonist is moving left or right. I am soon going to use the object layer for loading in bigger assets like in the Forest example and also as well NPCs. Beware you'll need to disable the TMX library both on source and makefile if you won't use it, or if you do, compile the library accordingly to what the Github project wants. It was a head pain for that... RE: Sprite/Tile YSort effect and Camera Movement - megamarc - 05-09-2020 Hi! Finally had time to check your post. Your "city.tmx" map doesn't contain any square object, is that right? I've checked that Tilengine since release 2.5.0 can directly load "Rectangle" object type out of the box, for that purpose you can discard libtmx entirely:
Assuming you have an object layer named "collisions", this is how to load its objects: Code: TLN_ObjectList list = TLN_LoadObjectList("city.tmx", "collisions"); The TLN_GetListObject() iterator is called in two different ways:
RE: Sprite/Tile YSort effect and Camera Movement - megamarc - 05-09-2020 Hi again! You may be interested on update 2.8.2, that enhances tmx compatibility loading. Check post here: http://www.tilengine.org/forum/showthread.php?tid=573&pid=1411#pid1411 |