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

Pages: [1] 2
1
Hello guys,
I want to know if is it possible to disable the dying sound when an enemy is killed ?

Because, when I kick the boss, I "remove_life" the enemies around in the same time. And in this way, the sound is played for each in the same time (and it is horrible for my ears  ;D).

Do you have any idea ?

2
Development / Re: Sprites not visible when entities created
« on: April 01, 2020, 03:58:20 pm »
Hello guys,

I checked the position and I saw the sprite are displayed outside the screen. I didn't indicate the correct position for them  ;D
Thanks for your comment Froggy and Diarandor  ;)

3
Development / [Solved] Create a new "attack_consequence"
« on: April 01, 2020, 03:54:49 pm »
I just go back on this problem and I sucess. I just forgot to check the "quest.manager.lua" in which the function "receive_attack_consequence" are.

Thanks to you Christopho (3 years later ;D )

4
Development / Re: Sprites not visible when entities created
« on: March 29, 2020, 01:21:56 pm »
Hi Max,
I use "enemy:create_enemy()" in this case.
When I used the optional variable "sprite" in it, it didn't work. So I added manually the animation. But I still have nothing.

Here you can see the code (where I create the new enemies) on your phone ;)
Code: [Select]
local enemy = ...
local game = enemy:get_game()
local map = enemy:get_map()
local hero = map:get_hero()


-- Distance entre entité
local x_CS = 20 -- Position shoulder
local x_SO = 20
local x_OA = 20
local x_AH = 20
local y_CH = 34

-- Position orb
local x_CO = x_CS + x_SO

-- Position arm
local x_CA = x_CO + x_OA

-- Position dragons
local x_CH =  x_CA + x_AH
local x_CH_n = -x_CH
local y_CH_n =  -y_CH


local properties = {
  life = 2,
  damage = 2,
  speed_ground = 0,
  movement_ground = "random",
  }

local max_life = properties.life
local body_sprite


-----------------------------------------------------
--01. Creation of the boss
function enemy:on_created()

  enemy:set_life(max_life)
  enemy:set_damage(properties.damage)
  enemy:set_hurt_style("boss")
  enemy:set_treasure("heart_container")
  enemy:set_attack_consequence("explosion", "ignored")
  enemy:set_attack_consequence("sword", "protected")
  body_sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())

local x_boss,y_boss,layer_boss = enemy:get_position()
  enemy:create_part_boss("shoulder","boss/boss2_tentacle","shoulder",x_boss,y_boss,layer_boss,x_CS,y_CH)
  --enemy:create_part_boss("orb","boss/boss2_tentacle","orb",x_boss,y_boss,layer_boss,x_CO,y_CH)
  --enemy:create_part_boss("arm","boss/boss2_tentacle","arm",x_boss,y_boss,layer_boss,x_CA,y_CH)
  --enemy:create_part_boss("dragons","boss/boss2_dragons","stopped",x_boss,y_boss,layer_boss,x_CH,y_CH)

end

-----------------------------------------------------
--02. When the boss moves
function enemy:on_restarted()

local x_boss,y_boss,y_layer = enemy:get_position()
  movement = sol.movement.create("target")
  movement:set_target(hero)
  movement:set_speed(properties.speed_ground)
  movement:start(enemy)

end

-----------------------------------------------------
--03. Create parts of boss
function enemy:create_part_boss(var_name,var_breed,var_animation,var_x_boss,var_y_boss,var_layer_boss,var_x,var_y)
  for i =1,4 do
--if i == 1 then
map:create_enemy{
  name = var_name,
  layer = var_layer_boss,
  x = var_x_boss + var_x,
  y = var_y,
  direction = 1,
  breed = var_breed,
  }
--end
end

-- Set the right animation
for entity in map:get_entities(var_name) do
entity:get_sprite():set_animation(var_animation)
end
end
-----------------------------------------------------
--03.A Create the shoulders
--function enemy:create_shoulders(var_x,var_y,var_layer)
--
--shoulder_1 = map:create_enemy{
--  name = "shoulder",
--  layer = var_layer,
--  x = var_x + x_CS,
--  y = var_y + y_CH,
--  direction = 0,
--  breed = "boss/boss2_tentacle",
--  }
-- 
---- Set the right animation
--for entity in map:get_entities("shoulder") do
--  entity:get_sprite():set_animation("shoulder")
--end
--
--end
--

