Recent Posts

Pages: 1 ... 8 9 [10]
91
Development / Re: how can you draw similarly to the light_manager
« Last post by llamazing on June 01, 2018, 03:50:36 pm »
Light manager? Is that script someone wrote?

What you want to use is blend modes, specifically the multiply blend mode.

If you think of black as a value of 0 and white as a value of 1, if you multiply any color by black it becomes black and if you multiply by white it is unchanged. Shades of grey will thus darken the image where the closer to black it is the darker it will get.

So then start with a black surface (or perhaps dark grey if you still want the darkened part of the room to be slightly visible). Next you'll want to draw white circles wherever a torch is visible. You have two options here:
  • You could create a png image of that circle where white pixels are the brightest part, then on the edges have a gradient where the white pixels become more transparent, with fully transparent being the darkest spot. Now all you have to do is draw this circular image in normal blend mode on top of your black surface wherever a torch is present. If two torches are near each other then the transparent pixels from each circle will overlap making it brighter in that spot than if there were only one torch.
  • The second option is to create an image of the circle where white pixels are the brightest part, then on the edges have a gradient where the pixels become grey as you want it to become darker, and eventually black at the darkest point. This image would not use any transparency. Similarly to before you will draw the circle on the black surface wherever you have a torch, but this time use the add blend mode, so where grey pixels overlap they will become more white (brighter).

Then all you have to do is draw that black surface with white circles overlaid on top of the game's surface, and be sure to use the multiply blend mode. Regardless of which option you used above, the result will be the black surface will have black pixels at the darkest spots, white pixels at the brightest spots and shades of grey in between. The best option would be creating a menu to draw the black surface on top of the game surface.

The tricky part is updating the image as the player moves. Once again you have two options:
  • The easier method is to size your black surface to be the size of the map. Then you only have to draw the white circles once when the map is loaded and then you can simply draw the a sub-region of the black surface that is visible on the player's screen over the game surface every frame. If your light sources are dynamic (either they move locations or turn on/off) then you will have to redraw the white circles on the black surface whenever one of these changes occur. The method is better if the lighting is not dynamic or at least doesn't change very often.
  • If you have lots of dynamic light sources (or for example you want to draw a light source at the player's position), then it is probably better to size the black surface to match the size of the game screen and then you'll have to redraw each light source every frame, but you only have to draw the light sources that actually appear on screen.
92
Development / Re: how can you draw similarly to the light_manager
« Last post by Diarandor on June 01, 2018, 03:04:19 pm »
1) With shaders, when Solarus v1.6 is released,
or
2) With a black surface that has a (semi)transparent circle in the middle.
93
Development / how can you draw similarly to the light_manager
« Last post by Porksteak on June 01, 2018, 05:43:21 am »
How can you make a drawable while using the light manager? Basically what I want to do is have a dark room, and rather than lighting a torch making the room lit, it would make a circle of light surrounding the torch. How can I do this?
94
Your scripts / Re: 8-bit Solarus Animated Logo Intro
« Last post by Diarandor on May 31, 2018, 08:36:28 pm »
This looks really charming!! I can't wait to test your game someday. :D
95
Your scripts / Re: 8-bit Solarus Animated Logo Intro
« Last post by alexgleason on May 31, 2018, 06:14:29 pm »
I'm using this in my WIP game Vegan on a Desert Island (GPL-3.0).

I'll make an official post once it's more complete, but here's a preview.









96
General discussion / Re: Quick Question about sol.audio.play_music
« Last post by Diarandor on May 31, 2018, 05:06:08 pm »
Your musics are in the folder "musics/eduardo/", so
the id for your boss music is "eduardo/boss" and not just "boss". That will fix your problem. You can now destroy your link above.
97
General discussion / Re: Quick Question about sol.audio.play_music
« Last post by etertaycb on May 31, 2018, 03:33:42 pm »
Here is a link to the quest folder with the issue re-created

https://mega.nz/#!TCpiSabL!cXUcY3GXMEoEjLOy5F5o2crFVOkJ3y3V6DPFvw2lhJg


 I've recreated the issue (bug?) in its simplest form. here are the answers to your questions

1.) 1.5.3
2.) yes, in addition i am only using the default music files in the folder "eduardo"
the song I tried to use in this example was "game_over.ogg"
3.) .ogg  (default files)
4.) yes. If I attach the same song "game_over.ogg" with the map editor the song will play

the error I receive is Error: In on_key_pressed: [string "main.lua"]:48: No such music: 'game_over

Code: [Select]
function sol.main:on_key_pressed(key, modifiers)

  local handled = false
  if key == "f5" then
    -- F5: change the video mode.
    sol.video.switch_mode()
    handled = true
  elseif key == "f11" or
    (key == "return" and (modifiers.alt or modifiers.control)) then
    -- F11 or Ctrl + return or Alt + Return: switch fullscreen.
    sol.video.set_fullscreen(not sol.video.is_fullscreen())
    handled = true
  elseif key == "f4" and modifiers.alt then
    -- Alt + F4: stop the program.
    sol.main.exit()
    handled = true
  elseif key == "escape" and sol.main.game == nil then
    -- Escape in title screens: stop the program.
    sol.main.exit()
    handled = true
-- this is where I get an issue
elseif key == "p" then
sol.audio.play_music("game_over")

  end
98
General discussion / Re: Quick Question about sol.audio.play_music
« Last post by Diarandor on May 31, 2018, 03:14:56 pm »
-I was wrong on something: the extension should not be written in the filename (according to the Lua API).

-We need more info to find the problem. This could even be an engine bug, but that's unlikely to be the case, so I want to be sure before we open an issue. Questions:
1) Which version of Solarus are you using?
2) Is that file added as a quest file in the Quest Editor?
3) Which is the extension of the file? (Some audio extensions are not supported by Solarus)
4) Is that music being played when attached to a map in the map editor?

It would also help a lot if you can temporarily share a link to your folder, so that we can help you solve this problem.
99
General discussion / Re: Quick Question about sol.audio.play_music
« Last post by etertaycb on May 31, 2018, 02:23:48 pm »
The error is clear: there is no file "musics/boss.ogg".

there IS a file there though. its one of the default music files and ive also tried a few others and adding my own. same result.  Even when I call the same song that is playing i get the same result
100
General discussion / Re: Quick Question about sol.audio.play_music
« Last post by Diarandor on May 31, 2018, 01:48:36 pm »
The error is clear: there is no file "musics/boss.ogg".
Pages: 1 ... 8 9 [10]