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

Pages: 1 ... 14 15 [16] 17 18
226
Your projects / Re: Zelda: Book of Mudora
« on: January 20, 2015, 12:41:56 am »
UPDATE! Version 0.3 (the first true public beta) has been released! This is very similar to the last version, but with some polish and a little more action added in. For all the details and the download link, please check out the game's site: https://sites.google.com/site/zeldabom/demos

227
Development / Quicksand custom entity
« on: January 19, 2015, 04:38:08 pm »
I'm looking to make a custom entity which behaves like quicksand (think Link to the Past's desert temple) - when the hero approaches it, he's slowly dragged into the center, then when he reached the center, he sinks (behavior like a hole, probably). I can't seem to figure it out. Any thoughts?

This is what I have so far, which isn't even close to working:
Code: [Select]
local entity = ...
local map = entity:get_map()
local hero = map:get_entity("hero")

-- Quicksand: entity which slows the hero until
-- he finally falls in

function entity:on_created()
  self:create_sprite("entities/quicksand")
  self:set_size(32, 32)
  self:set_origin(16, 16)
  ex, ey, el = self:get_position()
  self:get_sprite():set_animation("quicksand")
end

function entity:on_update()
  self:add_collision_test("overlapping", function()
    if hero:get_walking_speed() >= 8 then hero:set_walking_speed(hero:get_walking_speed()-1) end
    m = sol.movement.create("target")
    m:set_target(ex, ey)
    m:start(hero)
  end)
end

228
Bugs & Feature requests / Re: Solarus features ?
« on: October 01, 2014, 01:29:40 am »
My attempt at a particle engine in pure Lua under Solarus: http://forum.solarus-games.org/index.php/topic,52.0.html

Needs a lot of work still, but could be a start if you need it.

229
Development / Re: Help with light and darkness
« on: September 20, 2014, 04:43:16 pm »
I don't believe it is currently, as I also need this for my game. The current approach to darkness/light is to apply a dark sprite over the whole screen, with a transparent area in the middle which appears as "light" (and can follow the hero, such as with the lamp). The problem is that you can't apply multiple lights because there is no actual light, only a lack of darkness in a small area. If you had pre-arranged areas of light, I suppose you could do multiple "cut-out" areas in the dark sprite, but this can't be done dynamically.

Eventual implementation of shaders in the engine could allow for more advanced lighting effects.

230
Bugs & Feature requests / Re: cmake error on Ubuntu
« on: August 23, 2014, 04:25:35 pm »
It seems to be a problem with the location of my libraries and my environment variables. I got OpenAL and PhysFS to work, but I'm still having problems with Lua. Setting an environment variable for that one doesn't seem to be working, unless I'm setting the wrong one. I'm setting "LUA_DIR" and "LUA_LIBS" and still no luck.

231
Bugs & Feature requests / cmake error on Ubuntu
« on: August 23, 2014, 03:34:18 pm »
When I go to compile solarus 1.3, I get a cmake error stating that OPENAL can't be found, but according to my system it's installed. Is something wrong with cmake or my system? I've compiled before, so unless something has changed, I'm confused  :-\

Error output:
Code: [Select]
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find OpenAL (missing: OPENAL_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindOpenAL.cmake:97 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:18 (find_package)

OPENAL installation:
Code: [Select]
sudo apt-get install libopenal*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libopenais2' for regex 'libopenal*'
Note, selecting 'libopenais-dev' for regex 'libopenal*'
Note, selecting 'libopenal0a' for regex 'libopenal*'
Note, selecting 'libopenal-dev' for regex 'libopenal*'
Note, selecting 'libopenal1' for regex 'libopenal*'
Note, selecting 'libopenafs-dev' for regex 'libopenal*'
Note, selecting 'libopenal-data' for regex 'libopenal*'
Note, selecting 'libopenais-legacy-dev' for regex 'libopenal*'
libopenafs-dev is already the newest version.
libopenal-data is already the newest version.
libopenal-dev is already the newest version.
libopenal1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

233
Your projects / Re: Zelda: Book of Mudora
« on: August 09, 2014, 01:19:54 am »
I would estimate 30-40% complete, depending on how much of my plan I end up executing. It's fully playable to the third dungeon, and partially to the fourth (plus about half of an ongoing dungeon). Obviously things will be added, so throw ideas my way if you have them!

234
Your projects / Zelda: Book of Mudora
« on: August 08, 2014, 01:53:58 am »
My full Zelda game, Book of Mudora, is done! The release includes Solarus 1.5(.1), the pre-release that Christopho posted to fix the software surface memory leak) for Windows, and other platforms are available at http://www.solarus-games.org/

