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

#1 2012-11-21 12:24:16

nintendo828
Scratcher
Registered: 2012-09-28
Posts: 15

How to make an enemy bounce off walls

I want to make a Mario game, but the goombas won't bounce off the walls. When I say bounce off the walls, I mean bounce off the wall and then move in the opposite direction. Help me please!


Minecraft, Nintendo, Lamborghini Gallardo And Ford Model T FOREVER!!!!!

Offline

 

#2 2012-11-21 12:33:34

GenChico
Scratcher
Registered: 2012-11-08
Posts: 100+

Re: How to make an enemy bounce off walls

In the Goomba's Scripts put


when gf click
forever
if on edge, bounce


http://i.imgur.com/Cb8HC.png

Offline

 

#3 2012-11-21 13:10:54

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: How to make an enemy bounce off walls

GenChico wrote:

In the Goomba's Scripts put


when gf click
forever
if on edge, bounce

or


when gf clicked
forever
if <touching color [red])> //set the colour to the colour of the walls
turn cw (180) degrees
end

Last edited by muppetds (2012-11-21 13:12:11)


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#4 2012-11-21 13:16:27

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: How to make an enemy bounce off walls

nintendo828 wrote:

I want to make a Mario game, but the goombas won't bounce off the walls. When I say bounce off the walls, I mean bounce off the wall and then move in the opposite direction. Help me please!

If your walls are the edge, then do this:

when gf clicked
forever
whatever goes here
if on edge, bounce
If your walls are not on the edge, do this:
 when  gf clicked
forever
whatever goes here
if <touching [wall v]?>
point in direction ((180) - (direction))


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

Board footer