Hello pjbebi!
Welcome to Slime Salad! First I'd like to ask, how long have you been using OHR? And how recently have you begun to apply yourself learning Hspeak?
Anyway, with that said, I'd like to take a crack at your challenge and hopefully help you out!
pjbebi wrote:"hit" is the script which runs when I collide with npc 16, but it only works when I walk onto their position. I know it's because I am only returning their position when I take a step.
Code: Select all
variable (enemy HP)
while (enemy hit == TRUE) do(
enemy HP -= 1
)
TL;DR: Try turning on the "Pushability" option in "Edit NPCs" on the Map menu
The "while" command will "do" whatever is inside it continuously until it's terminator is met, in this case "the enemy is still hit". In this example I wrote up, this would get the job done.
However, there are a lot of expectations that the player will have from having played other LOZ type games in the past that I don't believe you may have addressed before beginning this project.
A key thought process to programming is to "understand the problem" before doing anything.
So collision detection in games work with two things. A hitbox and a hurtbox. In the LOZ the first hitbox a player would see, would be from the wooden sword. You press A and Link pokes an enemy with his sword.
Player presses A
Link pokes with his sword
- Sword stays on screen for 1/3 a sec
--Any enemies in the area of the sword?
--- Yes!
---- Can this enemy be hurt by the sword?
----- Yes!
------ Enemy is hurt for X damage
------- Is the enemies HP more than 0?
-------- Yes!
--------- Dead enemy
-------- No!
--------- Enemy is knocked back and has invincibility frames
--- No!
-- Link is "stuck" for 1/4 a sec
-- Is Link at full health?
--- Yes!
---- LASER BEAM!
----- *I'm skipping writing out what happens with the laser beam*
- Player can move/ input other commands again
This may seem like a long list of work but remember that all it is at the end of the day is just a few simple commands.
OHR also has a built in option for NPC pushabilty. It's the ninth option in "Edit NPCs" this should help. However, whether or not it's going to behave the way you want is up to you.