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

#1 2010-12-11 16:04:52

nonpowner
New Scratcher
Registered: 2010-12-11
Posts: 12

Lives

Thanks to the guy who helped me with my lazers in my space shooter in the other post, Now I have another question

How do I make lives?

I want to make lives for the player... and when He loses them he dissapears?

Offline

 

#2 2010-12-11 16:06:58

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Lives

From the guy who helped you last time:

Make a variable called "lives".

When he's touching a bad thing (enemy laser, explosion, etc.) make the lives variable go down by 1 (change lives by -1)

When it equals 0 (or is less than 1, in case the variable goes negative), make the ship hide.

Tadaa!


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2010-12-11 16:18:21

nonpowner
New Scratcher
Registered: 2010-12-11
Posts: 12

Re: Lives

So I set lives to 10 and said if either My Foe is touching me or I am touching the foe, the lives would change by -1

Whenever I touch It or it touches me, the lives stay at 10?

Offline

 

#4 2010-12-11 16:24:09

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Lives

Is "set lives to 10" inside the forever block?  Put it above it, but not in it.  Else it will continuously reset to 10.


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#5 2010-12-11 16:31:17

nonpowner
New Scratcher
Registered: 2010-12-11
Posts: 12

Re: Lives

a forever block anyway, COuld you do One of those picture Script things? just for the making of live for a player? Thanks if you can

Offline

 

#6 2010-12-11 16:33:42

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Lives

Here: plug these in:
http://i54.tinypic.com/vyp8ci.gif
Tell me if that works.


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#7 2010-12-11 16:41:10

nonpowner
New Scratcher
Registered: 2010-12-11
Posts: 12

Re: Lives

Yes, that works thanks But one more thing, I think if you remember the other post, I had 2 lazers that always are on the player, How Do I get them to dissapear when My player has dissapeared?

Offline

 

#8 2010-12-11 16:43:31

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Lives

nonpowner wrote:

Yes, that works thanks But one more thing, I think if you remember the other post, I had 2 lazers that always are on the player, How Do I get them to dissapear when My player has dissapeared?

Add this before the laser script:
if lives > 0

So it would be

< forever>
If (fire button) pressed AND if lives > 0
run laser script
</if>
</forever>

and if your laser script doesn't use the "hide" or "show" blocks, use this:

< forever>
If lives < 1
hide
</if>
</forever>

Last edited by Kileymeister (2010-12-11 16:44:44)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#9 2010-12-12 07:37:13

nonpowner
New Scratcher
Registered: 2010-12-11
Posts: 12

Re: Lives

Could you do another picture code thing? On both my lazers I have this

WHen I revive shoot


[Reapeat untill Touching edge
[Point in direction 0
[move 10 steps
Hide
[forever
[Goto sprite 1 (player)
[Show

So were should I put the code That makes the lazers Dissapear?

Offline

 

#10 2010-12-12 07:45:48

StrykerV
New Scratcher
Registered: 2010-06-15
Posts: 51

Re: Lives

When green flag clicked
Forever
if lives < 1
hide


99.9999% Crazy, 0.0001% Hamburgeh Makeh  smile

Offline

 

Board footer