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

#1 2012-04-03 11:53:54

ScratchOS
Scratcher
Registered: 2012-03-20
Posts: 53

Health Bar? Exp Bar? How?!?!

I have variables for Health, Maximum Health, Exp, Exp for next level.

I am making an RPG which includes levelling up. When you level you level up, your Maximum Health rises, and so does the exp for next level.

So how can I make a 'bar' for health where the maximum health rises, the bar recognises the levelling up??

Also how can I make a exp bar? So that when the exp is at the exp for next level, the bar resets.

Offline

 

#2 2012-04-03 12:01:56

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Health Bar? Exp Bar? How?!?!

Check out this.


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#3 2012-04-03 13:57:36

ScratchOS
Scratcher
Registered: 2012-03-20
Posts: 53

Re: Health Bar? Exp Bar? How?!?!

It won't work for my game... My game includes levelling up

Offline

 

#4 2012-04-03 17:38:25

aryabtsev
Scratcher
Registered: 2012-02-05
Posts: 81

Re: Health Bar? Exp Bar? How?!?!

This project will help you, only change

((value) * ((length) / (100)))
with:
((Health) * ((length) / (Maximum health)))


http://i.imgur.com/NX7AO.jpg

Offline

 

#5 2012-04-03 19:49:37

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

Re: Health Bar? Exp Bar? How?!?!

For an EXP bar it'd be simple, you'd just use the above sprite etc and have something along these lines:

[scratchblocks]
when gf clicked
level = 1
exp = 0
expcap = 100
forever
  if <(exp) > [expcap]>
    exp = 0
    <(level) = (level)+[1]>


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

Offline

 

#6 2012-04-03 20:48:44

Haiming
Scratcher
Registered: 2011-08-20
Posts: 1000+

Re: Health Bar? Exp Bar? How?!?!

When you want to make an experience bar, and when you get enough experience to level up, here's what you do:

when gf clicked
forever if <((experience)mod(however much experience you want to level up)) = [0]>
change (level) by 1

Offline

 

#7 2012-04-03 23:31:19

Squawkers13
Scratcher
Registered: 2010-11-20
Posts: 500+

Re: Health Bar? Exp Bar? How?!?!

zammer990 wrote:

For an EXP bar it'd be simple, you'd just use the above sprite etc and have something along these lines:

when gf clicked
level = 1
exp = 0
expcap = 100
forever
  if <(exp) > [expcap]>
    exp = 0
    <(level) = (level)+[1]>[/quote]


http://pekkit.net/banners/pekkit.png

Offline

 

Board footer