Jon_joy_1999 - Thanks for the info. I have that bug fixed already, but before I update the scene, I'm going to put it through the wringer and make sure that the scoring system is correct for all situations (strikes, spares, and open frames) before I update it. I should have it completed in a day or two.
Angle is in units of Radians, not degrees. The scene seems to work, but it's not flipping heads and tails every 180 degrees as you probably thought it would, based on your code.
Stick an axle in the middle of your coin, and make it rotate slowly. You will see that the coin doesn't flip every 180 degrees. If you want to use degrees, the conversion is Deg = Rads * 180/pi.
actually, this is simpler and it works just as well:
{
angle < 0 ? {scene.my.tails = 1} : {};
angle > 0 ? {scene.my.tails = 0} : {};
1.0
}
It works because in Algodoo, a complete rotation goes from zero to +pi (3.14) in the first 180 degrees, and -pi (-3.14) in the second 180 degrees, back to zero. So, you only need to check if the angle is positive or negative in order to make something happen twice per rotation!
EDIT: After thinking about it, I realized that the script can be made even simpler!
Nice job! I have a suggestion which would make the drawing easier to view. Select all of the vertical and horizontal beams that currently block the drawing and make them transparent with the "A" slider in the "Appearance" selection of the pull-down menu. Also uncheck the "borders" check boxes. After doing that, the drawing will be completely clear except for the circle and the tracer that draws the pattern.
Mechanically, it moves very smoothly. Again, nice job.
s_noonan - The coin OnHitByLaser generates a script that gets placed in the ControllerAcc variable. That script starts running, which toggles the heads and tails. That toggling of the heads and tails is done this way:
The texture image is a picture of a both sides of a U.S. Nickel (they are side-by-side, right next to each other). The image changes by SHIFTING the X position of the image in the textureMatrix. For a few milliseconds, the heads image shows, then the X-position changes so that the Tails image then shows for a few milliseconds, and the sequence repeats until the coin collides with a wall. The OnCollide code sticks a constant (11.0) in the ControllerAcc variable which overwrites the script that was originally put there by the OnHitByLaser code. With the script that toggles the coin image now gone, the image stays on either heads or tails depending on what was showing when the collision took place. That's it!
Kilinich - Check out my Polygon Raster Scanner scene. I added a little code to your scene to make a simple raster scanner. It just shows that you can use your scene to make many other things just by using the output of your code that detects the polygon surface to do other things. FUN STUFF!
Kilinich - Yes, I realized how slow it is when I implemented my scanner scene. I would like to do my own version of the scanner with faster code, but I do not know how to do it. Any suggestions from you, my Russian comrade, would be greatly appreciated.
s_noonan - That's only true if the person using the scanner is already messed up in the head.
One suggestion with efficiency in mind. I noticed that your code continues storing steps even while no commands are being given. In the real world, that would be a waste of memory, and would make the program data files unnecessarily large. My suggestion is to store steps only when any of the motion keys is being pressed. Just a gut feeling that this would not be too difficult to do. If you have no interest in doing this, I would be happy to work on it myself because this is a truly awesome scene. In my opinion it is your best work!
Kilinich has stated publicly more than once that Algodoo is his hobby. So even if he decided to program games as a professional, I suspect that he will always remain here with Algodoo as his hobby.