Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Equation For Specific Line Length Needed
#5
Steve, I thought that would be the case too, but I couldn't get that to work for some reason, maybe I did it wrong. But mostly, I know that equation but I still don't know how it works. B+'s equation works perfectly with the added camera.x and camera.y in the beginning. Here, this is what I have for the sword. lhandx and lhandy keeps the sword in his moving left hand. I brought the length down from 100 to 75 to make it look better.

Code: (Select All)
    'Sword
    swordx = player.x + camera.x + lhandx
    swordy = player.y + camera.y + lhandy

    a = _Atan2(mousey - swordy, mousex - swordx)
    sx = swordx + 75 * Cos(a)
    sy = swordy + 75 * Sin(a)
    Line (swordx, swordy)-(sx, sy), &HFFFFFF00
Reply


Messages In This Thread
RE: Equation For Specific Line Length Needed - by SierraKen - 08-16-2022, 03:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fibonacci Help needed! Unseen Machine 18 1,408 12-26-2025, 09:05 PM
Last Post: Petr
  Setting Line _RGB colours PhilOfPerth 10 1,982 11-03-2024, 05:37 AM
Last Post: PhilOfPerth
  help needed BloodyHash 9 1,854 05-01-2024, 08:11 PM
Last Post: TerryRitchie
  Loading font from memory help needed... Dav 6 1,413 09-16-2023, 04:03 PM
Last Post: SMcNeill
  Having trouble Windows command line SORT via SHELL GTC 19 4,476 08-26-2023, 04:19 AM
Last Post: GTC

Forum Jump:


Users browsing this thread: 1 Guest(s)