Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Christopho

Pages: 1 ... 77 78 [79]
Development / Re: Making a more-than-two answers possible question
« on: September 06, 2013, 10:30:03 am »
With Solarus 1.1, the dialog box is fully scripted and yes, you can do more than two answers if you want.
In summary, you can pass any value to a dialog, and get any value as result (a boolean, a number, a table, etc.).

All details are here:

Development / Re: Making several conveyors change their direction ?
« on: August 31, 2013, 05:59:41 pm »
map:remove_entities() works, but entities are actually removed at the next cycle. For me, it is a bug that you can't re-use the name right now. So I entered it in the bug tracker:
I also entered another issue to implement conveyor:set_direction:

In the meantime, what you should do is to make with the map editor 4 conveyor in each spot (one for each direction), and use conveyor:set_enabled() to enable only one of them every time. Do you see what I mean?

In general, using set:enabled() is much easier than removing and re-creating entities. Actually, that's why this bug exist: I almost never remove and re-create entities in my games.

I hope it helps :)

That being said, your puzzle looks nice and your code is well commented. I hope you will share your game on this forum soon :P

General discussion / Re: Welcome!
« on: August 30, 2013, 10:00:52 pm »
The "Development" section is the right place to post your code and ask for help.
Welcome on the forum :)

General discussion / Re: New Game?
« on: August 15, 2013, 10:49:37 am »
Yes, but we did not talk much about it yet. It's called Zelda: Mercuris' Chest. Here are a few screenshots:

General discussion / Re: Question
« on: August 10, 2013, 11:16:11 am »
I don't think it is possible to make a game without programming somehow. Game creation software like RPG Maker, Multimedia Fusion or Game Creator can hide the programming part behind a graphical user interface, but in the end, you still find the same problem and have to solve the same issues as a with traditional programming language. So for me, with these software you use a graphical programming language.
What I'm saying is that no matter the game engine you use, you have to learn some kind of language.

Lua is very minimalist. It is easy to learn compared to others.
(You can start here:

In Solarus, you have to use Lua to make all your menus: the title screen, the pause menu, the dialog box, etc. In the future, there will problably lots of examples of scripts for these on this forum or the wiki so that people don't have to write them from scratch or adapt them from existing games.

But once you have your menus, programming the behavior of a map is quite easy. For example, if you have a switch called "my_switch" and you want it to make a chest called "chest_1" appear, you do

Code: [Select]
function my_switch:on_activated()

We will make tutorials soon to explain all of this :)

Development / How to show a night overlay on a map
« on: August 08, 2013, 10:01:39 am »
Solarus has a few built-in mechanisms, and you can customize things through the Lua API.
For example, there is no built-in day/night system. But it is easy to create one. In this sample script, we will make a simple dark overlay on the map to make a night visual effect.

More generally, you can use the same code to show any kind of semi-transparent surface on the map, even a PNG image.

For more details, see the documentation of surfaces.

First, create a surface for your map, for example in map:on_started() in your map script:

Code: [Select]
function map:on_started()
  self.night_overlay = sol.surface.create()  -- Create an empty surface of the size of the screen.
  self.night_overlay:set_opacity(192)        -- Make it semi-transparent (0: transparent, 255: opaque).
  self.night_overlay:fill_color({0, 0, 64})  -- Fill it with dark blue to obtain a night effect.

The night surface is initialized, we just have to draw it when the map is drawn:
Code: [Select]
function map:on_draw(destination_surface)

And voilĂ  !

So this is the basic idea.

If you want more:
- (Easy) To make the opacity change with time, use a timer.
- (Easy) To show an image from an external file instead, replace sol.surface.create() by sol.surface.create("path/to/file.png").
- (Advanced) To make the image move when the player moves (like the lost woods overlay in ALTTP), there are two optional parameters x and y in map.night_overlay:draw(). How to determine appropriate x and y values is left as an exercise to the reader ;)
- (Advanced) To make the image move automatically (like clouds), create a movement on your image.
- (Advanced) You can also combine the previous two remarks.

Thanks for your suggestions.
I renamed Game art to Game art & music, and I changed the description of Development to something clearer and more general.
Since the forum is new and quite empty for now, I don't want to make a lot of boards for now.

Chapters 1 to 5 of

That's a very good question.
Like always in programming, it is better not to start directly by writing code, but learning and using Lua is easy.

Lua is very minimalist but powerful. There are only a few mechanisms to learn (variables, functions, table, metatables), everything is built using these base mechanisms.

To learn Lua, the best way is to buy the Programming in Lua book in its latest edition. It is the recommended book.

But you can also read the online version of the first edition of that book, it is free:
I recommend to read chapters 1 to 5, then you know enough to make scripts for Solarus. Later, you should also read chapters 11, 13, 16, 18, 19, 20 to understand what you are doing.

I should make a page or a PDF sheet that summarizes the main features of Lua, on the documentation or the wiki. Especially the ones that are important for Solarus:
- Variables should be declared local unless you know what you are doing.
- Functions are first-class values. The definition of a function is actually an assignment (to a variable or to a table field).
- Tables are the only data structure.
- The semicolon operator is syntaxic sugar to hide the first parameter of a function.
- A Lua script file is a regular function and can take parameters with the syntax ... (3 dots).

General discussion / Re: Welcome!
« on: August 07, 2013, 07:07:12 am »
There is already the "Development" board for that. :)
Maybe I should change the description?

Bugs & Feature requests / Re: Video Tutorials
« on: August 05, 2013, 05:00:56 pm »
Actually I started a video tutorial series just a few days ago, but it is in French :P

If someone who understands French and speaks English better than me, a nice thing would be to make an English version of each video :)
Either by reproducing the same steps, or by using the same video track but with your voice instead of mine. (I can make the video without voice but with the music available for download.)

General discussion / Re: bug
« on: August 05, 2013, 04:58:05 pm »
Oops :)
It's fixed now. Thanks

General discussion / Welcome!
« on: August 05, 2013, 02:31:00 pm »
Since the Solarus 1.0 release, several people suggested to create a forum to talk about game development with Solarus, get help, share scripts and game resources.
So that's done! Feel free to make any suggestion.
Welcome everybody!

Pages: 1 ... 77 78 [79]