Download: https://sites.google.com/site/zeldabom/download

Trailer: https://www.youtube.com/watch?v=wk13ltcilDM

Thanks everyone for your help, and enjoy!

235
Development / Re: Particle system
« on: June 11, 2014, 02:14:58 pm »
Okay, the display issue has been corrected and the "sparkle" (renamed to just spark) particle emitter now works! I've also added alpha fade to these particles, so they start to disappear as they age. If anyone could come up with or point me to other examples of particle emitter mathematics, I will add them, but I'm not very good at this kind of thing. I'd like to get a few more emitter types built in and then post this in the "Your Projects" board for others to use.

236
Development / Re: Particle system
« on: June 07, 2014, 08:15:21 pm »
Thanks for the feedback, Christopho!

New particles.lua:
Code: [Select]
local particle_system = {}

function particle_system:new(game)
  local object = {}
  setmetatable(object, self)
  self.__index = self
  return object
end

function particle_system:initialize(game)
  self.game = game
  if not self.type then
    print("Aborting. Call 'particle_system:set_type' before initializing.")
    return false
  end
  if not self.time then self.time = 1 end
  if not self.count then self.count = 5 end
  if not self.color then self.color = {255, 255, 255} end
  self.particles = {}

  if self.type == "sparkle" then
    self.alive = true
    for i=1, self.count do
      self.particles[i] = {}
      self.particles[i].x = self.x
      self.particles[i].xspeed = math.random(-100,100)
      self.particles[i].y = self.y
      self.particles[i].yspeed = math.random(-200,50) + (self.ysp or 0)
    end
    return self
  elseif self.type == "dust" then
    self.alive = true
    if not self.time then self.time = 0 end
    return self
  end
end

function particle_system:set_type(type)
  self.type = type
end

function particle_system:set_position(x, y, layer)
  self.x = x
  self.y = y
  self.layer = layer or 1
end

function particle_system:set_particle_count(count)
  self.count = count
end

function particle_system:set_particle_color(color)
  self.color = color
end

function particle_system:set_decay_time(time)
  self.time = time
end

function particle_system:set_y_speed(ysp)
  self.ysp = ysp
end

function particle_system:is_active()
  return self.alive
end

function particle_system:on_update(dt)
  self.time = self.time - dt

  if self.type == "sparkle" then
    if self.time < 0 then
      self.alive = false
      return
    end
    for i,v in ipairs(self.particles) do
      v.x = v.x + v.xspeed*dt
      v.yspeed = v.yspeed + 500*dt
      v.y = v.y + v.yspeed*dt
    end
  elseif self.type == "dust" then
    if self.time > 0.25 then
      self.alive = false
      return
    end
  end
end

function particle_system:on_draw(dst_surface)
  if self.type == "sparkle" then
    for i,v in ipairs(self.particles) do
      dst_surface:fill_color(self.color, 0.5+v.x, 0.5+v.y, 1, 1)
    end
  elseif self.type == "dust" then
    dst_surface:fill_color(self.color, self.x-self.time*16, self.y-self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x+self.time*16, self.y-self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x-self.time*16, self.y+self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x+self.time*16, self.y+self.time*16, 1, 1)
  else
    --dst_surface:clear()
  end
end

return particle_system

New map script:
Code: [Select]
local map = ...
local game = map:get_game()
local particle_system = require("particles")
local emitter = particle_system:new(game)

function sensor:on_activated()
  emitter:set_type("sparkle")
  emitter:set_position(100, 100)
  emitter:set_particle_count(50)
  emitter:set_decay_time(10)
  emitter:initialize()
  sol.timer.start(map, 1000, function()
    if emitter ~= nil then emitter:on_update(1) end
    return true
  end)
end

function map:on_draw(dst_surface)
  if emitter ~= nil then emitter:on_draw(dst_surface) end
end

The script now operates without error and as expected, but the display is not correct. I usually only get one particle on screen and it disappears without moving. It probably has to do with the drawing method that I used (dst_surface:fill_color) since I don't know if it allows for multiple fill_color calls on one surface. If all else fails, I can re-write it to use sprites, I just thought this method would be faster.

237
Development / Particle system
« on: June 07, 2014, 07:55:06 am »
I've been playing around with the idea of creating a particle system in pure Lua that can run on the Solarus engine. Unfortunately, I'm pretty new to Lua and the draft that I'm working on now doesn't appear to be working. I think the idea behind it is sound, but I can't get it to display correctly so I can test it!

