How do I turn a tilemap tile into a sprite at runtime?

  • Hi There,

    I've just recently started playing with the tilemap object in C2. What I'm wondering is, is there a way to reference the tilemap object itself to dynamically at runtime, create a sprite from a particular region of the tile map? Ideally I'd be able to do this to make "movable" objects in my project. ELSE, I'd need reference the tilemap image itself in an image editor, then extract the specific tile out, save it as ANOTHER image file, and then import into the project -- which sounds inefficient and redundant :S

    If you know, let me know!

    -Remy

  • The manual informs you of how to pick a tile by ID, and also how to convert the tile to co-ordinates in the layout. construct.net/en/make-games/manuals/construct-3/plugin-reference/tilemap

  • Actually the correct link is this:

    https://www.scirra.com/manual/172/tilemap

  • Thanks all, but that doesn't really address the issue I'm having. I'd like to pick a tile from the tilemap and copy it into a C2 sprite object NOT another tilemap object... My motivation is to be able to have a dragable/movable tile from the tilemap when I click on a particular tile -- ideally be being able to apply the drag and drop behavior to a sprite object.

    Is this possible? or, do I need to use a tileset object itself and I only have one tile displayed on it?

  • I think you would paste it into the "Canvas" plug, and then get the image url to put into a sprite.

    You would probably wind up having to skip a tick or two in the process.

  • I really think that can not be done in C2.

    1 - Take a tilemap tile

    2 - Use the tile as a sprite

    I think that is not possible.

    You could do it but the individual tile should remain another tilemap object, the tilemap object has some restrictions, for example you can not rotate its angle.

    You would need the Canvas plugin but ... I do not recommend using these plugins that do not have conversion to C3, this is because if in the future you change to C3, the use of these plugins will be an inconvenience.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I thought you want to make a sprite from a group of tiles. In this case the only way is to use Canvas/Paster plugin.

    If you only need to copy one tile to sprite, the easiest solution is just duplicate all tiles in the sprite as separate frames or animations. You already have these tile images, you can easily import them into the sprite. Or you can import the entire tilemap image as a sprite strip and C2 will cut it into frames for you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)