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

#61
Development / Re: Scrolling dialog selections?
March 17, 2016, 03:30:43 AM
Forgot about this for a while, coming back to it now. I'm using Diarandor's current dialog box as a point of reference, but I kinda need a push in the right direction, I'm not too sure where to begin with this atm  ???
#62
Development / Entity not working, no error
March 10, 2016, 03:15:10 AM
I'm trying to make a vine entity that can only be destroyed by using fire. There's no error, but the entity doesn't get destroyed when fire is used.
Code ( lua) Select
local entity = ...
local map = entity:get_map()

function entity:on_created()
  self:set_size(16, 16)
  self:set_traversable_by("hero", false)
  self:create_sprite("entities/bush_vine")

    if entity:get_type() == "fire" then
      sol.audio.play_sound("jump")
      self:remove()
   end
end

function entity:on_removed()
  self:get_sprite():set_animation("destroy")
end
#63
Development / Re: Scrolling dialog selections?
February 12, 2016, 03:09:43 AM
Would a new dialog box have to be coded or are zsdx or roth usable. Right now using a dialog box similar to the zsdx one I am only able to make 2 choice questions rather than a bunch of choices that you can scroll through.
#64
Development / Re: Scrolling dialog selections?
February 09, 2016, 10:15:24 PM
So would a crafting system be something viable just using the dialog box?
#65
Development / Scrolling dialog selections?
February 09, 2016, 06:18:52 PM
Hey, I'm planning to implement a crafting system that involves talking to NPCs and they will show a selection of craftables and the regents required to make them. I figured it would be easier to make this as a dialog that displays craftables and checks if you have the regents when you select it. Is it possible to have more than 4 selection in a dialog that you can scroll through or would I have to create a menu for a crafting system to be possible
#66
General discussion / NPCs
February 05, 2016, 05:51:10 PM
Hello everyone, I've been steadily working on my project and am currently making graphics for NPCs. I figured since everyone in the forums have been so helpful that if you want, I can draw in an avatar or whatever you want as an NPC in the game. If anyone is interested, write here or shoot me a PM about a general idea of what you want the NPC to look like and what you want the NPC to say/do.  ;)
#67
Development / Re: Diablo like health/magic?
January 31, 2016, 12:04:01 AM
I made the "bar" for the health on the top left corner which is why i set the region coordinates for the code at 0,0 and the orb size is about 48x48. I'm not too sure what change I should make...
#68
Development / Re: Diablo like health/magic?
January 30, 2016, 04:56:15 PM
I finally started working on the code for this...

Code ( lua) Select
-- DIABLO STYLE HEALTH ORB

local life_bar = {}

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

  object:initialize(game)

  return object
end

function life_bar:initialize(game)
  self.game = game
  self.surface = sol.surface.create(48, 48)
  self.life_bar_img = sol.surface.create("hud/health_orb.png")
  self.container_img = sol.surface.create("hud/health_orb.png")
  self.life_displayed = game:get_life()
  self.max_life_displayed = 0

  self:check()
  self:rebuild_surface()
end

-- Checks whether the view displays the correct info
-- and updates it if necessary.
function life_bar:check()
  local need_rebuild = false
  local max_life = self.game:get_max_life()
  local life = self.game:get_life()

  -- Maximum health
  if max_life ~= self.max_life_displayed then
    need_rebuild = true
    if self.life_displayed > max_life then
      self.life_displayed = max_life
    end
    self.max_life_displayed = max_life
  end

  -- Current health
  if life ~= self.life_displayed then
    need_rebuild = true
    local increment
    if life < self.life_displayed then
      increment = -1
    elseif life > self.life_displayed then
      increment = 1
    end
    if increment ~= 0 then
      self.life_displayed = self.life_displayed + increment

      if (life - self.life_displayed) % 10 == 1 then
--sol.audio.play_sound("magic_bar")
      end
    end
  end

  -- Redraw the surface only if something has changed.
  if need_rebuild then
    self:rebuild_surface()
  end

  -- Schedule the next check.
  sol.timer.start(self.game, 20, function()
    self:check()
  end)
end

