[solved] Help with my pool(billiards) game

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
betobala
Prole
Posts: 11
Joined: Sun May 19, 2024 11:37 pm

[solved] Help with my pool(billiards) game

Post by betobala »

I need to draw the pool cue behind the cue ball, pointing at the mouse position. But I do not know the math to make that happens, can I get some help? :)
Attachments
PoolTEST.love
(41.73 KiB) Downloaded 174 times
Last edited by betobala on Thu May 30, 2024 3:00 am, edited 2 times in total.
User avatar
darkfrei
Party member
Posts: 1197
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help with my pool(billiards) game

Post by darkfrei »

betobala wrote: Fri May 24, 2024 7:59 pm I need to draw the pool cue behind the cue ball, pointing at the mouse position. But I do not know the math to make that happens, can I get some help? :)
Make .love not .rar
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
betobala
Prole
Posts: 11
Joined: Sun May 19, 2024 11:37 pm

Re: Help with my pool(billiards) game

Post by betobala »

darkfrei wrote: Fri May 24, 2024 8:07 pm
betobala wrote: Fri May 24, 2024 7:59 pm I need to draw the pool cue behind the cue ball, pointing at the mouse position. But I do not know the math to make that happens, can I get some help? :)
Make .love not .rar
sorry about that, its my first time making a game.
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Help with my pool(billiards) game

Post by dusoft »

darkfrei wrote: Fri May 24, 2024 8:07 pm Make .love not .rar
Ha!
RNavega
Party member
Posts: 355
Joined: Sun Aug 16, 2020 1:28 pm

Re: Help with my pool(billiards) game

Post by RNavega »

Get the angle between the mouse cursor and the ball with math.atan(mouseY - ballY, mouseX - ballX). The pool cue is 180 degrees (1 pi radians) in the other direction.
temp.png
temp.png (51.67 KiB) Viewed 1954 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests