Canthiar this must be the most complicated script anywhere. You inspired me to give circular bouncing a shot (link to project) Mine isn't as good but I thought you might want to see it.
If you want more balls then download the source and use the copy tool. You can have only 3 large collision objects, but you can have as many smaller ones as your computer can run.
Martin, that's really cool. I'm happy to see the code get reused. I do really like the pinball machine idea. I will have to add some flat surfaces to get that to work properly, but it shouldn't be too difficult.
Canthiar: Good idea! I hope you like my modifications (Soundcolors) at: (link to project)
It lacks the purity of your original but it's somehow even more fun :-). Mohlar's above idea to make a Pinball-Mashine out of it sounds great!
Thanks for the suggestion Martin, I've uploaded a new version that can be downloaded. I hadn't expected people to download and run it and didn't notice the issue with this program until after I tried to download it. I did make a post in the forums about this issue.
Addendum: After saving an loading the problem is back again: You can't save the current version "Bouncing Balls" with SCRATCH 1.2! You have to carry out your above correction every time after loading it!
A work-around is writing: 25/1000000 instead of 0.000025 (but that costs some calculatingtime).
You have 0.000025 also in the last line of your "cos"-function in your math-library-sprite.
Canthiar, thank you very much! It worked immediately. Who could think of this? Did you already report the bug to the SCRATCH-Makers? I wished the Squeak-Smalltalk-Source-Code of SCRATCH would have been published already (it's said to be published end of 2007), than we had a chance to fix those kind of bugs ourself. Furthermore you could implement trigonometrically functions and other stuff (your replacement for that in "Bouncing Balls" is great!). It would be wonderfull to have a SCRATCH that you could parameterise from "beginner" to "pro": So students could start with a few concepts and got more and more up to a fully Smalltalk-like environment. What do you think?
Martin, I do know what the problem is. There is a bug in scratch when it reads files that have a small number in them. You're going to have to delete every ball except one. Then 3/4 into the ball code and you should see [set result to ((result) + ((angle power) * (2.5e-5)))]. Change the 2.5e-5 to 0.000025. Then click on the copy button, hold down the shift key and click on the ball sprite several times.
Hi Canthiar: Can you help me? After downloading and running it in SCRACTCH 1.2, the balls vanish directly after hitting the collision-Objects. Do you know that phenomenon?
Download the 12 sprites and 16 scripts of "Bouncing Balls" and open it in Scratch
Project Notes
You can move the object emitter around with the mouse and change the direction by clicking on the pointed end.
This is what I consider a production version since I've inlined a few things. I have a more academic version that is a little easier to read. The whole thing is also dumbed down a little to make the math a little easier.
How it works:
When a ball encounters a collision object it uses the [ point towards[ Collision ] ] command block and then uses sin and cos to calculate a colliion normal. That normal is used to calculate a resulting velocity perpendicular to the surface and velocity tangent to the surface. Friction and restitution are applied to make the ball bounce.
Comments
You need to be logged in to post comments
Add a Comment
seems like you beat seancanoodle to it. (he's making a bunch of pin bounce things)
all alla la
Canthiar this must be the most complicated script anywhere. You inspired me to give circular bouncing a shot (link to project) Mine isn't as good but I thought you might want to see it.
Awsome!
The ball thingies should collide with themselves.
cool!
XD Half plus a half plus a half awesome. Lol that's 3 halfs
swwwwwweeeeeeeeeet!!!! how do you do that?!?
nice very nice i think its so cool how u did that\
nice! 10 thumbs up
cool!
woah!!!!!!
(:-O) (That is the most complicated piece of scratch code i have ever seen!) AMAZING!!!!!!!!
i dont get it???????????/
ohoh so many variables
this is good lol i wish i made it!
all your projects are scientific or mathematic... its cool!!
oh
Restitution is a fancy word for bounciness.
Whats restitution in this case?
Sick!
Nice piece of programing, please check out some of my pojects!
Argh! My stupid computer wont let play anything! sgdbvxdhcxdhvchnasbdchzsbjcmvjmsdbjkcmsdbc!
i hav to now admit u r the best programmer on scrathc after see ing this
yet another great project! check out his random maze program its a-maze-ing
Cool, glad to hear it all worked out. I may roll that change back into this program.
Canthiar: Thank you for your help! Now it works: http://scratch.media.mit.edu/projects/MartinWollenweber/8708
I saw that earlier, but figured it was solved. I will take another look.
Hi Canthiar! Can you help to solve folowing problem with a mod-version of Bouncing Balls? (link to forums)
Eyvind: That was a typo it's SCRATCH 1.1
you're brilliant.... that's all I can say....
Excuse me MartinWollenweber, where do you download scratch 1.2?
If you want more balls then download the source and use the copy tool. You can have only 3 large collision objects, but you can have as many smaller ones as your computer can run.
how do you make it fire more balls
Or a good one.
Thats not a baad comment
This reminds me of cows jumping over the moon, believe it or not.
It didn't start off being very large, but getting it to run fast required me to inline the sin and cos calculations which bloated it a little bit.
this must have had a monster scrip
Hey, someone make a pong game outta this or something.
wow!
Check out what MartinWollenweber has done, I think it's a pretty good version 2.
The Best! Why not have version 2?
d00d 3p1x
that is aw3som3 but th3 dir3ctions ar3 too complicat3d for m3...h3h3...m3 l3ss than 3 it...h3h3 g3t it...<3 it
Martin, that's really cool. I'm happy to see the code get reused. I do really like the pinball machine idea. I will have to add some flat surfaces to get that to work properly, but it shouldn't be too difficult.
Canthiar: Good idea! I hope you like my modifications (Soundcolors) at: (link to project) It lacks the purity of your original but it's somehow even more fun :-). Mohlar's above idea to make a Pinball-Mashine out of it sounds great!
Thanks for the suggestion Martin, I've uploaded a new version that can be downloaded. I hadn't expected people to download and run it and didn't notice the issue with this program until after I tried to download it. I did make a post in the forums about this issue.
I think I will make that change and upload it so that other people can download this and make change changes as they see fit.
cool!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Addendum: After saving an loading the problem is back again: You can't save the current version "Bouncing Balls" with SCRATCH 1.2! You have to carry out your above correction every time after loading it! A work-around is writing: 25/1000000 instead of 0.000025 (but that costs some calculatingtime). You have 0.000025 also in the last line of your "cos"-function in your math-library-sprite.
Canthiar, thank you very much! It worked immediately. Who could think of this? Did you already report the bug to the SCRATCH-Makers? I wished the Squeak-Smalltalk-Source-Code of SCRATCH would have been published already (it's said to be published end of 2007), than we had a chance to fix those kind of bugs ourself. Furthermore you could implement trigonometrically functions and other stuff (your replacement for that in "Bouncing Balls" is great!). It would be wonderfull to have a SCRATCH that you could parameterise from "beginner" to "pro": So students could start with a few concepts and got more and more up to a fully Smalltalk-like environment. What do you think?
Martin, I do know what the problem is. There is a bug in scratch when it reads files that have a small number in them. You're going to have to delete every ball except one. Then 3/4 into the ball code and you should see [set result to ((result) + ((angle power) * (2.5e-5)))]. Change the 2.5e-5 to 0.000025. Then click on the copy button, hold down the shift key and click on the ball sprite several times.
Hi Canthiar: Can you help me? After downloading and running it in SCRACTCH 1.2, the balls vanish directly after hitting the collision-Objects. Do you know that phenomenon?
Nice
Great!
awsome
kool
this is cool.
kool