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

#1 2012-02-15 18:30:42

Knuckl3head
Scratcher
Registered: 2012-01-22
Posts: 17

Fragger Type Physics

I am working on a Bloons prototype scratch level, so I need a physics engine that will record the mouse position and length away from sprite and make a sensible trajectory.

Offline

 

#2 2012-02-15 19:01:47

Knuckl3head
Scratcher
Registered: 2012-01-22
Posts: 17

Re: Fragger Type Physics

Can Anyone help me?
I would really like it.

Offline

 

#3 2012-02-15 19:09:41

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Fragger Type Physics

I don't know, but you might get better help in Advanced Topics. This is more complicated than a normal script due to the physics. You could always fake it, though.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#4 2012-02-15 21:48:53

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

Re: Fragger Type Physics

you can get the mouse coordinates and the distance of a sprite to a mouse with blocks under "sensors"

(mouse x)
(mouse y)
(distance to [mouse-pointer])
Probably something like this:

set [ratio] to (((y position)-(mouse y))/((x position)-(mouse x)))
set [ratio] to ([atan] of (ratio))
set [x-velocity] to (([cos] of (ratio))*(speed))
set [y-velocity] to (([sin] of (ratio)) * (speed))

Last edited by MoreGamesNow (2012-02-15 21:58:18)


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

Offline

 

Board footer