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

#1 2012-04-04 09:15:04

chipskyler
New Scratcher
Registered: 2012-04-03
Posts: 2

Hit/Collision Detecion

I'd like to get a script that will change life by -1 if hit by and object. The object glides from a set point to another set point in a random amount of time.  I can't get the object(which glides) to sense the object(which i want to lose a life with).

Offline

 

#2 2012-04-04 11:16:46

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

Re: Hit/Collision Detecion

[scratchblocks]
when gf clicked
forever
   if <touching(movingsprite)>
      health-1
      direction * -1


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

Offline

 

#3 2012-04-04 11:25:52

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Hit/Collision Detecion

zammer990 wrote:

when gf clicked
forever
   if <touching [movingsprite v]?>
      change [health v] by (-1)
end

Fixed script.  wink  The key detection done is with the blue block: Touching [sprite v]? This tells us if a sprite is touching (hitting) another sprite.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#4 2012-04-04 12:20:35

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

Re: Hit/Collision Detecion

Yea, I know, I just can't get the hand of scratch blocks


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

Offline

 

Board footer