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

#1 2013-04-22 16:50:52

Mojany
New Scratcher
Registered: 2013-02-14
Posts: 7

Life Bar

Hey!!
I'm making a game, and I need a life bar for my game.
When the player got the question correct, they'll get 2 points.
And when the player didn't get the question, the'll lose 3 points from they're points.
How can I do that??
And I want to start the game of life with 6 first.

Can some one PLEASE HELP ME??

Offline

 

#2 2013-04-22 17:12:30

PaulRHJT
New Scratcher
Registered: 2013-04-14
Posts: 34

Re: Life Bar

You'll have to add a variable. I called it "life points" in the example below.

when gf clicked
set [life points v] to [6]
forever
if < (answer) = [correct] >
change [life points v] by [2]
end
if < (answer) = [wrong] >
change [life points v] by [-3]

Offline

 

#3 2013-04-22 17:17:37

Mojany
New Scratcher
Registered: 2013-02-14
Posts: 7

Re: Life Bar

I did like that, but it didn't work....

where do I have to put that on/in?

Offline

 

#4 2013-04-22 17:23:09

NoxSpooth
Scratcher
Registered: 2013-03-19
Posts: 500+

Re: Life Bar

Add two variables, "life" and "question", then two lists, one for the questions, and the other one for the answers. But add the items to the lists in the same order.

when gf clicked
set [life v] to (6)
set [question v] to (1)
repeat until <(question) = [  ]> //Must be filled with the number of questions.
ask (item (question) of [question list v]) and wait
if < (answer) = (item (question) of [answers v]) >
change [life points v] by (2)
say [Correct!] for (3) secs // You may remove this is you don't want it to say anything.
else
change [life points v] by (-3)
say [Sorry, wrong answer.] for (3) secs // Same as the note above.
end
end
Say (join [Your final score is: ] (life)) 

Last edited by NoxSpooth (2013-04-22 17:29:54)


http://i1244.photobucket.com/albums/gg572/BLU_Spy/Best-Cry-Ever_zps3b2b857a.gif Goodbye, 1.4... We'll miss you...

Offline

 

#5 2013-04-22 17:45:37

Mojany
New Scratcher
Registered: 2013-02-14
Posts: 7

Re: Life Bar

OK. Thanks!!

I'll try it!!

Offline

 

#6 2013-04-22 17:47:05

NoxSpooth
Scratcher
Registered: 2013-03-19
Posts: 500+

Re: Life Bar

Mojany wrote:

OK. Thanks!!

I'll try it!!

You're welcome!  big_smile


http://i1244.photobucket.com/albums/gg572/BLU_Spy/Best-Cry-Ever_zps3b2b857a.gif Goodbye, 1.4... We'll miss you...

Offline

 

Board footer