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

#16
Hi,
I'm on th version 1.5.2 and I create an item to allow the hero to walk on specific grounds (spikes, lava...). I managed to create a custom entity and the hero can walk on it.
Now I just want the entity to be created only on there specific grounds.
I use the function "get_facing_entity" (lign 66) to get the entity in front of the hero and my variable got the delicious name "0x063b4a08" (or something like that).

Do you know if it is a bug or not ?

My code:
Code (lua) Select

local item = ...
local game = item:get_game()
---------------------------------------
function item:on_created()
  self:set_savegame_variable("slim_stick")
  self:set_assignable(true)
end
---------------------------------------
function item:on_obtaining()
  game:set_item_assigned(1,self)
end
---------------------------------------
local function enabled_custom(name_ent) --Timer on custom entity
  local map = item:get_map()
  local custo_ent = map:get_entity(name_ent)
  sol.timer.start(5000, function()
    custo_ent:set_enabled(false)
    end)
end
---------------------------------------
function item:on_using()
local map = item:get_map()
local hero = map:get_hero()

-- Coordinates Hero
  local hero_x, hero_y, hero_layer = hero:get_position()
  local direction = hero:get_direction()

-- Slim position
  local slim_x, slim_y

if direction == 0 then
    slim_x = hero_x + 24
    slim_y = hero_y
  elseif direction == 1 then
    slim_x = hero_x
    slim_y = hero_y - 24
  elseif direction == 2 then
    slim_x = hero_x - 24
    slim_y = hero_y
  elseif direction == 3 then
    slim_x = hero_x
    slim_y = hero_y  + 24
  end

-- Slim creation
local tai_hitbox = 48
spot_slim = map:create_custom_entity{
    name = "slim",
    layer = hero_layer,
    x = slim_x,
    y = slim_y,
    width = tai_hitbox,
    height = tai_hitbox,
    direction = direction,
    sprite = "entities/spot_slim"
    }

-- Bigger hitbox
spot_slim:set_origin(tai_hitbox/2, tai_hitbox/2)

-- Ground modification
spot_slim:set_modified_ground("traversable")

-- Test to determinate the type of the ground in front of the hero
local ground_entity = hero:get_facing_entity()
  print(ground_entity)

-- End of the function
local name_slim = spot_slim:get_name()
  item:set_finished()
enabled_custom(name_slim)
end

#17
"All updates were successful!"

Thank you !  ;)
#18
Hi !
I also create a game with Solarus. From the beginning, I worked on the version 1.4.5 and I want to pass on the latest. I downloaded the version 1.5.2 and, when I want to upgrade, I got this message box (In attachment).

Someone knows how to fix it ?