Author Topic: Bubble + boomerang = fairy?  (Read 2404 times)

YoshiMario2000

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Bubble + boomerang = fairy?
« on: June 13, 2015, 06:02:18 pm »
Is it possible to trow a boomerang at a bubble and get a fairy?
This signature was way too long before, but now it's short!
Also, I am Still Alive!
On ad Off I go!

Do you ever get the feeling that the fandom of a product(s) ruin the potential that you could have had to enjoy the product?

Diarandor

  • Hero Member
  • *****
  • Posts: 1061
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Bubble + boomerang = fairy?
« Reply #1 on: June 13, 2015, 06:20:48 pm »
Yes. It is possible to make almost anything if you know how to code it (but not easy).

To do what you want, I would use a custom entity for the bubble. You can use a collision test on the bubble script to detect the collision with the boomerang. (I have done something similar to make trees that throw leaves when hit with the sword, and it works.) You can use something like this:
Code: [Select]
entity:add_collision_test("sprite", function(entity, other_entity, sprite, other_sprite)
  if other_sprite:get_animation() ~= "boomerang" then return end
  -- Here goes your code...
end
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1182
    • View Profile
Re: Bubble + boomerang = fairy?
« Reply #2 on: June 13, 2015, 11:57:26 pm »
It is even possible to keep the bubble as a normal enemy.
Define the enemy:on_hurt(attack) event on bubble, and if attack == "boomerang", call enemy:set_treasure("fairy").
See http://www.solarus-games.org/doc/latest/lua_api_enemy.html#lua_api_enemy_on_hurt

YoshiMario2000

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Bubble + boomerang = fairy?
« Reply #3 on: June 17, 2015, 04:58:37 pm »
It is even possible to keep the bubble as a normal enemy.
Define the enemy:on_hurt(attack) event on bubble, and if attack == "boomerang", call enemy:set_treasure("fairy").
See http://www.solarus-games.org/doc/latest/lua_api_enemy.html#lua_api_enemy_on_hurt

After that I think we would want to remove the bubble.

If you have played link's awakening, or the oracle games,
Trowing a boomerang at a bubble will cause it to "transform" into a fairy.
That's probably why the are called anti-fairys.
This signature was way too long before, but now it's short!
Also, I am Still Alive!
On ad Off I go!

Do you ever get the feeling that the fandom of a product(s) ruin the potential that you could have had to enjoy the product?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1182
    • View Profile
Re: Bubble + boomerang = fairy?
« Reply #4 on: June 17, 2015, 06:03:07 pm »
That's right!
Code: [Select]
function enemy:on_hurt(attack)
  if attack == "boomerang" then
    local layer, x, y = enemy:get_position()
    map:create_pickable({
      layer = layer,
      x = x,
      y = y,
      treasure_name = "fairy"
    })
    enemy:remove()
  end
end
     
     

YoshiMario2000

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Bubble + boomerang = fairy?
« Reply #5 on: June 18, 2015, 01:11:08 am »
But, This works beater, at least, for me anyways.
Code: [Select]
function enemy:on_created()
  self:set_life(1)
  self:create_sprite("enemies/bubble")
  self:set_size(8, 8)
  self:set_origin(4, 4)
  self:set_can_hurt_hero_running(true)
  self:set_attack_consequence("sword", "ignored")
  self:set_attack_consequence("hookshot", "ignored")
  self:set_attack_consequence("arrow", "ignored")
  self:set_attack_consequence("fire", "ignored")
  self:set_attack_consequence("explosion", "ignored")
  self:set_attack_consequence("thrown_item", "ignored")
  self:set_attack_consequence("boomerang", 10)
  self:set_treasure("fairy")
end

You're result Gave some useless and humorous results. The bubble could be hit,
It just couldn't be killed. even by boomerang.
« Last Edit: June 18, 2015, 01:13:29 am by YoshiMario2000 »
This signature was way too long before, but now it's short!
Also, I am Still Alive!
On ad Off I go!

Do you ever get the feeling that the fandom of a product(s) ruin the potential that you could have had to enjoy the product?