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

#1 2012-06-17 20:23:49

bballluke
Scratcher
Registered: 2012-06-17
Posts: 13

Bouncing off walls

I  am making a marble game and I need help getting the bounce effect. Right now, the marble just goes in the opposite direction it hits the wall at. Please help!

if answer is in scratchblocks
     I will be very happy
end

Offline

 

#2 2012-06-17 20:30:01

puppymk
Scratcher
Registered: 2011-09-10
Posts: 100+

Re: Bouncing off walls

if on edge, bounce

Last edited by puppymk (2012-06-17 20:30:55)


http://dl.dropbox.com/u/60598636/puppymk-sig.png

Offline

 

#3 2012-06-17 20:38:44

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Bouncing off walls

puppymk wrote:

if on edge, bounce

Wouldn't work for a sprite or colored wall.

when gf clicked
forever
if <<touching color (x)? > or <touching [sprite x v]?>>
set direction to ((direction) * (-1))

Last edited by Firedrake969 (2012-06-17 20:39:51)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#4 2012-06-17 20:52:45

puppymk
Scratcher
Registered: 2011-09-10
Posts: 100+

Re: Bouncing off walls

Hmmm....... I was thinking something like this might work depending on what you want to do:

when green flag clicked
forever
if <touching sprite 2>
move 10 steps
turn 15 degrees

Last edited by puppymk (2012-06-17 20:53:36)


http://dl.dropbox.com/u/60598636/puppymk-sig.png

Offline

 

#5 2012-06-17 22:08:53

bballluke
Scratcher
Registered: 2012-06-17
Posts: 13

Re: Bouncing off walls

Firedrake969 wrote:

puppymk wrote:

if on edge, bounce

Wouldn't work for a sprite or colored wall.

when gf clicked
forever
if <<touching color (x)? > or <touching [sprite x v]?>>
set direction to ((direction) * (-1))[/quote]

set direction to ( )
This block doesn't exist.

Offline

 

#6 2012-06-17 22:13:11

bballluke
Scratcher
Registered: 2012-06-17
Posts: 13

Re: Bouncing off walls

Firedrake969 wrote:

puppymk wrote:

if on edge, bounce

Wouldn't work for a sprite or colored wall.

when gf clicked
forever
if <<touching color (x)? > or <touching [sprite x v]?>>
set direction to ((direction) * (-1))[/quote]

set direction to ( )
This block doesn't exist.

Offline

 

#7 2012-06-17 23:33:43

puppymk
Scratcher
Registered: 2011-09-10
Posts: 100+

Re: Bouncing off walls

@bballluke: I think you accidentally posted the same post twice.


http://dl.dropbox.com/u/60598636/puppymk-sig.png

Offline

 

#8 2012-06-18 00:02:12

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Bouncing off walls


http://i47.tinypic.com/2iaa73k.png

Offline

 

Board footer