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

#1 2012-07-29 16:48:21

Subsidel
New Scratcher
Registered: 2012-07-22
Posts: 35

Help: Bounce of walls problem- (see project)

I cant progress with my game until my ship bounces of the white or blue walls somehow... please see my project because my ship moves differently (point to direction [-1 x direction] doesnt work u see). My project underneath:

http://scratch.mit.edu/projects/Subsidel/2702952

Cheers

Offline

 

#2 2012-07-29 21:08:11

daniel_j
Scratcher
Registered: 2012-05-22
Posts: 100+

Re: Help: Bounce of walls problem- (see project)

I've been looking at that on my copy too xD
after school, i'll try it, and if success full post it online  wink


http://i50.tinypic.com/2dhgnsx.jpg

Offline

 

#3 2012-07-29 21:21:56

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Help: Bounce of walls problem- (see project)

The easiest way I've found (using x and y velocities) is below.  Though you use direction to change these values, the technique should still work (it would be easier in my - uncommon - opinion if all your walls were the same color, which is how I've written my script)

when gf clicked
forever
calculate velocities
change x by (x-vel)
if<touching [wall v]?>
set [x-vel v] to ((-1)*(x-vel))
change x by (x-vel)
end
change y by (y-vel)
if<touching [wall v]?>
set [y-vel v] to ((-1)*(y-vel))
change x by (y-vel)
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-07-30 01:55:03

Subsidel
New Scratcher
Registered: 2012-07-22
Posts: 35

Re: Help: Bounce of walls problem- (see project)

So i guess i need to change my bomb bounce to using x and y velocities as its currently using colour to detect the walls which are positioned on the x axis/ y axis. Thnx v much. Daniel would rly appreciate your help too  smile

Offline

 

Board footer