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 - Diarandor

#1006
Development / Re: Thought experiment: Beamos
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).
#1007
Development / Re: Thought experiment: Beamos
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.
#1008
The error message you get means that the variable "enemy" is not defined in the code (before the line of the error), so it is equal to nil.

Also, if you are working on an enemy or custom entity script, don't forget to write "entity = ..." (or "whatever = ...") in the first line, so that the entity you are defining is referenced by that "whatever" variable. Maybe that is the problem, but I don't know since I don't know the rest of the script or what you are doing.

You should start looking similar scripts of enemies and custom entities made by other people and modify them.
#1009
You should put something like this (inside the game manager is usually the best place):

function game:on_command_pressed(command)
if command == "action" and blablablablabla then
  blablablablabla
elseif
   ...
end
end

This function is an event that is called automatically by the engine when necessary and in case it is defined.  (In your script, the function keyboard() is never called, just defined.) I recommend you to study scripts of other people and also the Lua APi.
#1010
The problem is that the event map:on_started() is called once (when the map starts, obviously ;D).
You should use a different event, like game:on_command_pressed() or game:on_key_pressed(), which are called whenever you press a game command or key, respectively.
#1011
Development / Re: Side scrolling functionality
July 27, 2015, 06:19:50 AM
I don't know for sure (he should answer this), but probably in 1.4.3. You can check how much work remains to be done in his github repositories.

I have opened another post to talk about the generic_portable entities of my script, since this post is not the good place to talk about it. It's here: http://forum.solarus-games.org/index.php/topic,332.0.html
#1012
Development / Carrying custom entities
July 27, 2015, 05:07:47 AM
I have created this post just to talk about the scripts I made to allow carrying custom entities (not working correctly yet), just in case someone is interested. A conversation about this was started here:
http://forum.solarus-games.org/index.php/topic,297.0.html
#1013
Development / Re: Side scrolling functionality
July 27, 2015, 04:55:54 AM
Of course, you can change the direction of the carried entity while it is carried. It should be very easy to simulate carrying the princess or the cucco (but unfortunately this is not so easy to make the flying rooster).

I can put some examples (including graphics) in my repository, so you can understand better how to make it. But before I want to put my graphics in opengameart.org or other website like that (I will do it someday soon, today I am a bit lazy, and before I need to separate my graphics from the ones of "A Link to the past"). I made a ball of yarn entity that can be carried and changes direction when the hero does, and cats that can interact (playing) with it and follow it (even when you carry it). I will put this example in my repository when I add more things.

Both bugs were solved by Christopho (thanks!!! ;D), so we just need to wait. (If you know how to compile Solarus from the development version on github, you could check if it works.)
#1014
Development / Re: Side scrolling functionality
July 27, 2015, 03:28:02 AM
Thanks for the compliments! :D
With your knowledge of programming you won't have problems, since Lua is much easier and flexible than C++ (actually, I forgot C++ many years ago :P).

As a workaround for the generic_portable.lua script, you can comment/delete the lines of the script where shadow:remove() appears (there are two of them), which would avoid the crash, but the shadow will not be deleted, so each time you throw the entity a shadow will appear and stay where the entity has fallen. To test the script, you can try to use my script key.lua, which uses the code of the script generic_portable.lua.

I think the cause of the crash was already solved here:
https://github.com/christopho/solarus/issues/690
so I am still waiting for the next bugfix 1.4.3 to see if it works. There was another bug fixed in
https://github.com/christopho/solarus/issues/691
that did not allow to recover the information of any entity when the player leaves the map (since the entities were removed before the event map:on_finished() was called). This could also give some problems, maybe, to save the position of generic_portable entities when changing maps, so I am also waiting for the next bugfix 1.4.3 because of this, before repairing/improving my script.

EDIT: I think it would be better to open a new topic to talk about this, since it has nothing to do with the side scrolling.
#1015
Development / Re: Side scrolling functionality
July 27, 2015, 01:45:09 AM
But I am not using a destructible entity. With my scripts, what you lift is a custom entity. The lifting, carrying and throwing states of the hero and the entity are fully scripted. So there is no shadow if you do not create it. (And probably the crash is due to something that I did wrong. But I don't have much time this summer to work in my game...)

You should do your own scripts for your purposes, or wait until the day that custom entities can be carried. There is no other workaround. You have to be patient and don't underestimate the programming, since it takes a lot of effort and months (or years) of work.
#1016
Development / Re: Side scrolling functionality
July 26, 2015, 11:42:50 PM
The shadow is made with a custom entity, created when you throw the entity and removed after the item has fallen. If you don't create it there are no crashes. Maybe it's a problem of my script...
#1017
Development / Re: Side scrolling functionality
July 26, 2015, 10:39:51 PM
The problem can be avoided if you do not create the shadow. I still don't know what produces the crash.
#1018
DementedKirby, I suggest to make local the function loop, if it is possible. Just to improve the code.
#1019
Development / Re: Side scrolling functionality
July 26, 2015, 07:31:10 PM
Yes, I'm using that script to make things similar to that metal ball (Link's awakening is great!), but also more complex entities with several sprites that can be carried. (I haven't tried to script the flying rooster since I don't need it, but it should be scriptable, with a lot of work of course.)

Also, in my game, instead of pickable, keys will be carried, so I will be able to annoy the hero with bird enemies that steal the key you are carrying, or forcing you to throw the keys between the three heroes (since they have different abilities and must take different paths sometimes), or using other things like conveyor belts and platforms with keys, or even using the magneto with metal keys. I think this would give more originality/personality to my game than usual keys.
#1020
Development / Re: Side scrolling functionality
July 25, 2015, 11:05:26 PM
Hi DementKirby!

I have created my first github repository and put some of my scripts. You have the one you want in entities/generic_portable.lua. You should study the code and delete/modify the things you don't need. Also you need the sprites and animations and sounds to be compatible with the script. (Recall that there is still a crash with these entities. I will try to repair it someday.)

You will find my repository here: https://github.com/Diarandor

Also, you will find the scripts for entities button and weight. Weights are generic_portable entities (so these can be carried, etc) that can push my button entities. I will put more stuff in the repository someday soon.