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

#1 2007-11-06 05:10:13

ayrshirelad123
Scratcher
Registered: 2007-11-06
Posts: 2

Help Please!

I am trying to create a 'Pong' type of game , simply where the bat moves horizontally and you try and make the bouncing ball hit it , if you miss the game is over.

Their are plenty of these programs on the site but i am stuck

How do you get the ball to move randomly all over the screen?

Last edited by ayrshirelad123 (2007-11-06 05:10:33)

Offline

 

#2 2007-11-06 07:14:34

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Help Please!

There are many ways to let a sprite move randomly across the screen. For a 'Pong' type of game you probably wouldn't want your ball to move completely at random, but rather to start off in a random direction and bounce off the edges in a predictable way. So you could start by setting the ball-sprite's direction to a random number from 1 to 360. Then you could use a forever-loop let the ball move a certain amount of steps and bounce off the edge.

This will pretty much get you started. Now you have to think about a way to find out if the ball hits the bat or the bottom.... (hint: have a look at some of the pong projects around, I'm sure these will  give you some inspiration).

Hope that helps
Jens

P.S. I moved this topic to the All About Scratch section http://scratch.mit.edu/forums/viewtopic.php?id=2094


Jens Mönig

Offline

 

#3 2007-11-06 13:39:55

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Offline

 

#4 2007-11-06 13:41:26

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Help Please!

here http://scratch.mit.edu/projects/yambanshee/49606 download that some where in the balls scripts it has that

Last edited by yambanshee (2007-11-06 13:42:30)

Offline

 

Board footer