-----------------------------------------------------
--04. When the boss is dead
function enemy:on_dead()
game: set_value("defeated_boss",2)
--map:open_doors("door_boss_") ouvrir les portes de sortie
sol.audio.stop_music()
end

-----------------------------------------------------
--05. Move heads based on the boss's movement
function enemy:on_position_changed(x_move, y_move, layer_move)
    head_1:move_head(x_move + x_CH,y_move + y_CH,layer_move)
    head_2:move_head(x_move + x_CH_n,y_move + y_CH,layer_move)
end

5
Development / [Solved] Sprites not visible when entities created
« on: March 26, 2020, 08:15:39 pm »
Hello guys, it is been a long time I don't write in this forum ;)

I've got a problem when I create a boss with separated parts. I successed to create all these parts one by one with no issue (for example function "3A. create_shoulder" in the "boss2_crane" file) ... But I want to optimise my script with the new function "03. create_part_boss".

However, when I use this function, the sprite of these part are not visible in the map.
But, thanks to my print, I know these entities are created.

Do you have any idea ?

PS:
The scripts are attached (sorry for the franglish  ;D )

6
Development / Create a new "attack_consequence"
« on: April 29, 2017, 11:58:58 am »
I adapt my script with your but  I don't really understand how the functions work  :-\
When I attack the enemy with the pickaxe, nothing happen.

Item code:
Code: (lua) [Select]
local item = ...
local game = item:get_game()

function item:on_created()
  item:set_savegame_variable("possession_pickaxe")
  item:set_assignable(true)
  item:set_destroy_block(false)
end

function item:on_using()
  local map = item:get_map()
  local hero = map:get_hero()
  hero:freeze()

-- Handle block
  item:set_destroy_block(false)
  sol.timer.start(map, 200, function()
    if item:has_destroy_block() then
  sol.audio.play_sound("stone")  -- sucessfully destroy rocks
else
  sol.audio.play_sound("sword_tapping")
end
item:set_destroy_block(false)
  end)
 
-- Hero coordonates
  local x, y, layer = hero:get_position()
  local direction = hero:get_direction()
 
  if direction4 == 0 then x = x + 12
  elseif direction4 == 1 then y = y - 12
  elseif direction4 == 2 then x = x - 12
  else y = y + 12
  end
 
-- Create pickaxe and collisions
  local pickaxe = map:create_custom_entity{
    x = x,
    y = y,
    layer = layer,
    width = 8,
    height = 8,
    direction = 0,
    }
  local entities_touched = { }
  pickaxe:set_origin(4, 5)
  pickaxe:add_collision_test("overlapping", function(pickaxe, entity)
 
    -- Hurt enemies
if entity:get_type() == "enemy" then
  local enemy = entity
    if entities_touched[enemy] then
  -- If protected we don't want to play the sound repeatedly.
          return
        end
entities_touched[enemy] = true
local reaction = enemy:get_pickaxe_reaction(enemy_sprite)
enemy:receive_attack_consequence("pickaxe", reaction)
end
  end)

--## Launch animation
hero:set_animation("pickaxe")
sol.timer.start(600, function()
  hero:unfreeze()
  end)
end

function item:has_destroy_block()
  return item.destroy_block
end

function item:set_destroy_block(destroy_block)
  item.destroy_block = destroy_block
end

---------------------------------------------------------------------------------------
-- Initialize the metatable of appropriate entities to work with the pickaxe-----------
local function initialize_meta()

  --Add Lua pickaxe properties to enemies
  local enemy_meta = sol.main.get_metatable("enemy")
    if enemy_meta.get_pickaxe_reaction ~= nil then
      return
    end

  enemy_meta.pickaxe_reaction = 2 -- 2 damages
  enemy_meta.pickaxe_reaction_sprite = {}
  -----------------------------------------------------------------------
 
  function enemy_meta:get_pickaxe_reaction(sprite)
    if sprite ~= nil and self.pickaxe_reaction_sprite[sprite] ~= nil then
      return self.pickaxe_reaction_sprite[sprite]
    end

    return self.pickaxe_reaction
  end
  ----------------------------------------------------------------------

  function enemy_meta:set_pickaxe_reaction(reaction, sprite)
    self.pickaxe_reaction = reaction
  end
  ----------------------------------------------------------------------
 
  function enemy_meta:set_pickaxe_reaction_sprite(sprite, reaction)
    self.pickaxe_reaction_sprite[sprite] = reaction
  end
  ----------------------------------------------------------------------
  -- Change the default enemy:set_invincible() to also take into account the pickaxe.
  local previous_set_invincible = enemy_meta.set_invincible
  function enemy_meta:set_invincible()
    previous_set_invincible(self)
    self:set_pickaxe_reaction("ignored")
  end
 
  local previous_set_invincible_sprite = enemy_meta.set_invincible_sprite
  function enemy_meta:set_invincible_sprite(sprite)
    previous_set_invincible_sprite(self, sprite)
    self:set_pickaxe_reaction_sprite(sprite, "ignored")
  end

