I'm trying to make a 2d adventure type game (a lot like the original legend of zelda type games). So far it's been going really well, but the biggest problem I've run into is dealing with lives of enemies and the main charecter. I have it set up as a variable with the heart icons as sprites, and when an enemy is touching the main charecter, then the life variable changes by -1 and one of the hearts disappears. The problem is, once the enemy is touching the player, all of the hearts get drained. How would I make it so that the player has a few seconds of immunity before losing another life?
And for enemy health, I'd like to set it up so every time you go through the attack animation (which is the player bashing the enemy with a stick) it drains only one of the enemies lifes?
Any help would be greatly appreciated!
Offline
Un_Pinguino_Perdido wrote:
I'm trying to make a 2d adventure type game (a lot like the original legend of zelda type games). So far it's been going really well, but the biggest problem I've run into is dealing with lives of enemies and the main charecter. I have it set up as a variable with the heart icons as sprites, and when an enemy is touching the main charecter, then the life variable changes by -1 and one of the hearts disappears. The problem is, once the enemy is touching the player, all of the hearts get drained. How would I make it so that the player has a few seconds of immunity before losing another life?
And for enemy health, I'd like to set it up so every time you go through the attack animation (which is the player bashing the enemy with a stick) it drains only one of the enemies lifes?
Any help would be greatly appreciated!![]()
Hmm - for the immunity you should use the timer blocks. Put the player's take damage script under this:
<if><( <timer> <>> How long invincibility lasts )>
Script goes here
<end>
And when the player takes damage it should reset the timer:
<reset timer>
I don't understand what you mean by the second question, though.
Last edited by RHY3756547 (2010-02-13 16:17:47)
Offline
RHY3756547 wrote:
Un_Pinguino_Perdido wrote:
I'm trying to make a 2d adventure type game (a lot like the original legend of zelda type games). So far it's been going really well, but the biggest problem I've run into is dealing with lives of enemies and the main charecter. I have it set up as a variable with the heart icons as sprites, and when an enemy is touching the main charecter, then the life variable changes by -1 and one of the hearts disappears. The problem is, once the enemy is touching the player, all of the hearts get drained. How would I make it so that the player has a few seconds of immunity before losing another life?
And for enemy health, I'd like to set it up so every time you go through the attack animation (which is the player bashing the enemy with a stick) it drains only one of the enemies lifes?
Any help would be greatly appreciated!![]()
Hmm - for the immunity you should use the timer blocks. Put the player's take damage script under this:
<if><( <timer> <>> How long invincibility lasts )>
Script goes here
<end>
And when the player takes damage it should reset the timer:
<reset timer>
I don't understand what you mean by the second question, though.![]()
The second question is asking how to make the attack only hurt the enemy once no matter how long the weapon touches the enemy.
Offline
juststickman wrote:
RHY3756547 wrote:
Un_Pinguino_Perdido wrote:
I'm trying to make a 2d adventure type game (a lot like the original legend of zelda type games). So far it's been going really well, but the biggest problem I've run into is dealing with lives of enemies and the main charecter. I have it set up as a variable with the heart icons as sprites, and when an enemy is touching the main charecter, then the life variable changes by -1 and one of the hearts disappears. The problem is, once the enemy is touching the player, all of the hearts get drained. How would I make it so that the player has a few seconds of immunity before losing another life?
And for enemy health, I'd like to set it up so every time you go through the attack animation (which is the player bashing the enemy with a stick) it drains only one of the enemies lifes?
Any help would be greatly appreciated!![]()
Hmm - for the immunity you should use the timer blocks. Put the player's take damage script under this:
<if><( <timer> <>> How long invincibility lasts )>
Script goes here
<end>
And when the player takes damage it should reset the timer:
<reset timer>
I don't understand what you mean by the second question, though.![]()
The second question is asking how to make the attack only hurt the enemy once no matter how long the weapon touches the enemy.
OK then. For that - put this in to the script:
<if><touching[ Player's Pointy Stick ]>
<change{ HP }by( Whatever )>
<wait until><not> <touching[ Player's pointy Stick ]>>
<end>
Last edited by RHY3756547 (2010-02-13 16:55:43)
Offline
Took me a while to figure out the timer block, but now it's working great!
And I can't believe I didn't think of that second script...Thanks!
Offline