Forgot to mention in the Notes: If you press "space" the game toggles between showing the ball or showing the sensor. If you watch the sensor, you'll see that it does what Jen's sensor does. The sensor looks a bit odd, because it is bouncing based on "Spin" and not just the angle of the slope.
The color detection must be separate from the color "display", as you can ghost a sprite almost completely and it works fine. Mayhem's jumping project uses this method to detect platforms. The ball has to be a bit smaller than the sensor to avoid occluding the black edge.
I'm puzzled by what is hanging the online version, it doesn't happen during a "bounce", so maybe it's something else. I'm suspicious that the issue is in ciphering the "Travel Direction", either a logic error or a "re-entrance" problem. I'll need to tidy the code up and try some things out...
Excellent idea, to let the sensor fade using the ghost effect. I didn't even know that the color sensing mechanism would work in combination with the ghost effect. Unfortunately there seems to be some kind of bug in the online version when checking for touching color while rotating. But it does work fine in Scratch when downloaded. I also like the gravity it has. Very inspirational!
Response to a question in the forums about bouncing off of "random" surfaces. After a miserable failure at slope detection, I gained some inspiration from Jens:
(link to project)
Also, many thanks to Canthiar for his tutorial on "reflection" using Vector algebra:
(link to project)
If you are ever wondering "why do I need to learn this" when presented with Vectors, the answer is: You don't, unless you are interested in math, science, engineering, optics, cosmology, etc..., or programming video games. Vectors are a very powerful tool, and once you understand them, they prove to be a simple way to solve a daunting problem.
This version adds "spin": This part of the project is a fudge, I've added some damping, and used "fudge factors" to estimate how much the spin/impact should effect velocity. Playing around with the fudge factors got the ball to the point where it looks pretty realistic, but this isn't accurate physics. Remove anything to that references "Tangent" or "Spin" and you can get back to the real world (with drag neglected). Damping could be removed as well, if spin is taken out. Otherwise, you'll see the "Flubber Effect"...
Comments
You need to be logged in to post comments
Add a Comment
Neato
(view all replies)Comment Reply
its cool
(view all replies)Comment Reply
Forgot to mention in the Notes: If you press "space" the game toggles between showing the ball or showing the sensor. If you watch the sensor, you'll see that it does what Jen's sensor does. The sensor looks a bit odd, because it is bouncing based on "Spin" and not just the angle of the slope.
(view all replies)Comment Reply
This is perfect! good job!
(view all replies)Comment Reply
I see and "odd" bounce now and again in the Java version that I don't see when running it in Scratch.
(view all replies)Comment Reply
Now it works online, nice!
(view all replies)Comment Reply
neat
(view all replies)Comment Reply
The color detection must be separate from the color "display", as you can ghost a sprite almost completely and it works fine. Mayhem's jumping project uses this method to detect platforms. The ball has to be a bit smaller than the sensor to avoid occluding the black edge. I'm puzzled by what is hanging the online version, it doesn't happen during a "bounce", so maybe it's something else. I'm suspicious that the issue is in ciphering the "Travel Direction", either a logic error or a "re-entrance" problem. I'll need to tidy the code up and try some things out...
(view all replies)Comment Reply
Excellent idea, to let the sensor fade using the ghost effect. I didn't even know that the color sensing mechanism would work in combination with the ghost effect. Unfortunately there seems to be some kind of bug in the online version when checking for touching color while rotating. But it does work fine in Scratch when downloaded. I also like the gravity it has. Very inspirational!
(view all replies)Comment Reply
Works if downloaded, but locks up on-line! I'm hoping to add to it, but if it won't work online...
(view all replies)Comment Reply