Pages: 1
Topic closed
I only need a code that makes bouncing off of vertical or horizontal surfaces, nothing fancy like side-ways. It needs to be the right thing exactly, no randomness! Thanks in advance.
Offline
pety45 wrote:
this is all <glide( )secs to x
)y
![]()
-_-
No, that is not all, pety45.
I mean BOUNCING off of sprites as in:
Pong
i have a brainfart and cant think of anything else
Offline
Well for pong, the ball script could either be:
When flag Clicked
Forever
change x by (xvel)
change y by (yvel)
if (touching (paddle))
set (yvel) to ((yvel)*-1)
end
You'd also ad a if abs(x)>238 so on and so forth
Another way is:
When flag Clicked
forever
move (5) steps
if on edge, bounce
if touching (paddle)
set direction to ( (180-(direction) )*-1)
end
That should work... one sec...
Last edited by AtomicBawm3 (2011-01-11 12:25:36)
Offline
Look here.Make sure to download the project and read the comments in it!!!
Last edited by ian528 (2011-01-11 15:53:18)
Offline
<when green flag clicked>
<if><touching[
<point in direction( (( <direction> <+> 180 ))
<end>
Offline
Offline
MiffinTheMuffin wrote:
<when green flag clicked>
<if><touching[
<point in direction( (( <direction> <+> 180 ))
<end>
thats not perfect its random
Offline
Topic closed
Pages: 1