Recent Posts

Pages: 1 ... 8 9 [10]
91
Development / Re: Get all map entities?
« Last post by zutokaza on June 02, 2017, 05:08:13 pm »
Quote
make a loop to detect the closest entity from a list of entities

How is that done? My script looks like this so far.

Code: Lua
  1. -- Call a function every second.
  2. sol.timer.start(5000, function()
  3.     local birds = map:get_entities("bird_")
  4.     local npc_near_birds = npc_1:get_distance(birds)
  5.     if npc_near_birds < 10 then
  6.        movement = sol.movement.create("target")
  7.        movement:set_target(birds)
  8.        movement:set_speed(48)
  9.        movement:start(npc_1)
  10.     end
  11.   return true  -- To call the timer again (with the same delay).
  12. end)
92
Bugs & Feature requests / Re: "normal" video mode is at 2x
« Last post by Christopho on June 02, 2017, 09:50:39 am »
The x2 window scaling is just the default size of the normal video mode. You can always change that by calling sol.video.set_window_size().
93
Development / Stop slide on ice?
« Last post by Starlock on June 02, 2017, 04:44:15 am »
Hey, is it possible to make the hero stop sliding when walking on ice? When I use the hookshot while sliding the hero will slide but the hook leader will stay in the place from before the slide and if it hooks on something the hero will become stuck
94
Bugs & Feature requests / "normal" video mode is at 2x
« Last post by wrightmat on June 02, 2017, 04:31:33 am »
It appears, and the API confirms, that the "normal" video mode actually stretches the image by a factor of 2. Is it possible to just have the game run un-stretched? If there's not currently, I really think this should be added as a feature soon. Currently it would be pretty much impossible to use higher resolution resources when making games.
95
Development / Re: Get all map entities?
« Last post by Christopho on June 01, 2017, 11:24:04 pm »
Well a movement can only have one direction at a time, so you have to choose a target.
You can always make a loop to detect the closest entity from a list of entities, and repeat this in a timer.
96
Development / [Solved]Get all map entities?
« Last post by zutokaza on June 01, 2017, 09:44:18 pm »
Is it possible make a NPC target entities with a prefix?

Code: Lua
  1. target_movement:set_target(map:get_entities("bird_"))
97
Game art & music / Re: A Free Music / SFX Resource - Over 1000 Tracks
« Last post by Eric Matyas on June 01, 2017, 09:11:54 pm »
For some reason my Facebook page for Soundimage won't let me post my daily updates (or anything else) so I've started a personal Facebook page. Here's the link:

https://www.facebook.com/profile.php?id=100017638394276

Have a good weekend! :-)
98
Game art & music / Re: Building a Library of Images for Everyone
« Last post by Eric Matyas on May 30, 2017, 10:08:17 pm »
Hi everyone,

As promised, I've added about 50 distressed paper textures. They might be useful for maps, backgrounds and other things. 

http://soundimage.org/txr-paper/

I hope some of them are helpful.  :-)
99
Development / Re: Problem with timer
« Last post by MetalZelda on May 29, 2017, 11:31:29 pm »
I don't really understand the on_update() usage there

what you can do is using map:get_entities("")
http://www.solarus-games.org/doc/latest/lua_api_map.html#lua_api_map_get_entities

This way, this should work
100
Development / Re: Problem with timer
« Last post by llamazing on May 29, 2017, 10:41:33 pm »
I think your problem is that you are using map:on_update(), which gets called every cycle. With the way you have things set up, a new timer is getting created every cycle as long as at least one torch is lit. Try adding a print statement at line 5, and you'll probably see a bunch of timers getting created. So what's happening is after 3.5 seconds the "first" timer expires and un-unlights all the torches, but then every cycle all the other timers continue to expire and also un-light all the torches. So then you have to wait another 3.5 seconds for the "last" timer to expire before you can light the torches again.

A better way to do it is to use sprite:on_animation_changed(animation) instead of map:on_update(). That way the function doesn't get called every cycle.

And if you are doing what I think you are doing, you'll probably want three separate timers. It can be done with one timer (that gets restarted each time a torch is lit perhaps?), but that would also mean that all the torches will become unlit simultaneously.
Pages: 1 ... 8 9 [10]