Solarus-Games English Forum

Solarus => Development => Topic started by: wizard_wizzle (aka ZeldaHistorian) on July 29, 2015, 03:58:13 AM

Title: Thought experiment: Beamos
Post by: wizard_wizzle (aka ZeldaHistorian) on July 29, 2015, 03:58:13 AM
Hi all!

I'd really like to include beamos in my game, and I think other people might too - but it's a little too high level to wrap my head around. So, I thought I'd present the idea to the community and see what we can come up with!

The beamos statue is easy, you'd want a sprite with 8 directions so it can follow the hero, then just check and see when the hero is too close and start firing a beam. The beam itself is where it gets tricky! My thought is that the beam would an enemy breed of its own which is generated by the beamos statue (probably in a continuous stream). What I'm thinking of is an 8x8 sprite that can be created over and over again so that the beam can go in any direction. They move toward the hero in a line (somehow) and terminate being generated after a certain time. I'm not entirely sure how to implement this though...

Maybe I'm over (or under) thinking this and there's a better way? Let's brainstorm! :)
Title: Re: Thought experiment: Beamos
Post by: Diarandor on July 29, 2015, 05:07:03 AM
Hi! This seems a very interesting issue, and since, unfortunately, Solarus cannot work with pixels yet, we would need a workaround. I agree that the best way would be to draw a sprite lots of times to draw the beam (maybe a square or dot of some color). I would like to collaborate with this script.

An interesting problem could be to script a beam with several colors or more details (for instance, a color for the border of the beam and other for the inner part of the drawing). Also, we could allow to customize (with some parameter of the script) the speed of the beams and the "lenght" of each beam, in case that the beam is discontinuous (although we can also script a "continuous" beam with an only straight line).

To summarize, I would allow to customize the following features on the script:
1-Color of the beam (and maybe border color too, or some detail.)
2-The beam could be a straight line or several traces. (Choose if the beam acts immediately or not in the first case. Choose the lenght and speed of beams in the second case.)
3-Allow the beam to collision, or not, with walls.
4-Allow to set a max distance (by default it could be "infinite").
5-Allow to customize the thickness of the beam.
Title: Re: Thought experiment: Beamos
Post by: Diarandor on July 29, 2015, 05:29:38 AM
I found this image of beamos from "A Link to the past".

http://vignette1.wikia.nocookie.net/zelda/images/d/d7/Beamos_disparando.gif/revision/latest?cb=20130713143315&path-prefix=es

The beams are square sprites which are repeated several times. It should not be too hard to simulate that with the script. I would make two types of beams (maybe in different scripts); one with a straight line that follows the hero while he is close to the source of the beam, and other of a certain lenght that is shot to a point (like a projectile).
Title: Re: Thought experiment: Beamos
Post by: Diarandor on July 29, 2015, 07:45:51 AM
Good news. I made a customizable script for the beam (using an enemy that throws "beam particle" enemies again and again). You can find them in my repository:
https://github.com/Diarandor

The main script is in data/enemies/projectiles/beam.lua.
It works using the other script data/enemies/projectiles/beam_particle.lua, which is used for each particle of the beam.

You can customize the beam.lua script easily. (It remains to add the sound and make the beam stop after a certain time.)
Title: Re: Thought experiment: Beamos
Post by: Christopho on July 29, 2015, 09:37:04 AM
Very nice!

But if the beam enemy throws beam_particle enemies repeatedly, it means that we won't have a straight line if the hero is moving, right?

I made a Zora enemy recently, which throws three aligned fireballs, the principle is very similar. I shared the code in this topic (http://forum.solarus-games.org/index.php/topic,341.msg1362.html#msg1362). Maybe it can help!
Title: Re: Thought experiment: Beamos
Post by: Diarandor on July 29, 2015, 02:02:53 PM
Yes, you are right. I forgot to align the beam particles :o. I'll try to create new scripts for the beam.
Title: Re: Thought experiment: Beamos
Post by: Christopho on July 29, 2015, 02:07:39 PM
I think it should not be too hard to make them aligned. Just keep the initial x,y values when creating new enemies.
Title: Re: Thought experiment: Beamos
Post by: Zeror on July 29, 2015, 02:27:26 PM
Quote from: Christopho on July 29, 2015, 09:37:04 AM
I made a Zora enemy recently, which throws three aligned fireballs, the principle is very similar. I shared the code in this topic (http://forum.solarus-games.org/index.php/topic,341.msg1362.html#msg1362). Maybe it can help!
We need a enemy script database on this site. So you can select and download each enemy you want.
Title: Re: Thought experiment: Beamos
Post by: Christopho on July 29, 2015, 02:30:48 PM
Quote from: Zeror on July 29, 2015, 02:27:26 PM
Quote from: Christopho on July 29, 2015, 09:37:04 AM
I made a Zora enemy recently, which throws three aligned fireballs, the principle is very similar. I shared the code in this topic (http://forum.solarus-games.org/index.php/topic,341.msg1362.html#msg1362). Maybe it can help!
We need a enemy script database on this site. So you can select and download each enemy you want.
I agree :)
ALTTP ones will be centralized in the Lib Mudora project: https://github.com/Nate-Devv/libsolarus-mudora/
I will make a pull request to add my Zora there when it is a bit more tested.
Title: Re: Thought experiment: Beamos
Post by: DementedKirby on July 29, 2015, 05:39:00 PM
Quote from: Zeror on July 29, 2015, 02:27:26 PM
Quote from: Christopho on July 29, 2015, 09:37:04 AM
I made a Zora enemy recently, which throws three aligned fireballs, the principle is very similar. I shared the code in this topic (http://forum.solarus-games.org/index.php/topic,341.msg1362.html#msg1362). Maybe it can help!
We need a enemy script database on this site. So you can select and download each enemy you want.

This is actually a very good idea. A Link to the Past has so many different enemies that it will allow for a much better experience to play through a game in its style if one were to have access to as many enemies as possible.

I think the same could be said for the other items that are available in A Link to the Past, i.e.: Book of Mudora, the Medallions, Cane of Byrna, Magic Cape, Book of Mudora, etc. (I'm currently trying to produce the Book of Mudora; so far, I got the concept, sprites, and animation; I just have to continue studying up on the documentation to see how I can make it).
Title: Re: Thought experiment: Beamos
Post by: wizard_wizzle (aka ZeldaHistorian) on August 14, 2015, 05:51:49 AM
Finally got a chance to implement and test the beamos, and the script is great!!! Thanks Diarandor!