Menu

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.

Show posts Menu

Messages - Christopho

#1186
General discussion / Re: Welcome!
August 30, 2013, 10:00:52 PM
Hi,
The "Development" section is the right place to post your code and ask for help.
Welcome on the forum :)
#1187
General discussion / Re: New Game?
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: http://www.zelda-solarus.com/zs/article/zmc-images/
#1188
General discussion / Re: Question
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: www.lua.org/pil/contents.html)

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

function my_switch:on_activated()
  chest_1:set_enabled(true)
end


We will make tutorials soon to explain all of this :)
#1189
Development / How to show a night overlay on a map
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:


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.
end


The night surface is initialized, we just have to draw it when the map is drawn:
function map:on_draw(destination_surface)
  self.night_overlay:draw(destination_surface)
end


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.
#1190
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.
#1191
TL;DR
Chapters 1 to 5 of http://www.lua.org/pil/contents.html

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: http://www.lua.org/pil/contents.html
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).
#1192
General discussion / Re: Welcome!
August 07, 2013, 07:07:12 AM
There is already the "Development" board for that. :)
Maybe I should change the description?
#1193
Bugs & Feature requests / Re: Video Tutorials
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.)
#1194
General discussion / Re: bug
August 05, 2013, 04:58:05 PM
Oops :)
It's fixed now. Thanks
#1195
General discussion / Welcome!
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!