Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - linq

#1
Thanks a lot Dianthus. That shield system Link's Awakening needs some work, but it's a good starting point. Mainly the problem is that Link isn't properly animated while sidestepping. At least it actually is sidestepping though. In the real Link's Awakening you just always turn to walk forwards, which is next to useless if you want to block attacks.

Still interested in a solution to this HUD problem!
#2
Editing the control assignments is easy. Just add this script set_controls.lua to your project:
--Script to initialize the control scheme
--require() this in features.lua to enable it

require("scripts/multi_events")

local function controls(game)
  local value = game:get_value("controls")
  --Keyboard commands.
  game:set_command_keyboard_binding("attack", "s")
  game:set_command_keyboard_binding("action", "space")
  game:set_command_keyboard_binding("item_1", "d") 
  game:set_command_keyboard_binding("item_2", "a")
  game:set_command_keyboard_binding("pause", "return")
 
  --Game Controller commands.
  game:set_command_joypad_binding("attack", "button 0")
  game:set_command_joypad_binding("action", "button 1")
  game:set_command_joypad_binding("item_1", "button 2") 
  game:set_command_joypad_binding("item_2", "button 3")
  game:set_command_joypad_binding("pause",  "button 7")
 
end

local game_meta = sol.main.get_metatable("game")
game_meta:register_event("on_started", controls)


And then add the line require("scripts/set_controls") to features.lua. Change the arguments to whatever you want the controls to be.

You mention having a shield button - does this mean that you want the shield to work like in Minish Cap or ALBW - where you hold the button to defend and can sidestep while defending? If so, do you have code for this already made and would you be willing to share? Or perhaps it is already available online somewhere? I would also like this system in my project.

PS - do you not find Z, X, and C too close to the spacebar for comfort? Playing that way I feel like I'm using a system made for a child's hand, (and my hands aren't even that big, compared to average). That's why I set my buttons to A, S, and D in my script, to have more space.
#3
EDIT: I have looked at Christopho's tutorial videos and figured out how to get rid of the pause button icon, and that I just need to import the magic meter from another project. The only thing is that I still don't know how to make the action button stay on the HUD at all times - setting its is_enabled to true just doesn't do it and I don't see anywhere else in the code that would affect this.


Hi Everyone,

First time posting, of many, I am sure. I'm starting to learn Solarus and develop a game.

I am trying to customize the HUD to my preferences, and I have two questions. The first is: I want the pause button icon to never show (I don't consider it necessary), and I want the action button to always show up, even if there is no action.

I have tried editing this section of the script hud.lua as follows:
    elseif hud.mode == "normal" then
      if attack_icon ~= nil then
        attack_icon:set_dst_position(attack_icon:get_normal_position())
        local attack_icon_enabled = false
        local effect = game.get_custom_command_effect ~= nil and game:get_custom_command_effect("attack") or game:get_command_effect("attack")
        if effect then
          attack_icon_enabled = true
        else
          -- Still display the attack icon when the hero does not have a sword, at the beginning of the game.
          local hero_sword = game:get_ability("sword")
          attack_icon_enabled = hero_sword == nil or hero_sword == 0
        end
        attack_icon:set_enabled(attack_icon_enabled)
        attack_icon:set_active(true)
      end

      if action_icon ~= nil then
        action_icon:set_dst_position(action_icon:get_normal_position())
        local effect = game.get_custom_command_effect ~= nil and game:get_custom_command_effect("action") or game:get_command_effect("action")
        action_icon:set_enabled(true)   --changed from effect ~= nil
        action_icon:set_active(true)
      end

      if pause_icon ~= nil then
        pause_icon:set_enabled(false) --changed from true
        pause_icon:set_active(false)    --changed from true
      end

      for _, item_icon in ipairs(item_icons) do
        if item_icon ~= nil then
          item_icon:set_enabled(true)
          item_icon:set_active(true)
        end
      end


What I am getting is that the pause icon still shows up for one frame, before the script kicks in, I suppose. And the action icon still only displays when I am next to a block to grab or a chest to open; i.e., nothing has changed at all with it. What do I need to do to get these buttons to behave the way I want.

The second question is: I want the button icons on the right and the hearts and magic meter on the left, as it is in every official Zelda game other than LTTP. I have managed to move the buttons and hearts by changing the values in hud_config.lua, but I do not see where I define the location of the magic meter. I also don't see where it gets drawn in any of the scripts. What have I missed here?