Solarus > Development

Prevent attack command from attacking

(1/2) > >>

Is there to make it so the attack command being pressed stops the hero from attacking? I've tried using on_command_pressed(), on_state_changed() and on_stage_changing() but nothing seems to be working for me.

To give an adequate answer for your purposes we need to know this: do you want to always disable the sword attack in all your game? Or just temporarily under certain states/conditions?

Just temporarily depending on if the hero has enough stamina to attack

Can you post the things you tried? Like the actual code, you said you used on_state_changed() but like, HOW did you use it?

Two solutions:
- Associate the attack command to no keyboard key and no joypad action: game:set_command_keyboard_binding("attack", nil)
- Remove the attack ability: game:set_ability("sword", nil)


[0] Message Index

[#] Next page

Go to full version