Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Best way of animating parts of tilemaps, eg platforms? - Gideros Forum

Best way of animating parts of tilemaps, eg platforms?

snookssnooks Member
edited November 2017 in General questions
So I have a tilemap and want to draw platforms and other things that move or do stuff. I can have an object layer that defines a shape with a custom field that defines the tiles that make up the thing that's going to be removed, but then need to make those tiles into a sprite.

I'm stuck at the last part and wonder if there's a better solution to the first stages too? What's the ideas of the esteemed members of the board?


  • hgy29hgy29 Maintainer
    Why not just using regular Sprites for those dynamic objects ? I used tiled for my platformer and I mix tilemap layers and object layers. Tilemaps typically hold static platforms/scene environment and I put monsters and moving objects in object layers, which are loaded as regular sprites in gideros.

    Likes: oleg, antix

    +1 -1 (+2 / -0 ) Share on Facebook
  • If you code in the game logic to move from a background map to another map used for a platform then your platforms can actually be huge. They can even be used for huge monster sprites that scale several screens - the collision detection can also then be map based with can be more fine tuned than box or circle based.
  • I ideally want to make the most of the WYSIWYG of Tiled editing, so would like to see as much as possible and assembling platforms out of tilesets seems the easiest, graphically speaking, even if it's a bit of work setting it up.

    I don't understand what you mean @SinisterSoft about "moving" to another map. Are you thinking about scrollers where one leads onto another where they wouldn't be rendered on top of one another?
  • I think that it may not be easy to set up, but you could try using an object layer as placeholder for the platforms:
    Easy - import images in Sprite as suggested before (use object layer just to keep positions And properties - One of which may be the png)

    'Hard' - add a platform tile layer on top of the object layer, then for each object in the object layer check if it overlaps with this one (where you drew your platforms through tiles) and rendertarget your platforms into Sprite/box2d obj when loading the level.

    I believe that you can find something else to help you in some example around this forum. For starters I'd take a look at the tiled bump example made by antix some time ago: if I am not mistaken he had a way to generate 'boxes from tiles'

    Likes: antix

    +1 -1 (+1 / -0 ) Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    edited November 2017
    I mean rendering one on top of another - they are a single mesh in the end so they are fast. So if you had a huge dragon that has an eye that blinks then you could have it as a map then just change one map tile every 4 frames (they eye), the map can be used to have better than box collision detection, in the end it's a single mesh so drawing is fast, it will use a lot less texture space. For movable platforms you could then have huge platforms with everything on the platform relative to the platform. eg - coins, etc - have them part of the map - not objects. Only use sprites for small objects that have to move - like bullets, small monsters, etc...

    There will be less small objects that move, so you can then have an object to object collision system - this greatly enhances a game. EG with Mario, monsters can bump into each other, etc...
  • antixantix Member
    edited November 2017
    @snooks, I agree with @pie about using an object layer. I'm doing this with my platformer prototype..

    In tiled I have setup different object types. During the tiled draw in Gideros I process the object layer(s) to create a multitude of game objects...image
    As @pie also mentioned I made some code to create bump collision rectangles from a tiled map. The thread is here. The code isn't that efficient but you should get the gist of it :)

    Likes: hgy29

    1231 x 720 - 110K
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
    +1 -1 (+1 / -0 ) Share on Facebook
  • Thanks for all of the replies, interesting....

    I like the idea of keeping relative positions of objects on platforms using additional Tilemaps.

    I found this, which pretty much contains the code I need to convert tiles into sprites already, so it looks like all bases are covered. Thanks again!

  • @antix, are those grey lines next to platforms where they will move? If so, are they adjustable? If so, how the heck did you do that in Tiled? :)

    Likes: oleg

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 ) Share on Facebook
  • I find it best to have moving platforms working off a master 'clock' rather than moving using their own offset. That way you only have to adjust one thing and everything is always in sync. Unless of course it's a moving platform that only moves if the player is on it.
  • @snooks I looked at TiledAsAWorldEditor and I use a similar system.

    @SinisterSoft that sounds interesting.. having just one clock. I might have to think on that :)

    @totebo I just set all these things in the objects "custom properties" fields..
    type - (horizontal, vertical, elliptical).
    duration - how many seconds it takes for the platform to complete a loop.
    position - how far along the path the platform starts (0-1).
    clockwise - whether an elliptical platform will move clockwise or anti-clockwise.
    width - how wide the platform collision rect will be.

    Everything else can be calculated by an objects x, y, radius data. All in all pretty simple
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • totebototebo Member
    edited November 2017
    @antix, that's very similar to what I did with RUBE for Scrappy Cat. But how come your visuals in the editor looks as if the grey lines show how long they'll move for? Hmm? Is that the "radius"?
    My Gideros games: www.totebo.com
  • @totebo, The objects used for horizontal and vertical platforms in Tiled are PolyLines..
              id = 182,
              name = "platform",
              type = "platform",
              shape = "polyline",
              x = 48,
              y = 64,
              width = 0,
              height = 0,
              rotation = 0,
              visible = true,
              polyline = {
                { x = 0, y = 0 },
                { x = 0, y = 96 }
              properties = {
                ["duration"] = "3",
                ["position"] = "0.5",
                ["type"] = "vertical",
                ["width"] = "2"
    So if it's vertical you can get the length between the 2 vertices and your'e all sorted :)
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
  • Clever! Will make a mental note to use those.

    Likes: antix

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 ) Share on Facebook
  • Very useful. I might write a quick windows program to condense the map data to something with less information.

    Likes: oleg, antix

    +1 -1 (+2 / -0 ) Share on Facebook
Sign In or Register to comment.