function life_bar:rebuild_surface()
  self.surface:clear()

  -- Max health
  self.container_img:draw(self.surface)

  -- Current health
  self.life_bar_img:draw_region(0, 0, 2 + self.life_displayed, 8, self.surface)
end


function life_bar:set_dst_position(x, y)
  self.dst_x = x
  self.dst_y = y
end

function life_bar:on_draw(dst_surface)
  if self.max_life_displayed > 0 then
    local x, y = self.dst_x, self.dst_y
    local width, height = dst_surface:get_size()
    if x < 0 then
      x = width + x
    end
    if y < 0 then
      y = height + y
    end

    self.surface:draw(dst_surface, x, y)
  end
end

return life_bar



It displays the graphic of the orb but I'm not sure how to make the bar go down vertically since the code was taken from the horizontal magic bar..  :-\

http://imgur.com/Rnxd22S
#69
Thanks frog! I'll test it out on my game as soon as I get the chance. :D
#70
Development / Re: problem with doors
January 18, 2016, 06:29:56 PM
The code seems to be giving me the error

Error: Failed to load script 'maps/dungeons/dungeon1floor1': [string "maps/dunge
ons/dungeon1floor1.lua"]:14: '<eof>' expected near 'end'
Error: In maps/dungeons/dungeon1floor1: attempt to call a string value
#71
Development / problem with doors
January 14, 2016, 04:01:49 PM
I've been working on dungeon design,and have been using the door_manager code. I'm having a couple probelms, but with that code, one door will open when one auto_enemy is killed and the rest will open after the others are killed.

And in the code of one map:

Code ( lua) Select
local map = ...
local game = map:get_game()

local door_manager = require("maps/lib/door_manager")
door_manager:manage_map(map)

function map:on_started()
  function map:on_started()
  if not game:get_value("dun1keyy") then chest_key:set_enabled(false) end
end

  map:set_doors_open("auto_door_f", true)


  self.night_overlay = sol.surface.create()  -- Create an empty surface of the size of the screen.
  self.night_overlay:set_opacity(152)        -- Make it semi-transparent (0: transparent, 255: opaque).
  self.night_overlay:fill_color({195, 24, 24})  -- Fill it with dark blue to obtain a night effect.
end
function map:on_draw(destination_surface)
  self.night_overlay:draw(destination_surface)
end

function bridge_switch:on_activated()

  sol.audio.play_sound("secret")
  map:set_entities_enabled("bridge_tile", true)
end

function close_auto_door_f_sensor_1:on_activated()

  if auto_door_f:is_open()
      and map:has_entities("auto_enemy_auto_door_f") then
    map:close_doors("auto_door_f")
  end
end

for enemies in map:get_entities("auto_enemy_auto_door_f") do
  enemies.on_dead = function()
    if not map:has_entities("auto_enemy_auto_door_f") and not game:get_value("dun1keyy") then
      chest_key:set_enabled(true)
      sol.audio.play_sound("chest_appears")
    end
  end
end


the auto_door_f wont reopen after the enemies are killed and the chest_key doesn't start out false
#72
Development / Epona
January 09, 2016, 03:57:45 AM
Would there be a  way to code a horse like Epona that the hero would be able to ride? And would it be considered a custom entity or some sort of NPC
#73
Development / Possible to create a level up system?
January 05, 2016, 05:18:37 AM
For my game, I want to create a leveling system that is a mix of ideas between Zelda 2 and Skyrim. Every time you reach a new level you can choose to raise either health, magic, or stamina with a max level of 10 for each, making a maximum total level of 30.

First off, is such a system possible with the engine. Second, if it is how would I get started creating it?
#74
Development / Different crystals for every dungeon
January 03, 2016, 05:38:43 AM
Hey, I was working on making crystal/crystal block sprites for dungeons. Is there a way for every dungeon to have a different sprite for crystals rather than all of them using the same ones?
#75
Development / Bomb Soldiers?
January 02, 2016, 05:53:37 PM
I noticed while looking through the zsdx and roth repositories that there were no bomb or bow soldiers. Is it possible to make an enemy that throws bombs?