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

#1 2010-03-10 15:59:04

Navineous
Scratcher
Registered: 2009-03-19
Posts: 87

Physics

I wanna know how to make a physics game, so far I have a black and red ball, a yellow bg and a red bar, I want it to touch the red bar and go up for a certain amount (Smoothly so it's not change y by 1 as long as it's touching the red.) I also want it to fall until it hits the red... so just physics? Any help, I need to learn viarable physics >_>


http://img87.imageshack.us/img87/666/navitek.png

Offline

 

#2 2010-03-10 18:11:43

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Physics

I would start with learning gravity.  make a ball fall.  you have the ball's y position.  you need a variable called something like Yvelocity. 


Code:

Move ball Y to 100. (this moves the ball to the top.)
Set Yvelocity to 0.  (so it doesn't start moving.)
Forever
   change Yvelocity by -1  (this adds to the velocity of the ball going down.)
   change the y position by Yvelocity

so the ball starts moving slowly down and speeds up.

Now make it so the ball bounces when it reaches the ground.

Here's a project I made.  Try to figure out how it works.  Try changing things in the script.  Let me know if you have questions.
http://scratch.mit.edu/projects/AddOne/827476


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

Board footer