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

#1 2013-01-03 14:56:50

leelee100
New Scratcher
Registered: 2012-07-06
Posts: 4

balls bouncing in a maze

I am making a game where there are two tanks in a maze and the balls bounce off the walls ( Like in tank trouble if you've played it)I have tried scripts of my own and others from the interent but none of them work properly becuase sometimes they travel through walls or don't bounce properly. Thank you

Offline

 

#2 2013-01-03 15:12:04

Handyman101
New Scratcher
Registered: 2013-01-03
Posts: 1

Re: balls bouncing in a maze

good idea but dont now what to sugest

Offline

 

#3 2013-01-03 15:19:14

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

Re: balls bouncing in a maze

assuming the maze is top down, it should be a simple matter of using a detector costume to see what orientation the walls are, then using the appropriate script. I'll post code if asked


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

Offline

 

#4 2013-01-03 15:28:42

leelee100
New Scratcher
Registered: 2012-07-06
Posts: 4

Re: balls bouncing in a maze

could you please i'm fairly new

Offline

 

#5 2013-01-03 15:41:51

leelee100
New Scratcher
Registered: 2012-07-06
Posts: 4

Re: balls bouncing in a maze

zammer990 wrote:

assuming the maze is top down, it should be a simple matter of using a detector costume to see what orientation the walls are, then using the appropriate script. I'll post code if asked

yes please

Offline

 

#6 2013-01-03 15:44:57

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

Re: balls bouncing in a maze

Just found this on the wiki, the code involved should be exactly what you want
http://wiki.scratch.mit.edu/wiki/If_on_Edge,_Bounce_(block)


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

Offline

 

#7 2013-01-03 15:47:53

leelee100
New Scratcher
Registered: 2012-07-06
Posts: 4

Re: balls bouncing in a maze

zammer990 wrote:

Just found this on the wiki, the code involved should be exactly what you want
http://wiki.scratch.mit.edu/wiki/If_on_Edge,_Bounce_(block)

i love you so much thnx also i had a look at some of your games and love them

Offline

 

#8 2013-01-03 16:09:05

maxamillion321
Scratcher
Registered: 2011-06-17
Posts: 500+

Re: balls bouncing in a maze

I don't really know how to make the balls move but I know how to make the balls bounce off the wall. Just use this script.

Sprite 1 (ball)

if on edge, bounce

Last edited by maxamillion321 (2013-01-03 16:10:19)

Offline

 

#9 2013-01-04 10:44:21

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

Re: balls bouncing in a maze

maxamillion321 wrote:

I don't really know how to make the balls move but I know how to make the balls bounce off the wall. Just use this script.

Sprite 1 (ball)

if on edge, bounce

That block would only work if the only walls it had to bounce off of were the stages boundaries, the link I posted is a mirror of that, but that works for all blocks


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

Offline

 

Board footer