end
initialize_meta()

Enemy code:
Code: (lua) [Select]
local enemy = ...
local game = enemy:get_game()
local map = enemy:get_map()
local hero = map:get_hero()
local body_sprite
local movement
local shield_remove

-- Properties
local life = 2
local damage = 2
local speed = 24
local speed_faster = speed + speed/2

-----------------------------------------
-- Proprieties of the enemy with shield
local function shield_mode()
  body_sprite:set_animation("walking_rock")
  enemy:set_push_hero_on_sword(true)
  enemy:set_attack_consequence("sword", "protected")
  movement = sol.movement.create("target")
  movement:set_target(hero)
  movement:set_speed(speed)
  movement:start(enemy)
end

-----------------------------------------
-- Proprieties of the enemy without shield
local function normal_mode()
  shield_remove = true
  body_sprite:set_animation("walking")
  movement = sol.movement.create("random")
  enemy:set_push_hero_on_sword(false)
  enemy:set_default_attack_consequences()
  movement:set_speed(speed_faster)
  movement:start(enemy)
end

-----------------------------------------
-- When the enemy is hit by a pickaxe (TO CHANGE !)
function enemy:on_custom_attack_received(attack,sprite)
 normal_mode()
end

-----------------------------------------
function enemy:on_created()
  body_sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())
  enemy:set_life(life)
  enemy:set_damage(damage)
  shield_remove = false
  enemy:set_pickaxe_reaction_sprite("attack", body_sprite) -- Initialise shield
end

-----------------------------------------
function enemy:on_restarted()
  if shield_remove == false then
    shield_mode()
  else
    normal_mode()
  end
end

-----------------------------------------
function enemy:on_movement_changed(movement)
  local direction4 = movement:get_direction4()
  local sprite = enemy:get_sprite()
    sprite:set_direction(direction4)
end

7
Development / Create a new "attack_consequence"
« on: April 28, 2017, 03:40:16 pm »
Okay thanks  ;)

8
Development / [Solved] Create a new "attack_consequence"
« on: April 28, 2017, 12:16:07 pm »
Hi  ;D
I create a new item: the pickaxe. It allows the hero to destroy some specifics entities and enemies. I want to know if it is possible to add a new kind of "attack_consequence" (as lign 26).
The principe is to attack a specific enemy class with the pickaxe to destroy their armor and, after, kill them with the sword.

enemy script:
Code: (lua) [Select]
local enemy = ...
local game = enemy:get_game()
local map = enemy:get_map()
local hero = map:get_hero()
local body_sprite
local movement
local shield_remove

-- Properties
local life = 2
local damage = 2
local speed = 24
local speed_faster = speed + speed/2

-----------------------------------------
-- Proprieties of the enemy with shield
local function shield_mode()
  body_sprite:set_animation("walking_rock")
  enemy:set_push_hero_on_sword(true)
  enemy:set_attack_consequence("sword", "protected")
  movement = sol.movement.create("target")
  movement:set_target(hero)
  movement:set_speed(speed)
  movement:start(enemy)

  enemy:set_attack_consequence("pickaxe","custom")-- ??

end

-----------------------------------------
-- Proprieties of the enemy without shield
local function normal_mode()
  shield_remove = true
  body_sprite:set_animation("walking")
  movement = sol.movement.create("random")
  enemy:set_push_hero_on_sword(false)
  enemy:set_default_attack_consequences()
  movement:set_speed(speed_faster)
  movement:start(enemy)
end

-----------------------------------------
-- When the enemy is hit by a pickaxe
function enemy:on_custom_attack_received(attack,sprite)
 normal_mode()
end

-----------------------------------------
function enemy:on_created()
  body_sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())
  enemy:set_life(life)
  enemy:set_damage(damage)
  shield_remove = false
end

