I made a game that I am trying to update. I come up to when I make the enemies and I know how to make the Hero attack. But I want to make the hero invincible while attacking( It is a short time to attack). Does anyone know how to make your hero invincible while attacking.
Offline
okay, so when does he take damage? when touching the enemy sprite?
if so, you will need to put an IF statement, and an attacking variable so for example:
when <attack button> clicked
set attacking to 1
when greenflag clicked
forever
if : attacking = 0
if touching enemy sprite
reapeat
change health by -1
wait 0.5 secs
<endrepeat>
<endforever>
I think that should work
Offline
Ok so when the space key is pressed the Hero turns into attacking mode by switching into the next costume that is when the invincible part happens. but i don't know how to make the enemies get hurt when they touch the second costume and then be able to hurt the hero when he turns to costume one.
Offline
this is where the variable comes in. you have to make it so when you press space key, the attacking variable gets set to 1. and use blocks like 'if attacking = 1 switch to costume 2' and 'if attacking = 0 <take damage from enemy>
Offline