Custom entities

Custom entities

Another example is creating weapons that are not included in the engine. The engine implements a bow with arrows, the boomerang and the hookshot, similarly to Zelda: A Link to the Past. But how to create the hammer? More difficult:

Custom entities are the answer to these challenges. Custom entities are a new type of map entity introduced in Solarus 1.2.


-- Destroy the rock if there is an explosion. rock_entrance:add_collision_test("overlapping", function(rock_entrance, other) if other:get_type() == "explosion" then -- The rock explodes."secret") rock_entrance:remove() end end)

the hammer itself (created dynamically when the player uses the item) and the hammer stakes. The hammer will test collisions with enemies and with hammer stakes. Hammer stakes will become traversable (and their sprite animation will change) when they collide with the hammer.