Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Move a square of points around with the mouse

FPSC Reloaded TGC Backer
Years of Service
User Offline
Joined: 31st Oct 2013
Posted: 23rd Sep 2022 02:00
Hey there!

My math is terrible and I'm having trouble calculating moving a set of points around some distance from the mouse.

Imagine I have a square in the center of the screen using the DrawBox function, what i'd like to achieve is when I click and drag inside the bounds of the box, I should be able to drag the box around while it maintains it's shape.

I wrote a distance function to get the distance from the mouse position some point. This seems to work, but I think I'm missing an variable in the calculation because when I click on the box it expands.

Some of the code snippets I've used are:
Real programmers don't comment their code, because it should be written with readability in mind.
Virtual Nomad
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Sep 2022 03:44 Edited at: 23rd Sep 2022 03:48
not following your snippets or how they do what you need but, 1 way:

comments omitted as requested


Login to view attachments

Login to post a reply

Server time is: 2023-12-09 05:06:43
Your offset time is: 2023-12-09 05:06:43