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

Topics - Starlock

#1
Development / Ground sprite changed on map change
December 21, 2020, 05:29:32 PM
I was remaking my custom grass to be more optimal by using a modified ground with an animation change to the grass sprite. It works perfectly except for when you go to a different map it will change back to the default animation for a second before changing back to the modified animation. Does anyone know of any workaround, I've tried using map:on_started(), map:on_finished(), game:on_map_changed() and none of these so far have worked.

  entity:add_collision_test("overlapping", function(entity, hero)
    if hero:get_sprite("ground") ~= nil then
    hero:get_sprite("ground"):set_animation("purple")
    end
  end)
#2
I had always used 1.6.0 and had no problems, but I recently started using 1.6.4 and now whenever I use save and continue or dont save and continue at the game over screen the game crashes. Is there any known issue regarding game:start() ?
#3
Your projects / Long Steel
September 27, 2019, 03:07:31 PM
Hello, everyone. I've finally decided it was time for me to try and do a closed beta of my game, Long Steel.

Long Steel centers around a devious plot by the Wicken Cult to revive the Shaper of Magic, Warlock. The cultist's leader, Vex sets out on his plan to obtain Warlock's ashes, and return him to the Physical Realm. In order to stop him, you must set out on a quest to secure the ashes before Vex is able to get them. Fail to find the ashes before the Wicken do, and the world will plunged into darkness forever.

I've been working on this game in my spare time for the past four years now and I hope that some of you might be interested in helping me test it. I'm looking for all forms of feedback.

There are still some issues that aren't entirely worked out, but I feel that the game in its current iteration is well suited enough to begin proper testing. If anybody is interested please send me a PM with your gmail account. I'm going to be handing out the project via Google Drive. Thanks!


#4
Development / Half of tileset data gone?
April 25, 2019, 04:46:09 PM
Hey, so I was working on maps and adding on to tilesets and then when I went to run the game it said there was an error loading overworld.dat. When I went to check the file, like half of the tiles where gone the file was basically cut in half. Anyone got any idea how this could happen? I'm gonna have to reload via a system restore and work with what I can.
#5
Development / Will reflections be possible in 1.6
November 12, 2018, 05:25:35 PM
With 1.6 will it be possible to make reflections like for a mirror or water?
#6
I'm trying to check a carried objects position so that its sprite will change to a falling effect when it lands on a hole. However, I'm having an issue where the effect will happen for every hole tile it goes over and I only want the effect to happen on the tile that it lands on not every tile that it goes over while being thrown.
#7
Development / Problem with thrown enemies after pause
August 08, 2018, 04:37:45 AM
When I lift a destructible object, and then pause and check the Info of an item, the action command no longer allows the hero to thrown the object. This only seems to happen when the info message is used. Does anybody have any idea what could be a likely cause of this?

EDIT: I've tested it further, and this will happen no matter what whenever any dialog is opened while paused
#8
Development / Multiple enemies not acting the same
August 06, 2018, 06:18:11 AM
I have an enemy that creates small spheres that circle around the enemy and are thrown at the hero. However, when I have 2 enemies, only one of them will do the proper attack.

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

local can_shoot = true


local sprite = nil
local nb_bats_created = 0
local nb_to_create = 0
local raintimer = nil

function enemy:on_created()
  -- Set properties.
  self:set_life(4); self:set_damage(6); self:set_hurt_style("normal")
  self:set_pushed_back_when_hurt(true); self:set_push_hero_on_sword(false)
  self:set_traversable(true)
  -- Create sprite if necessary, etc.
  sprite = self:get_sprite()
  if not sprite then sprite = self:create_sprite("enemies/more/dark/rainbow") end
  function sprite:on_animation_finished(animation)
  if animation == "looking" then sprite:set_animation("stopped") end --***
  end
  -- Start enemy.
  self:restart()
end



