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

#1 2012-10-22 07:11:29

MFaizan
New Scratcher
Registered: 2012-10-17
Posts: 1

hELP VITH TAKING SPRITES VELOCITY

Please can anyone help me to get the velocity of sprite so that i can apply it on its colision with other sprites

error comes when the timer becomes zero

i m doing that when the distance of 1st sprite is less than 150 to 2nd sprite reset timer and when they collide take the new time and divide 150 with timer here is the velocity but the timer becomes zero some time


do anyone have another idea

Offline

 

#2 2012-10-22 11:35:02

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: hELP VITH TAKING SPRITES VELOCITY

Well, it's because you're resetting once they get close, therefore, even when they are colliding, the timer will reset. Perhaps try resetting when the sprites move past the 150 distance mark, but only once.

when gf clicked
forever
if <(distance to [sprite 2 v]) < (150)>
reset timer
wait until<(distance to [sprite 2 v]) > (150)>
end
end
This will reset, then wait until they are at least 150 apart before being able to fire again.


Hai.

Offline

 

Board footer