
BOUNCE.BAS - GW-BASIC, physics demo ball bouncing
This would be one of my first physics demos ever made. It is using Euler integration of course, but the main idea is that the system is simulation, and not dictated. There were challenges from my recollection on how to handle the rebound on the edges of the screen; I think I first just clamped the values, and this stole away energy. Then I tried reflection, but this did not account for the lost energy from the dampening effect.
I had to recode this a bit for this video capture; the original had hardcoded values for the ball size (radius 4), and I wasn't sure of the correct values to input, since PC-BASIC emulator runs this about 3-4x faster than the original code went. Also, I don't recall ever truly calculating the size of the array needed to store the sprite image (it is 4 bytes header + number of bytes for the image data; for 2-color mode, we have 1 bit per color, thus 8 pixels per byte, which I just realized I entered incorrectly in the code as displayed). Also, the CIRCLE command doesn't truly recognize the 4:3 monitor aspect ratio with the 640x200 resolution which should result in 2.4:1 sized pixels (1.2:1 for 320x200 -- which is the classic 6:5 ratio that annoyed us so).
I believe I did something similar on the TI-99/4A with inspiration from a book that showed how to plot bitmapped graphics in the tiled mode (TI-99/4A vs the TI-99/4 actually had a bitmapped mode, but it was not available to TI BAIC or TI Extended BASIC), where you redefine 64 characters, a single dot in each of the 64 locations of a 8x8 character, and then when you want to draw a pixel, draw the character desires. Ignoring overwrite, it works well, and they tested this with a ball bounce program using a sprite!
My playlists:
--------------------
- Voxel: https://youtu.be/watch?v=XCVWEuhCCDM&list=PLjnbT4UISq0bQF1g85tE9jTrKfEtdRYlY
- Road: https://youtu.be/watch?v=ck5ALX11YU4&list=PLjnbT4UISq0bnfd1RC3M4PgTgkmhlkikV
- Ray Casting 3D: https://youtu.be/watch?v=zjswXUTMP2o&list=PLjnbT4UISq0YcFtRFjFQqK0g6ONNCtrvY
- Side-Scroll Shmup: https://youtu.be/watch?v=fF4X8zN-Raw&list=PLjnbT4UISq0Y_7IAN_zUzxgZnfhXxo_0Q
- MonoGame Tutorial: https://youtube.com/watch?v=WW1dJnfXWb0&list=PLjnbT4UISq0adw__Y9B2eXA0LL35TyORU
My websites:
---------------------
- my GitHub: https://github.com/JDoucette
- my company: http://xona.com
- my Blog: http://thefirstpixel.com