local function go_hero()

  local map = enemy:get_map()
  local hero = map:get_hero()

  if enemy:get_distance(hero) < 120 then

  local sprite = enemy:get_sprite()
  sprite:set_animation("walking")
  local movement = sol.movement.create("target")
  movement:set_speed(64)
  movement:start(enemy)

  else

  local sprite = enemy:get_sprite()
  sprite:set_animation("walking")
  local movement = sol.movement.create("random")
  movement:set_speed(64)
  movement:start(enemy)
  end
end




function enemy:attack()



  if jumping or attacking then
    return
  end

  if cancel_next_attack then
    cancel_next_attack = false
    return
  end

  attacking = true
  sprite:set_animation("shooting")

  local prefix = "bat" .. "_bat_"
  nb_to_create = 6

  function repeat_throw_bat()

    sol.audio.play_sound("lamp")
    nb_bats_created = nb_bats_created + 1
    local son_name = prefix .. nb_bats_created
    local son = enemy:create_enemy{
      name = son_name,
      breed = "more/dark/rainattack",
      x = 0,
      y = 0,
      layer = 0,
    }
    if math.random(6) == 1 then
      son:set_treasure("magic_flask", 1)
    end
    son:go_circle(enemy)
    local go_hero_delay = 2000 + (nb_to_create * 150)
    sol.timer.start(son, go_hero_delay, function() son:go_hero() end)

    nb_to_create = nb_to_create - 1
    if nb_to_create > 0 then
      raintimer = sol.timer.start(enemy:get_map(), 350, repeat_throw_bat)
    else
      attacking = false
      attack_scheduled = false
      if not vulnerable then
  sol.timer.start(2000, function()
go_hero()
  end)
      else
cancel_next_attack = false
      end
    end
  end
  enemy:stop_movement()
  enemy:get_sprite():set_direction(0)
  repeat_throw_bat()
end

function enemy:on_hurt()
  nb_to_create = 0
  if raintimer ~= nil then
  raintimer:stop()
  end
  enemy:get_map():remove_entities("bat" .. "_bat_")
end

function enemy:on_dying()
  nb_to_create = 0
  if raintimer ~= nil then
  raintimer:stop()
  end
  enemy:get_map():remove_entities("bat" .. "_bat_")
end

function enemy:on_restarted()

  local map = enemy:get_map()
  local hero = map:get_hero()

  go_hero()

  can_shoot = true

  sol.timer.start(enemy, 100, function()

    local hero_x, hero_y = hero:get_position()
    local x, y = enemy:get_center_position()

    if can_shoot then
if enemy:get_distance(hero) < 150 then
        attack()
        can_shoot = false
        sol.timer.start(enemy, 6666, function()
          can_shoot = true
        end)
      end
    end
    return true  -- Repeat the timer.
  end)
end

function enemy:on_movement_changed(movement)

  local direction4 = movement:get_direction4()
  local sprite = self:get_sprite()
  sprite:set_direction(direction4)
end

#9
Development / What changed in 1.5.3?
June 01, 2018, 06:13:51 PM
Hey, I created a custom grass entity in 1.5.0. Everything worked fine until I downloaded 1.5.3, and now there'es a problem. The code creates grass beneath the hero that normally disappears when the hero leaves the grass or cuts the grass down, but in 1.5.3 the grass doesn't disappear anymore.

This is the code:

Code ( lua) Select

local entity = ...
local game = entity:get_game()
local map = entity:get_map()
local hero = map:get_hero()
local grass = false

local function resetherospeed()
local hero = map:get_hero()
  hero:set_walking_speed(88)
end





local function on_collision(torch, other, torch_sprite, other_sprite)

  if other:get_type() == "custom_entity" then

    local other_model = other:get_model()
    if other_model == "fire" or other_model == "bluefire" then

    local x, y, layer = entity:get_position()
    map:create_pickable({layer = layer, x=x, y=y, treasure_name="random"})

  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y, width = 40, height = 56, model="ground_effects/falling_leaves", name = "leaves"})

    entity:remove()

