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

#1 2011-08-24 13:26:54

40nintendo
New Scratcher
Registered: 2011-04-03
Posts: 4

Health bar

Hi guys
i'm currently making a fighting game the problem is that when i use this script
Whan flag clickeed
Forever if (<{P1 Hp }> = 10
Switch to costume .ect
the problem is that when the health is not a 10,20,30,40 ect the bars want show the health as intended so how should i redo the scrip to make it work thanx

Offline

 

#2 2011-08-24 13:40:54

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Health bar

use [switch to costume round(health/10)+1]. This will turn out of the health numbers from 1 to 11, like if health's 15 it will switch to costume 3, if 78 to costume 9 and so. You (might also) want to add check script to <health=0>  smile

Offline

 

#3 2011-08-24 13:46:04

40nintendo
New Scratcher
Registered: 2011-04-03
Posts: 4

Re: Health bar

sorry but can you give an example of a scrip like that
sorry dont quite get what you mean

Offline

 

#4 2011-08-24 13:47:50

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Health bar

sure! i'll upload one in about five minutes  smile

Offline

 

#5 2011-08-24 13:50:53

40nintendo
New Scratcher
Registered: 2011-04-03
Posts: 4

Re: Health bar

thanx so much its my first game that is kind of advanced i will uplode it when its finished

Offline

 

#6 2011-08-24 13:54:28

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Health bar

uploaded!
happy to help!

Offline

 

#7 2011-08-24 13:58:18

40nintendo
New Scratcher
Registered: 2011-04-03
Posts: 4

Re: Health bar

Thanks sooo much

Offline

 

#8 2011-08-24 14:01:57

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Health bar

40nintendo wrote:

Thanks sooo much

no problem!

Offline

 

Board footer