Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Tilemap newbie question — Gideros Forum

Tilemap newbie question

GreywineGreywine Member
edited July 2015 in General questions
Hi,

I started making a really simple roguelike game. That is, it's a tiled game, where you click 1 of 4 arrow buttons and you move the whole map in that direction, keeping the main actor in the middle. The logic was easy and fun, but the performance was pretty bad. I assume it's because I'm adding bitmaps and removing them constantly.

Anyway, I saw Gideros already has a built-in TileMap class, so why reinvent the wheel, right?

My question is, looking at the desert example, what's the simplest function that would query for what tile is being touched onMouseUp(event) or onMouseDown(event)? I'd like to be able to understand enough to say "that's a ground tile" or "that's a wall tile," but there are so many {}'s within {}'s, it's hard for me to see what level of what variable to query.

Thanks.

Comments

  • piepie Member
    @Greywine, maybe this would help:
    http://giderosmobile.com/forum/discussion/5361/level-editor-of-choice/p1
    look for the attachment on my latest post: It's not exactly what you need, it is an example on how to use tile properties from Tiled in gideros, but it could give you a starting point.




  • Thanks @pie. I hadn't run across the sewers2 example before. I'll take a look this weekend.
  • I took a look and it's exactly what I need. But...
    When I try to add another tilemap in the code, I get a weird '}' error:

    sewers_2.lua is uploading.
    Uploading finished.
    sewers_2.lua:27: '}' expected (to close '{' at line 11) near '{'

    Any ideas on the correct file format for multiple tilesets?
    zip
    zip
    SewersTest.zip
    74K
  • piepie Member
    Accepted Answer
    @Greywine in the archive you posted the tmx file doesn't seem to be updated to the lua map: it is missing the second tileset (monster_tileset.png).

    However, I just imported monster_tileset.png, added some tiles on a new monster_layer and exported the map from Tiled in lua. It works perfectly for me (see attachment - map updated to sewers_3 lua and tmx).
    I suppose you're doing something wrong at some point, but it's hard to tell "what" from here :)

    Are you working with Tiled?
    Do you edit things by hand after exporting maps?
    zip
    zip
    sewers3.zip
    76K
  • @pie I'm not used Tiled. Ideally I'd like to create a random map with randomly placed monsters in a game. So the handcrafted levels that Tiled uses won't be of interest to me. But because Gideros' TileMap functions use it, I'm trying to figure it out. It turns out there are a couple of ',' missing after '}' in my original files.

    Thanks for taking the time to help me out.
  • piepie Member
    @Greywine that's a very interesting goal, I thought about doing something similar but left it for my next game.. I will be interested in your findings.

    I am glad to be of help, I had a lot here, just returning some when I can :)
Sign In or Register to comment.