sol.timer.start(350, function()
  local x,y, layer = entity:get_position()
 
if other_model == "fire" then

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y + 16, width = 16, height = 16, model="fire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y - 16, width = 16, height = 16, model="fire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x + 16,y=y, width = 16, height = 16, model="fire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x - 16,y=y, width = 16, height = 16, model="fire"})

elseif other_model == "bluefire" then

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y + 16, width = 16, height = 16, model="bluefire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y - 16, width = 16, height = 16, model="bluefire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x + 16,y=y, width = 16, height = 16, model="bluefire"})

map:create_custom_entity({direction=0,
    layer=layer,x=x - 16,y=y, width = 16, height = 16, model="bluefire"})

end

  end)
    end

  end
end




-- Event called when the custom entity is initialized.
function entity:on_created()

  self:set_size(16, 16)
  self:set_modified_ground("traversable")
  self:set_traversable_by("hero", true)
  self:create_sprite("entities/grass")

  self:add_collision_test("center", function(entity, hero)



    if not grass then
     
      if hero:get_animation() == "walking" or hero:get_animation() == "walking_with_shield" or hero:get_animation() == "rolling" or hero:get_animation() == "carrying_walking" and not grass then
grass = true

    print(hero:get_walking_speed())

grass = false
        local x, y, layer = hero:get_position()

if not map:get_entity("leaves") then

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y, width = 40, height = 56, model="ground_effects/falling_leaves", name = "leaves"})

end

      sol.timer.start(300, function()
  return true



      end)

      end
    end

        local x, y, layer = hero:get_position()

if not map:get_entity("grassprite") then

map:create_custom_entity({direction=0,
    layer=layer + 1,x=x,y=y, width = 16, height = 16, model="ground_effects/grass", name = "grassprite"})

end

  end)


  sol.timer.start(entity, 30, function()

    -- Save or clear solid ground position on this platform.
    if self:is_on_platform(hero) and (hero:get_state() == "free" or hero:get_state() == "carrying") then

hero:set_walking_speed(70)

   elseif self:is_on_platform(hero) and hero:get_state() == "sword_loading" then

hero:set_walking_speed(29)






    elseif (not self:is_on_platform(hero)) and (hero:get_state() == "free" or hero:get_state() == "carrying") then

    hero:set_walking_speed(88)

  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

    elseif (not self:is_on_platform(hero)) and hero:get_state() == "sword_loading" then

    hero:set_walking_speed(29)

  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

------------------------------------------

  else


  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

-------------------------------------------

    end

 

    return true
  end)

  entity:add_collision_test("sprite", function(entity, other_entity, sprite, other_sprite)
    -- Do nothing if the animation set is not of the sword, or if the sword is not close enough.
    if other_sprite == nil then return end
    local animation_set = other_sprite:get_animation_set()
    local sword_id = map:get_hero():get_sword_sprite_id()
    if animation_set ~= sword_id then return end
    if entity:get_distance(other_entity) > 28 then return end -- Set a max distance to cut.

    local x, y, layer = entity:get_position()
    map:create_pickable({layer = layer, x=x, y=y, treasure_name="random"})

  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y, width = 40, height = 56, model="ground_effects/falling_leaves", name = "leaves"})

    entity:remove()

  end)




  entity:add_collision_test("center", function(entity, hookshot)

  if hookshot:get_sprite():get_animation() == "hook" then

    local x, y, layer = entity:get_position()
    map:create_pickable({layer = layer, x=x, y=y, treasure_name="random"})

  if map:has_entity("grassprite") then
    map:get_entity("grassprite"):remove()
  end

map:create_custom_entity({direction=0,
    layer=layer,x=x,y=y, width = 40, height = 56, model="ground_effects/falling_leaves", name = "leaves"})

    entity:remove()
    end

  end)




end


function entity:is_on_platform(other)
  local x, y, layer = hero:get_position()
  return entity:overlaps(x, y)
end

entity:add_collision_test("sprite", on_collision)
entity:add_collision_test("overlapping", on_collision)



