10-09-2024, 04:19 PM
(10-09-2024, 03:33 PM)TerryRitchie Wrote: LOL, yeah, well, I asked for help when I was beginning lesson 17 way back in early 2022 however no one had the time to help. When I finished it I asked those with math inclinations to look it over for correctness. Again, nothing, so I figured what I had was good. I am completely self taught when it comes to math.
What is happening here is my confusion over mixing the need to orientate everything to match the screen versus the correct orientation. I've gotten much better over the past 2.5 years and yes, I see the issues you have pointed out.
I would gladly welcome help to correct this lesson.
An update for you from Discord so you won't be as down with yourself.
Quote::17 PM]Pouli: Yeah maybe, but I am doing a Q64 progammin so that should of been obvious. And since Im doing that, I thinking Qb64 cordinate system. And thats why the lessons are set like that, I think. But I found exact part of that lesson yesterday that I believe has the answer Im looking for. I was thinking to actually dig it in to it today with fresh mind. (edited)
[7:57 PM]Pouli: So... This is what I wanted to do. I was thinking it wrong way as I assumed. And I have made mistakes with the cordinates too.
'Moving one point (x1,y1) towards another (x2,y2)
'Set up screen
screen1 = _NewImage(1280, 720, 32)
Screen screen1
'Point 1 (from)
x1 = 636
y1 = 356
'Point 2 (to)
x2 = 900
y2 = 100
vx = x2 - x1
vy = y2 - y1
D = _Hypot(vx, vy) 'Distance between two points
'Normalize to vectors if distance is not 0
If D <> 0 Then
vx = vx / D
vy = vy / D
Else
vx = 0
vy = 0
End If
Do
Cls
'Move points
x1 = x1 + vx
y1 = y1 + vy
'Draw points
PSet (x1, y1)
PSet (x2, y2)
_Display
_Limit 60
Loop
[8:05 PM]Pouli: I might be able to compress this even further if needed, but the idea works now. I really like Terry's lessons. These topics are not exactly my strong suit, as we have seen. However, the examples and the way the lessons present them help a lot, and now I actually understand how and why it's solved like this. Or maybe this is just one way to do it. This is also why I wanted to try something I'm not super good at, and to learn new things along the way. This is why I think programming is so cool, and QB64 is the perfect tool to try and learn new things. Thanks, Terry, for the lessons, and thanks to everyone for the help and patience.
THIS:
I might be able to compress this even further if needed, but the idea works now. I really like Terry's lessons. These topics are not exactly my strong suit, as we have seen. However, the examples and the way the lessons present them help a lot, and now I actually understand how and why it's solved like this. Or maybe this is just one way to do it. This is also why I wanted to try something I'm not super good at, and to learn new things along the way. This is why I think programming is so cool, and QB64 is the perfect tool to try and learn new things. Thanks, Terry, for the lessons, and thanks to everyone for the help and patience.
Never forget this!