Author Topic: Hookshot  (Read 2894 times)

wizard_wizzle (aka ZeldaHistorian)

  • Sr. Member
  • ****
  • Posts: 263
    • View Profile
Hookshot
« on: February 17, 2015, 04:20:07 am »
Is it defined in the API what entities the hookshot attaches to? What's the best way to force the hookshot to attach to a tile or entity, or is this even possible?

wizard_wizzle (aka ZeldaHistorian)

  • Sr. Member
  • ****
  • Posts: 263
    • View Profile
Re: Hookshot
« Reply #1 on: February 17, 2015, 04:36:38 am »
I used the trick of creating a "destructible" entity with an empty sprite and no properties, and overlaid that on top of the tile I needed to be hookshot-able.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1185
    • View Profile
Re: Hookshot
« Reply #2 on: February 17, 2015, 08:48:02 am »
Nice trick :)
There is no way in the API yet. One day you I think will be able to set this "hookshotable" property at least for custom entities.
(Or maybe we will remove the hookshot from the engine and script it entirely)

Dragon_noir

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Hookshot
« Reply #3 on: May 24, 2015, 12:58:37 am »
Is there a way to make 2 hookshots with different lengths (Ex: 1 that does half the screen and 1 that goes all the way across the screen)?

I've looked through the documentation but couldn't find any methods for the hookshots where i could set a specific length.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1185
    • View Profile
Re: Hookshot
« Reply #4 on: May 24, 2015, 08:17:09 am »
Not now, the hookshot is not customizable enough for that.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1185
    • View Profile
Re: Hookshot
« Reply #5 on: August 04, 2015, 11:45:11 am »
Here is an experimental scripted hookshot!
It is meant to replace the built-in one. I have attached it to this post and added it to the libsolarus-mudora project.

There is a hookshot.lua item script, you just have to add it to your quest in the entities folder (as the structure of the zip file suggests).
Also add hookshot_config.lua there. hookshot_config.lua is where you can customize things: edit it to set your hookshot properties:

Code: (lua) [Select]
-- Configuration of the hookshot.
-- Feel free to change these values.

local config = {

  -- Range of the hookshot in pixels.
  distance = 120,

  -- Speed in pixels per second.
  speed = 192,

  -- What types of entities can be cought.
  -- Additionally, all entities that have a method "is_catchable_with_hookshot"
  -- returning true will be catchable.
  catchable_entity_types = { "pickable" },

  -- What types of entities the hookshot can attach to.
  -- Additionally, all entities that have a method "is_hookable"
  -- returning true will be hookable.
  hookable_entity_types = { "chest", "destructible", "block" },

}

return config

There is also a custom entity model called "hookable". Useful if you want something hookable without other behavior. The trick of creating an empty destructible object is no longer needed.