-----------------------------------------
function enemy:on_restarted()
  if shield_remove == false then
    shield_mode()
  else
    normal_mode()
  end
end

-----------------------------------------
function enemy:on_movement_changed(movement)
  local direction4 = movement:get_direction4()
  local sprite = enemy:get_sprite()
    sprite:set_direction(direction4)
end

9
Development / Create a custom switch
« on: April 06, 2017, 09:47:24 am »
Ahah okay  ;D
Thanks you Christopho and Zefk !

10
Development / [Solved] Create a custom switch
« on: April 05, 2017, 03:40:30 pm »
Hi everyone,
I would like to create a custom switch. In fact, I have an idea but I prefer ask if there is a better way to script it.
This is my idea: The hero throws a boomerang and activate the switch (which keeps the item). After the switch animation, the boomerang returns to the hero and something happens (for example, opening a door).

I already create a custom entity for the switch and it works when I throw my boomerang. Now, I need to indicate in the game that this custom entity is a switch, because I want to use the function "switch:on_activated" and the other.

Does someone have an idea ?

----------------------------------------------------
Switch code :
Code: (lua) [Select]
local entity = ...

function entity:on_created()
  entity:set_size(32, 24)
  entity:set_origin(16, 21)
  entity:set_traversable_by(false)
  entity:set_drawn_in_y_order(true)
end

entity:add_collision_test("touching", function(entity, other_entity)

  local type = other_entity:get_type()
  local switch_state = entity:get_sprite():get_animation()
    local check = type == "boomerang" and switch_state == "stop_off"

  if check then
    entity:get_sprite():set_animation("activated")
    sol.timer.start(1000, function()
      sol.audio.play_sound("secret")
      entity:get_sprite():set_animation("stop_on")
      entity:clear_collision_tests()
      end)
  end
end)
States :
  # stop_off : the switch is not activated
  # activated : the switch is beins activated (loop animation)
  # stop_on : the switch is activated and unusable

Boomerang code:
Code: (lua) [Select]
local item = ...

function item:on_created()
  item:set_savegame_variable("possession_boomerang")
  item:set_assignable(true)
end

function item:on_using()
  local hero = item:get_map():get_hero()
  hero:start_boomerang(64,160,"boomerang","entities/boomerang")
end

11
Development / Insert sprite before creating an enemy
« on: March 23, 2017, 01:48:58 pm »
Okay, thanks MetalZelda and Diarandor, you're right. It works !!
"My monster is alive... ALIVE !! AhAhAhAh !!"  ;D

12
Development / Insert sprite before creating an enemy
« on: March 21, 2017, 10:27:14 am »
Hi guys,
Thank for the tips. I cut-paste the lign 20 (body_sprite = create_sprite...) in the function "on_created" but it doesn't work yet.
From my point of view, the script is quite good but my first animation "appearing" doesn't have time to be runned completely. The function "on_restarted" is called immediately after "on_created". My first animation takes about 150ms * 13 frames (so, about 2 seconds).
The solution would be to temporize the first animation et after leting the rest of the code run. What do you think ?

A technical suggestion: note that after the last release (or one of the last releases) of Solarus, you can put names to sprites, which is very useful and can be used to get that sprite with no need of storing the sprite in a file-local variable (but you may still need to store it in a function-local variable if you need to do something with it). (Function-local variables are faster to get than file-local variables, and the latter ones are faster to get than global variables.)
Sorry Diarandor, but I'm not sure to understand correctly. Can you explain with a example ?

13
Development / Insert sprite before creating an enemy
« on: March 18, 2017, 06:35:17 pm »
Hi Diarandor,
I don't get any error message. However you're right, I combined the scripts in one (It make more sense). There was also an problem in my sprites, one of them was no loop. I don't no why.

Nevertheless, the animation "appearing" didn't work. I checked if the function "on_created()" was call first and it was... So I don't know how to start it at the beginning of the creation of the entity.

Map code :
Code: (lua) [Select]
local map = ...
local game = map:get_game()
local hero = map:get_hero()
local camera = map:get_camera()
local time_animation = 6000

local first_see = true
local value_boss = game:get_value("defeated_boss")

----------------------------------
function map:on_started()
  map:set_doors_open("door_boss_")
    if value_boss ~= nil then
      for index = 1, 2 do
        map:get_entity("plaque_spike_1_" .. index):set_enabled(false)
        map:get_entity("plaque_spike_2_" .. index):set_enabled(false)
      end
    end
