basic saves the day - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: basic saves the day (/showthread.php?tid=1707) |
basic saves the day - James D Jarvis - 05-28-2023 My son is programming in an implementation of smalltalk and is working on a game where he has to keep track of world space and camera space and wanted to do a simple angle based system a shooter fires at a target and he hasn't studied trigonometry yet. Dad to the rescue! He was mixing up World space and camera space variables but that was fairly easy to spot. I showed him the proper formulas for calculating the difference in coordinates along angles but it wasn't working right for him so I showed him how it worked in QB64. It still wasn't working right for him and it took almost 2 hours of troubleshooting before I realized...doh.. "even though the internal logic of your programming language uses degrees it automatically converts to radians when doing trigonometry" . Luckily I had my little program to show the centuries old math is right. It was just a matter of figuring out which way his programming language thought 0 degrees was and figuring out the lag between object creation and when the angle between two objects was actually reported. Being able to demonstrate the math in basic thanks to QB64 was the winner. RE: basic saves the day - CharlieJV - 05-28-2023 (05-28-2023, 04:21 PM)James D Jarvis Wrote: My son is programming in an implementation of smalltalk and is working on a game where he has to keep track of world space and camera space and wanted to do a simple angle based system a shooter fires at a target and he hasn't studied trigonometry yet. Dad to the rescue! He was mixing up World space and camera space variables but that was fairly easy to spot. I showed him the proper formulas for calculating the difference in coordinates along angles but it wasn't working right for him so I showed him how it worked in QB64. It still wasn't working right for him and it took almost 2 hours of troubleshooting before I realized...doh.. "even though the internal logic of your programming language uses degrees it automatically converts to radians when doing trigonometry" . Luckily I had my little program to show the centuries old math is right. It was just a matter of figuring out which way his programming language thought 0 degrees was and figuring out the lag between object creation and when the angle between two objects was actually reported. Love these kinds of stories ! Good stuff. RE: basic saves the day - bplus - 05-28-2023 +1 Way to go James! RE: basic saves the day - aurel - 05-28-2023 hmmm so he use this; https://squeak.org/ or there is more? RE: basic saves the day - BSpinoza - 05-29-2023 (05-28-2023, 07:31 PM)aurel Wrote: hmmm so he use this; https://cuis.st/ https://pharo.org/ https://www.exept.de/en/smalltalk-x.html ... and much more, see https://en.wikipedia.org/wiki/Smalltalk RE: basic saves the day - James D Jarvis - 05-29-2023 Scratch I believe. I keep encouraging him to go wider but he likes have so much graphical functionality built in. He did write his first computer game at 6 and the scripting that used was very pretty-much C so I still have hopes. It took me a few minutes all those years ago to explain grid coordinates and simple replacement algebra to him. |