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

#1 2012-02-24 13:26:58

tayyib123
New Scratcher
Registered: 2012-02-22
Posts: 7

How to make lives with hearts

Hi guys,

So basically im trying to make a game with 3 lives but i dont know how to amke the lives dissapear 1 by 1. if anyone knows please HELP! because i really need it.



Thanks!!!  smile   sad  :

Offline

 

#2 2012-02-24 13:35:38

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How to make lives with hearts

when I receive [loseLife1]
-broadcast [takeheart1]
-change [lives] by (-1) // variable
Put the following on the heart sprite

when i receive [takeheart1]
-hide
Do this for each heart (take heart2, etc)

when gf clicked
set (lives) to 3
forever if <(lives) = [3]>
-Broadcast [gameover]

Last edited by Stickman704 (2012-02-24 13:46:03)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#3 2012-02-24 14:00:50

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: How to make lives with hearts

Make the lives a sprite.

 
When I receive [lose v] //when they lose a life have them broadcast this.
switch to costume [2 lives left v]


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#4 2012-02-24 14:02:07

tayyib123
New Scratcher
Registered: 2012-02-22
Posts: 7

Re: How to make lives with hearts

Thanks it really helped
I didnt even know hot to do that d:

Offline

 

#5 2012-02-24 14:55:38

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: How to make lives with hearts

Mokat wrote:

Make the lives a sprite.

 
When I receive [lose v] //when they lose a life have them broadcast this.
switch to costume [2 lives left v]

Actually, it's this:

I assume you have these costumes:
0n (0 lives left)
1n (1 life left)
2n
3n

when I receive [lose a life v]
switch to costume ((costume #) - (1))
if <(costume #) = (1)>
person loses // add a script here
end

Last edited by rdococ (2012-02-24 14:56:22)

Offline

 

#6 2012-02-25 18:19:56

Luxturna
Scratcher
Registered: 2011-04-24
Posts: 38

Re: How to make lives with hearts

tayyib123 wrote:

Hi guys,

So basically im trying to make a game with 3 lives but i dont know how to amke the lives dissapear 1 by 1. if anyone knows please HELP! because i really need it.



Thanks!!!  smile   sad  :

I have a project with lives, you an download it and see how I did it. You need one sprite with  costumes, 1, 2, and 3 hearts, and one with nothing. then, you have it "stop all"  when <([costume #] of [sprite]) = (4)> (the one with nothing is 4)

MOST EFFECTIVE WAY WITH NOT MANY SCRIPTS (edited version):
<if> <distance to[ sprite <=> 4
<stop all>
<end>

IMPORTANT: make sure the "distance to" is "costume #"

or

<if> <touching[ lava
<change{   <distance to[ sprite  }by( 1
<end>

IMPORTANT: make sure the "distance to" is "costume #"

Sorry, new at forums, therefore looks weird.

Here's the project, because the stuff above probably made NO sense.
http://scratch.mit.edu/projects/Luxturna/2239467

Last edited by Luxturna (2012-02-25 18:53:59)


http://scratch.mit.edu/static/icons/buddy/782569_med.png?t=2012-03-10+00%3A38%3A57

Offline

 

#7 2012-02-25 19:41:24

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: How to make lives with hearts

Make a sprite with three costumes, the first costume with one heart, the second costume with two hearts, and the third with three hearts.

When flag clicked
switch to costume [ costume 3 v]
show
forever
if <(Lives) < [3]>
switch to costume [ costume 2 v]
end
if <(Lives) < [2]>
switch to costume [ costume 1 v]
end
if <(Lives) < [1]>
hide
stop all
end
end

Last edited by CheeseMunchy (2012-02-25 19:44:08)


6418,

Offline

 

#8 2012-02-26 08:01:51

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: How to make lives with hearts

CheeseMunchy wrote:

Make a sprite with three costumes, the first costume with one heart, the second costume with two hearts, and the third with three hearts.

When flag clicked
show
forever
switch to costume (lives)
if <(Lives) < [1]>
hide
stop all
end

I made it shorter.

Offline

 

#9 2012-02-26 10:52:50

hari_2153
New Scratcher
Registered: 2012-02-25
Posts: 3

Re: How to make lives with hearts

Trying To LEarn In This Site..
Anybody Want TO Help Me?

Offline

 

#10 2012-02-26 11:03:04

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How to make lives with hearts

Not if you talk l|k3 thi$ and not on this thread. If you need help, then make a new one.  smile


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

Board footer