Author Topic: Display text messages like tiles  (Read 1424 times)

the bread

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Display text messages like tiles
« on: March 18, 2015, 06:58:49 pm »
Hello,
as it already says in the title, I'd like to display some text messages like tiles. That means:
1. The hero should be able to move while the message is being displayed
2. The hero should be able to walk over the message, too.
3. The text should disappear like a normal tile if I have a map greater than 320x240 and walk away
I thought it would be much too much work if I had to add a new tile to the tileset every time I want to display a message like this. A text surface seemed to be a good idea but I couldn't figure out where to draw it to let it work correct for point three. map:on_draw, game:on_draw and sol.main:on_draw draw it at a fixed position on the screen. Any help is very appreciated.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
Re: Display text messages like tiles
« Reply #1 on: March 18, 2015, 10:27:11 pm »
This is a missing feature indeed. Could you post this as an issue on the bug tracker on https://github.com/christopho/solarus/issues/new?
Thanks

For now, there is a way to draw sprites in map coordinates (with map:draw_sprite()) but sadly, this is not possible yet with surfaces or text surfaces.

the bread

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Display text messages like tiles
« Reply #2 on: March 22, 2015, 12:20:42 pm »
Ok, it's reported now. But by the way, when I watched the latest tutorial of Solarus, I saw that the rupee counter under a shop treasure works exactly as I would like it to be. How is this done?
And another little thing that doesn't seem worth a whole new topic:
How can I attach a savegame variable to a door but prevent the automatically update? This might sound complicated; what I want do is to create a puzzle where a switch opens a door. When the switch is left, the door closes again. A statue has to be placed on the switch and since I don't want to annoy the player too much, I want to let the door stay open once this is done, also if the game is restarted. So the problem is, if I tick "save the door state", the player can cheat by placing the hero on the switch, then saving and turning the game off. When he restarts, the door is open because of the savegame variable. I know, how unlikely it is that a normal player does such a thing, but nonetheless it distracts me having an issue in my program, never mind how small it is.
So I would solve it by giving the door a savegame variable but turning it on or off all by my own so that I can only set it if the statue is on the switch. How is this done or is there a better way to solve the cheating issue? Any help is very appreciated.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
Re: Display text messages like tiles
« Reply #3 on: March 22, 2015, 02:11:56 pm »
Maybe you should not check "Save the door state", but instead save it yourself to make it different from the door state. Use game:get_value()/game:set_value() to control the saved variable, and door:set_doors_open() to control the door.