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 2 3 [4] 5 6 ... 69
46
General discussion / Re: Free Pixel Art Making Programs
« on: August 21, 2018, 07:24:24 am »
A nice video tutorial explaining the basics of Aseprite for beginners:
https://www.youtube.com/watch?v=Md6W79jtLJM

47
Development / Re: Disable brandish for all items in chests
« on: August 20, 2018, 05:13:14 pm »
And he should also define that function in the metatable, so that he does it only once. In case of more info needed in that function, he can use the custom properties in the editor.

48
It will be possible with Solarus 1.6, with a new event function, and I think Christopho has already coded it. Chris has been working very hard, even harder than adamantium, on the engine, and from the more than 100 issues that there were before, less than 40 remain to do. That means Solarus 1.6 is coming very soon...

49
Development / Re: Is it possible to make the hero face the cursor?
« on: August 18, 2018, 04:51:41 am »
Something like this may work (it is untested, so you should correct it if necessary).
Code: Lua
  1. -- Get the map coordinates of the cursor.
  2. local map_meta = sol.main.get_metatable("map")
  3. function map_meta:get_cursor_coordinates()
  4.   local camera = self:get_camera()
  5.   local mouse_x, mouse_y = sol.input.get_mouse_position()
  6.   local cam_screen_x, cam_screen_y = camera:get_position_on_screen()
  7.   local cam_x, cam_y, _, _ = camera:get_bounding_box()
  8.   local pos_x = mouse_x - cam_screen_x + cam_x
  9.   local pos_y = mouse_y - cam_screen_y + cam_y
  10.   return pos_x, pos_y
  11. end
  12.  
  13. -- Make the hero face the cursor.
  14. local hero_meta = sol.main.get_metatable("hero")
  15. function hero_meta:face_the_cursor()
  16.   local hero = self
  17.   local pos_x, pos_y = hero:get_map():get_cursor_coordinates()
  18.   local dir = hero:get_direction4_to(pos_x, pos_y)
  19.   hero:set_direction(dir)
  20. end
  21.  

You still have to import the script that contains these functions, and initialize a timer that will call "hero:face_the_cursor()" when necessary, as mentioned above. If we do all the work for you, you will not learn, so I will be leaving you here. Good luck!

50
Development / Re: Is it possible to make the hero face the cursor?
« on: August 17, 2018, 02:18:13 am »
Updating the hero's facing direction every 1ms seems like a bad idea.

Unless he is making a shooter where the hero should always be aiming to the cursor, which we don't know.

51
Development / Re: Is it possible to make the hero face the cursor?
« on: August 17, 2018, 01:17:05 am »
I recommend to add a function to update the direction of the hero. Something as simple as this should work:
Code: Lua
  1. function hero:face_the_cursor()
  2.   local mouse_x, mouse_y = sol.input.get_mouse_position()
  3.   local dir = hero:get_direction4_to(mouse_x, mouse_y)
  4.   hero:set_direction(dir)
  5. end
You can combine it, for instance, with a 1-millisecond-timer that calls the function "face_the_cursor" when necessary, or otherwise, with potatoes, ketchup and chicken wings.

PS1: Since the function "sol.input.get_mouse_position()" seems to calculate the position relative to the quest size, it may not work. I have never used/tested it. In that case, I leave the problem as an exercise for you.

PS2: my cats usally say catsup instead of ketchup.

52
Development / Re: Problem with thrown enemies after pause
« on: August 09, 2018, 05:16:39 pm »
That (i.e. the hero throwing the item) can be avoided if you add some code to the corresponding event(s) on_key/command_pressed().

53
Development / Re: Multiple enemies not acting the same
« on: August 06, 2018, 08:23:15 am »
Some of your state variables, like 'attacking', are not local.

54
Development / Re: Custom entity and associate sprite : strange offset
« on: July 29, 2018, 06:25:41 pm »
That awesome feature will allow to have a hero of bigger or smaller size, which was a feature requested by many devs/artists using custom art of non-standard size. It will also allow to make a game like Minish Cap, where the hero can become smaller/bigger.

55
Bugs & Feature requests / Re: on_removed() warning issue?
« on: July 28, 2018, 12:52:00 pm »
You should check if the entity still exists. In on_removed:
Code: Lua
  1. if bookcase ~= nil and bookcase:exists() then
  2.   bookcase:set_enabled(false)
  3. end
  4.  

56
Development / Re: Required Sound Effects?
« on: July 27, 2018, 03:55:57 pm »
You can always "steal" sounds from our free project.  :P

57
General discussion / Re: Free Pixel Art Making Programs
« on: July 23, 2018, 11:34:26 pm »
You won't regret it. I can't stop recommending Aseprite. It's very powerful, intuitive and simple at the same time. The layers feature is very important and you should use it a lot.

58
Development / Re: Pass multiple entities?
« on: July 22, 2018, 11:19:27 am »
The function map.get_entities_by_type(type) and other similar functions return an iterator. You can iterate on it to check all collisions at once! (see the Lua API). You can also define your own function, using those functions, and allowing to do things on iterators or lists, but it's not really necessary.

59
Development / Re: [Solved]Bomb overlap assistance
« on: July 22, 2018, 12:38:56 am »
An easy way to do this is to allow to define a custom event map.on_bomb_created(bomb_entity). You can call it, if it exists, from the bomb metatable (just define the function bomb_metatable.on_created).

60
General discussion / Re: Stealth Action Adventure Game Possible?
« on: July 22, 2018, 12:34:20 am »
You need to learn Lua, but also read carefully the Lua API of Solarus (there you have all the tools you need nicely explained). And of course, read others' scripts (as examples) and study their code, and make a lot of tests.

Pages: 1 2 3 [4] 5 6 ... 69