end

------- Shaking camera
local function movement_camera()
  camera_timer = sol.timer.start(400, function()
    camera:set_position(0,0)
    sol.timer.start(200, function()
      camera:set_position(1,0)
    end)
    sol.timer.start(100, function()
      camera:set_position(0,0)
    end)
    sol.timer.start(50, function()
      camera:set_position(-1,0)
    end)
  return true
  end)
end

-------Apparition du boss
function sensor_boss:on_activated()

    if first_see == true and value_boss == nil then
      map:close_doors("door_boss_")
      hero:freeze()
      sol.audio.play_sound("earthquake")
      movement_camera()
      sol.timer.start(time_animation, function()
        camera_timer:stop() -- arrêt du tremblement de camera
        camera:start_tracking(hero) -- la camera est recentrée au héro
        map:create_enemy{
          breed = "boss1_blob",
          layer = 0,
          x = 160,
          y = 128,
          direction = 0,
          }
        hero:unfreeze()
        first_see = false
        end)
    end
end

Boss code :
Code: (lua) [Select]
local enemy = ...
local game = enemy:get_game()
local map = enemy:get_map()
local hero = enemy:get_map():get_hero()

local properties = {
  life = 12,
  damage = 0,
  speed_ground = 10,
  speed_fly = 25,
  movement_ground = "random",
  movement_fly = "target",
  number_minion = 5,
  interval_minion = 2000,
  }

local max_life = properties.life
local int_life = max_life /3
local time = properties.interval_minion
local body_sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())

-----------------------------------------------------
------- Floor explosion
local function explosion_plaque(name_plaque)
  for plaque in map:get_entities(name_plaque) do 
    local plaque_x, plaque_y, plaque_layer = plaque:get_center_position()
      map:create_explosion({x= plaque_x, y = plaque_y, layer = plaque_layer})
      plaque:set_enabled(false)
  end
  sol.audio.play_sound("explosion")
end

-----------------------------------------------------
-- Stop the timer and update the state of the boss
local function end_timer_monster()
  local time_left = properties.number_minion * time + 50
  sol.timer.start(enemy, time_left, function()
    sol.timer.stop_all(enemy)
    forme_boss_base()
    end)
end

-----------------------------------------------------
--- Normal state of the boss
function forme_boss_base()
  enemy:set_default_attack_consequences()
  body_sprite:set_animation("walking")
  enemy:set_can_attack(true)

    local move = sol.movement.create(properties.movement_ground)
      move:set_speed(properties.speed_ground)
      move:start(enemy)
end

-----------------------------------------------------
--- Flying state of the boss
function forme_boss_fly()
    enemy:set_attack_consequence("sword", "ignored")
    body_sprite:set_animation("flying")
    enemy:set_can_attack(false)

    local move = sol.movement.create(properties.movement_fly)
      move:set_speed(properties.speed_fly)
      move:start(enemy)
  end_timer_monster()
  sol.timer.start(enemy, time, function()
    local boss_x, boss_y, boss_layer = enemy:get_position()
    local boss_direction = enemy:get_direction4_to(hero)
      map:create_enemy{
        breed = "chuchu_green",
        layer = boss_layer,
        x = boss_x,
        y = boss_y,
        direction = boss_direction,
        }
  return true
  end)
end

-----------------------------------------------------
-- Creation of the boss
function enemy:on_created()
  enemy:set_life(max_life)
  enemy:set_damage(properties.damage)
  enemy:set_hurt_style("boss")
  enemy:set_attack_consequence("explosion", "ignored")
  local flying_mode = false -- état du boss

  body_sprite:set_animation("appearing")

end

-----------------------------------------------------
-- Indicate when the boss changes this state
function enemy:on_hurt()
  local less_life = enemy:get_life()
    if less_life == (max_life - int_life)  then
      flying_mode = true
      explosion_plaque("plaque_spike_1_")
    elseif less_life == (max_life - 2* int_life) then
      flying_mode = true
      explosion_plaque("plaque_spike_2_")
    else
      flying_mode = false
    end
end

-----------------------------------------------------
-- When the boss moves
function enemy:on_restarted()
    if flying_mode == true then
      forme_boss_fly()
    else
      forme_boss_base()
    end
end

-----------------------------------------------------
-- Change the sprite when the boss moves
function enemy:on_movement_changed(movement)
  local direction4 = movement:get_direction4()
  body_sprite:set_direction(direction4)