#10
Development / How to create entity over hero?
April 09, 2018, 03:39:39 AM
So I'm trying to create an entity that overlaps the hero,but whenever I attempt this the hero is always on top. The only way I've found to fix this problem is by setting the entity to the hero's layer + 1, but this leads to other graphical issues, so it really needs to be on the hero's layer.
#11
Development / Are attack combos possible
January 27, 2018, 11:16:18 PM
I've taken a break from development for a while to work on musics and to focus on college, but I'm thinking of ideas for when I start working again and was wondering if commands and keys can be combined to create different sword attacks.

Like if you use "attack" while holding a direction the hero will lunge in that direction.

There is also a custom roll code I have done that freezes the hero and makes him roll forward then unfreezes him. Would there be a way to combine the roll with attack to make a kind of "sword roll"  or would this not work since the hero is frozen?
#12
Development / Issue with playing music
January 18, 2018, 09:52:14 PM
Whenever I go from one map to another, the song will restart despite it being the same song. I'm calling the sol.audio.play_music(music_id, [action]) from inside of the map:on_started() since there are three different songs that can play depending on your progress in the game. What do I need to do to stop the music from restarting?
#13
Development / How do drawables work
November 23, 2017, 06:08:43 AM
I'm trying to make a sort of mirror using a sensor that enables a sprite using the hero sprite. I want to keep the hero sprite only within the box of the mirror and to not show any of the sprite outside of the mirror and drawable:draw_region() sounds like its something that could work, but I'm not exactly sure how to use it.
#14
Development / Can an enemy activate a switch?
October 26, 2017, 08:06:15 AM
I'm trying to make a projectile that activates a switch, but when I put in enemy:overlaps(entity) an error comes up saying that it expects an integer so I'm not sure what to do for this.
#15
Development / Multiple ground sprites?
August 10, 2017, 06:23:19 PM
Is it possible to have multiple ground sprites for the same ground? Like if you have grey grass and green grass you would have different ground sprites for the hero depending on which color grass you are in.
#16
Development / How does the overworld map menu work?
July 16, 2017, 05:35:13 AM
Like the title says, I'm starting to try and make the overworld map for my quest,  but I'm not sure how to properly draw out the map? Does every 320x240 map become a 32x24 square on the overworld map? I just need someone to clearly state what would be the best way to tackle creating the world map. Thanks  :)
#17
Development / Stop slide on ice?
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
#18
Development / Problem with timer
May 29, 2017, 09:48:25 PM
I'm trying to make a bridge that appears when at least one of three torches is lit. I'm having trouble making the timer work properly, since once the timer finishes there's a delay before it can activate again so you can't light the torch again in that time frame. Is there a way to make the timer instantly be activatable again after it finishes?

Here is my code(It is part of function map:on_update()):
Code ( lua) Select

  if torch_light:get_sprite():get_animation() == "lit" or torch_light_2:get_sprite():get_animation() == "lit" or
  torch_light_3:get_sprite():get_animation() == "lit" then
      map:set_entities_enabled("torchbridge", true)
        sol.timer.start(3500, function()

          map:set_entities_enabled("torchbridge", false)
torch_light:get_sprite():set_animation("unlit")
torch_light_2:get_sprite():set_animation("unlit")
torch_light_3:get_sprite():set_animation("unlit")
      end)
    end
#19
Development / How to specify custom attack sprite
December 29, 2016, 06:07:52 PM
I'm trying to create a boss that can only be hurt when attacked by a thrown item with a specific sprite but I'm not sure how to call the thrown items sprite in the enemy code.

Code ( lua) Select
function enemy:on_custom_attack_received(attack, sprite)
  if attack == "thrown_item" and attack:get_sprite() == "entities/boss3block" then
  enemy:hurt(1)
  enemy:remove_life(1)
  end
end


This was my attempt but it gives me an error that the get_sprite() is calling a nil value
#20
Development / Can fire have variants?
October 30, 2016, 04:16:45 AM
Would it be possible for fire to have multiple variants for something like a special ice block that could only be melted by a higher level version of fire?