Hookshot

Started by wizard_wizzle (aka ZeldaHistorian), February 17, 2015, 04:20:07 AM

Previous topic - Next topic
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?

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.

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)

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.

Not now, the hookshot is not customizable enough for that.

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.