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

#1 2012-10-11 11:53:03

RoguePhantom01
Scratcher
Registered: 2012-04-05
Posts: 100+

Fall damage?

Can any one help me with scripts for fall damage? I'm programming a game and I want to make a function, which, If you fall for let's say 100 pixels you would take damage or die. I' trying to program it, but I'm having a hard time. Anyone?


http://i1273.photobucket.com/albums/y404/orangetelephone/sig2.jpg

Offline

 

#2 2012-10-11 14:26:15

black_eye
New Scratcher
Registered: 2012-09-20
Posts: 19

Re: Fall damage?

You could try to make the ground sensor time how long it takes for the player to land (as in while it's not touching the ground) and if it's over x seconds, the damage is applied.

Offline

 

#3 2012-10-11 19:37:23

RoguePhantom01
Scratcher
Registered: 2012-04-05
Posts: 100+

Re: Fall damage?

black_eye wrote:

You could try to make the ground sensor time how long it takes for the player to land (as in while it's not touching the ground) and if it's over x seconds, the damage is applied.

Thanks!


http://i1273.photobucket.com/albums/y404/orangetelephone/sig2.jpg

Offline

 

#4 2012-10-11 21:54:03

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Fall damage?

You can either build a counter into your fall loop (see below) or use y-velocity and say "if (y velocity) > (some number), then die.

When I receive [begin to fall v]
set [fall v] to (0)
repeat until<touching [ground v]?>
change [fall v] by (5)
change y by (-5)
end
if<(fall) > (20)>
blocks you use to kill sprite go here
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer