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

Pages: 1 ... 63 64 [65] 66 67 ... 69
961
Development / Re: Trouble making a bridge.
« on: July 30, 2015, 11:17:20 am »
Hi! I was thinking that the bridge would not work correctly with enemies and thrown entities (like arrows). But if we use a custom entity with a collision test instead of the sensor, that could be done. (Anyway, this matter is not really important, since most of the players would not realize of the problem.)

EDIT: if the hero has a companion that follows him, it could be necessary to use the custom entity collision and not the sensor.

962
Development / Re: Assigning Hotkeys to Items
« on: July 30, 2015, 05:41:26 am »
Yes, the script is loaded and executed. But as far as I know, you are not getting a solarus item entity that the engine can handle. That is why the function item:get_game() is not defined for your item variable (which is actually nil), and that produces the error in line 2.

963
Development / Re: Assigning Hotkeys to Items
« on: July 30, 2015, 04:28:59 am »
I think you cannot get an item directly from its script, only the engine can do that, so probably this has no sense. Maybe, try using game:get_item(item_name).

964
Development / Re: Any way to use an item during swimming?
« on: July 29, 2015, 08:48:33 pm »
If I am not wrong, it should be possible and not too hard (although I haven't tried that yet). I would use the event game:on_command_pressed (or game:on_key_pressed) to activate the item. You need to check that the item is assigned to the command (or key) you have pressed, and also if the hero is swimming (use something like "if hero:get_state() == "swimming" then ..."). Maybe you need to do something more, but you should be able to handle this (with a lot of work).

You should start by studying the scripts related to the hud (of Solarus dx for instance), which is used to display the selected items. Also, you will find functions for custom states or commands of the hero (which are independent of the engine) defined there that you may need to use. (It took me a lot of time to understand all of that, but it's really important.)

965
Development / Re: Enemy: Zora
« on: July 29, 2015, 08:24:13 pm »
Hi Chris!

I finally finished my scripts for the beam, which may also be useful. I made 3 different types of beams (with lots of parameters that can be customized):

-Curved beam (actually not a beam). It throws each time a particle towards the position of the hero. It can make a pause after certain number of particles are thrown.

-Straight beam. This always makes a pause after a certain number of particles is thrown. Each time this throws particles, these are thrown aligned, towards the direction where the hero was.

-Moving beam. This one is a bit different. This is a continuous straight beam (it does not pause, and all particles are aligned in the same straight line). The straight line points towards a moving target, which moves towards the hero at certain speed (when the line has changed the direction, which happens when the target moves, the particles' position is changed so that they still form a line).

The three scripts work using another script called beam_particle.lua, which creates the beam particles.

Again, I put the link to my repository.
https://github.com/Diarandor

966
Development / Re: Thought experiment: Beamos
« 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.

967
Development / Re: Thought experiment: Beamos
« 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.)

968
Development / Re: Thought experiment: Beamos
« 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).

969
Development / Re: Thought experiment: Beamos
« 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.

970
Development / Re: Custom Entity: Ally Creation issue
« on: July 28, 2015, 11:03:11 pm »
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.

971
You should put something like this (inside the game manager is usually the best place):
Code: [Select]
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.

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

973
Development / Re: Side scrolling functionality
« on: 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

974
Development / Carrying custom entities
« on: 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

975
Development / Re: Side scrolling functionality
« on: 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.)

Pages: 1 ... 63 64 [65] 66 67 ... 69