end

-----------------------------------------------------
-- When the boss is dead
function enemy:on_dead()
game: set_value("defeated_boss",1)
map:open_doors("door_boss_")
end

14
Development / [Solved] Insert sprite before creating an enemy
« on: March 18, 2017, 10:09:46 am »
Hi, I manage my first boss. Now, I try to make a cutscene when the boss arrives. The only thing I have to do is insert the animation called "appeared" in the code.
I tried to write "enemy:get_sprite():set_animation("appeared")" in the function "enemy:on_created" but it didn't work (lign 78). The sprite of the boss blinked.
I tried also to use the function "enemy:on_post_draw()", without success.

Someone know how to insert a sprite at the creation of an entity ?

Code: (lua) [Select]
local behavior = {}

function behavior:create(enemy, properties)

local game = enemy:get_game()
local map = enemy:get_map()
local hero = enemy:get_map():get_hero()
local max_life = properties.life
local time = properties.interval_minion
local body_sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())

-------------------------------------------------------------
------- Floor explosion
local function explosion_plaque(name_plaque)
  for plaque in map:get_entities(name_plaque) do 
    local plaque_x, plaque_y, plaque_layer = plaque:get_center_position()
      map:create_explosion({x= plaque_x, y = plaque_y, layer = plaque_layer})
      plaque:set_enabled(false)
  end
  sol.audio.play_sound("explosion")
end

-------------------------------------------------------------
-- Stop the timer and update the state of the boss
local function end_timer_monster()
  local time_left = properties.number_minion * time + 50
  sol.timer.start(enemy, time_left, function()
    sol.timer.stop_all(enemy)
    forme_boss_base()
    end)
end

-------------------------------------------------------------
--- Normal state of the boss
function forme_boss_base()
    enemy:set_attack_consequence("sword", 1)
    body_sprite:set_animation("walking")
    enemy:set_can_attack(true)

    local move = sol.movement.create(properties.movement_ground)
      move:set_speed(properties.speed_ground)
      move:start(enemy)
end

-------------------------------------------------------------
--- Flying state of the boss
function forme_boss_fly()
    enemy:set_attack_consequence("sword", "ignored")
    body_sprite:set_animation("flying")
    enemy:set_can_attack(false)

    local move = sol.movement.create(properties.movement_fly)
      move:set_speed(properties.speed_fly)
      move:start(enemy)
  end_timer_monster()
  sol.timer.start(enemy, time, function()
    local boss_x, boss_y, boss_layer = enemy:get_position()
    local boss_direction = enemy:get_direction4_to(hero)
      map:create_enemy{
        breed = "tentacle",
        layer = boss_layer,
        x = boss_x,
        y = boss_y,
        direction = boss_direction,
        }
  return true
  end)
end

-------------------------------------------------------------
-- Creation of the boss
function enemy:on_created()
  enemy:set_life(max_life)
  enemy:set_damage(properties.damage)
  enemy:set_hurt_style("boss")
  enemy:set_attack_consequence("explosion", "ignored")
  local flying_mode = false
  body_sprite:set_animation("appeared") -- Problem ??
end

-------------------------------------------------------------
-- Indicate when the boss changes this state
function enemy:on_hurt()
  local less_life = enemy:get_life()
    if less_life == 8  then
      flying_mode = true
      explosion_plaque("plaque_spike_1_")
    elseif less_life == 4 then
      flying_mode = true
      explosion_plaque("plaque_spike_2_")
    else
      flying_mode = false
    end
end

-------------------------------------------------------------
-- When the boss moves
function enemy:on_restarted()
    if flying_mode == true then
      forme_boss_fly()
    else
      forme_boss_base()
    end
end

-------------------------------------------------------------
-- Change the sprite when the boss moves
function enemy:on_movement_changed(movement)
  local direction4 = movement:get_direction4()
  body_sprite:set_direction(direction4)
end

-------------------------------------------------------------
-- When the boss is dead
function enemy:on_dead()
game: set_value("defeated_boss",1)
map:open_doors("door_boss_")
end

end -- End of Behavior
return behavior

15
Bugs & Feature requests / [Solved] Bug with "get_facing_entity" ?
« on: March 14, 2017, 10:02:50 am »
Okay, thanks !

And, for my test, I just use a "get_ground" to get the type of ground  ;)

Pages: [1] 2