FYI--
Your code to set the default properties can be made more concise with the use of a table. This equivalent code replaces lines 26 through 104:
Also, it looks like the script hard codes some offsets specific to the projectile sprite. It might be helpful if you included an image of the projectile sprite to make it more clear what it is doing. For that matter it might be helpful to include the monster sprite too. It's always nice to be able to replicate the author's setup exactly in order to be sure things are working as intended.
Your code to set the default properties can be made more concise with the use of a table. This equivalent code replaces lines 26 through 104:
Code (lua) Select
local defaults = {
life = 2,
damage = 0,
normal_speed = 32,
faster_speed = 48,
size_x = 16,
size_y = 16,
hurt_style = "normal",
pushed_when_hurt = false,
push_hero_on_sword = false,
ignore_obstacles = false,
detection_distance = 80,
obstacle_behavior = "normal",
projectile_breed = "misc/octorok_stone",
shooting_frequency = 1500,
sword_consequence = 1,
arrow_consequence = 1,
explosion_consequence = 1,
fire_consequence = 1,
movement_create = function()
local m = sol.movement.create("random_path")
return m
end,
asleep_animation = "asleep",
awake_animation = "awake",
must_be_aligned_to_shoot = true,
max_range = 100,
min_range = 45,
must_be_aligned_to_shoot = true,
}
-- Set default properties.
for property,default_value in pairs(defaults) do
if properties[property] == nil then
properties[property] = default_value
end
end
Also, it looks like the script hard codes some offsets specific to the projectile sprite. It might be helpful if you included an image of the projectile sprite to make it more clear what it is doing. For that matter it might be helpful to include the monster sprite too. It's always nice to be able to replicate the author's setup exactly in order to be sure things are working as intended.