particles.lua (based off of a Love engine particle system, found at https://github.com/SimonLarsen/sienna/blob/master/particles.lua)
Code: [Select]
local particle_system = {}

function particle_system:new(game)
  local object = {}
  setmetatable(object, self)
  self.__index = self
  object:initialize(game)
  return object
end

function particle_system:initialize(game)
  self.game = game
  if not self.time then self.time = 1 end
  if not self.count then self.count = 5 end
  if not self.color then self.color = {255, 255, 255} end

  if self.type == "sparkle" then
    self.alive = true
    self.particles = {}
    for i=1, self.count do
      self.particles[i] = {}
      self.particles[i].x = x
      self.particles[i].xspeed = math.random(-100,100)
      self.particles[i].y = y
      self.particles[i].yspeed = math.random(-200,50) + (self.ysp or 0)
    end
    return self
  elseif self.type == "dust" then
    self.alive = true
    self.time = 0
    self.x = x
    self.y = y
    return self
  end
end

function particle_system:on_update()
  self.time = self.time - 1

  if self.type == "sparkle" then
    if self.time < 0 then
      self.alive = false
      return
    end
    for i,v in ipairs(self.particles) do
      v.x = v.x + v.xspeed*dt
      v.yspeed = v.yspeed + 500*dt
      v.y = v.y + v.yspeed*dt
    end
  elseif self.type == "dust" then
    if self.time > 0.25 then
      self.alive = false
      return
    end
  end
end

function particle_system:on_draw(dst_surface)
  if self.type == "sparkle" then
    for i,v in ipairs(self.particles) do
      dst_surface:fill_color(self.color, 0.5+v.x, 0.5+v.y, 1, 1)
    end
  elseif self.type == "dust" then
    dst_surface:fill_color(self.color, self.x-self.time*16, self.y-self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x+self.time*16, self.y-self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x-self.time*16, self.y+self.time*16, 1, 1)
    dst_surface:fill_color(self.color, self.x+self.time*16, self.y+self.time*16, 1, 1)
  else
    dst_surface:clear()
  end
end

function particle_system:set_type(type)
  self.type = type
end

function particle_system:set_position(x, y, layer)
  self.x = x
  self.y = y
  self.layer = layer or 1
end

function particle_system:set_particle_count(count)
  self.count = count
end

function particle_system:set_particle_color(color)
  self.color = color
end

function particle_system:set_decay_time(time)
  self.time = time
end

function particle_system:set_y_speed(ysp)
  self.ysp = ysp
end

return particle_system

An example map script:
Code: [Select]
local map = ...
local game = map:get_game()
local particle_system = require("particles")

function sensor:on_activated()
  local emitter = particle_system:new(game)
  emitter:set_type("sparkle")
  emitter:set_position(100, 100)
end

function map:on_update()
  if emitter ~= nil then emitter:on_update() end
end

function map:on_draw(dst_surface)
  if emitter ~= nil then emitter:on_draw(dst_surface) end
end

Any thoughts? Is this a lost cause or am I just way off base?

238
Development / Re: Referencing global timers
« on: May 25, 2014, 11:07:02 pm »
Still chugging along! Thanks your all your great work on this engine!

239
Development / Re: Referencing global timers
« on: May 20, 2014, 03:19:33 am »
Works perfectly now - you're amazing! Thanks!

As far as the savegame variables - I fall into the same category as ZSDX on this one. I've been following the engine from the beginning and developing very early on, so I already had a large number of savegame variables established and it was easier to stick with the numbers. I have a system in place now and I actually like them! :-)

240
Development / Re: Referencing global timers
« on: May 19, 2014, 02:06:39 pm »
Hmm... I think I understand what you're saying. My case is a tricky one though. It's basically a race that takes place over two different maps. So regardless of which map you're on, when the timer runs out, you lose the race. This is why I was hoping the timer callback would be persistent. I had even declared that end_race_lost function in each map, and it still didn't appear to be working. For reference, here's the function (those torch entities exist on both maps):

Code: [Select]
sol.audio.play_sound("wrong")
game:set_value("i1028", 4);
torch_1:get_sprite():set_animation("unlit")
torch_2:get_sprite():set_animation("unlit")
torch_3:get_sprite():set_animation("unlit")
game.race_timer = nil


Do you know of any way to make this work?

Pages: 1 ... 14 15 [16] 17 18