This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-06-25 15:19:55

bertdog
Scratcher
Registered: 2012-06-12
Posts: 100+

Fighting with a different style.

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.


"Losers quit when they are tired,Winners quit when they are done." smile http://blocks.scratchr.org/API.php?user=bertdog&action=onlineStatus

Offline

 

#2 2012-06-25 15:31:56

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: Fighting with a different style.

can you specify how your hero gets damaged in the first place? is it a variable?

if you can, i'd love to help

Offline

 

#3 2012-06-25 15:32:47

bertdog
Scratcher
Registered: 2012-06-12
Posts: 100+

Re: Fighting with a different style.

yea the health is a variable.


"Losers quit when they are tired,Winners quit when they are done." smile http://blocks.scratchr.org/API.php?user=bertdog&action=onlineStatus

Offline

 

#4 2012-06-25 15:35:49

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Fighting with a different style.

HAve in the damage script this:

when I receive [damage v]// or however it gets damaged.
if <not <(attacking) = (1)>>
change [health v] by (-10)


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#5 2012-06-25 15:40:11

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: Fighting with a different style.

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

 

#6 2012-06-25 15:43:26

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: Fighting with a different style.

you will also need to include a script for damaging the enemy when attacking = 1

Offline

 

#7 2012-06-25 15:48:34

bertdog
Scratcher
Registered: 2012-06-12
Posts: 100+

Re: Fighting with a different style.

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.


"Losers quit when they are tired,Winners quit when they are done." smile http://blocks.scratchr.org/API.php?user=bertdog&amp;action=onlineStatus

Offline

 

#8 2012-06-25 15:56:50

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: Fighting with a different style.

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

 

#9 2012-06-25 15:58:10

bertdog
Scratcher
Registered: 2012-06-12
Posts: 100+

Re: Fighting with a different style.

Thanks. Game is called Pirates Bounty.


"Losers quit when they are tired,Winners quit when they are done." smile http://blocks.scratchr.org/API.php?user=bertdog&amp;action=onlineStatus

Offline

 

#10 2012-06-25 16:00:21

Corwen
New Scratcher
Registered: 2012-06-23
Posts: 28

Re: Fighting with a different style.

ill check it out, if you need more help, just ask  smile

Offline

 

Board footer