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

Author
Message
Divided
FPSC Reloaded TGC Backer
8
Years of Service
User Offline
Joined: 31st Oct 2013
Location:
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
Moderator
16
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

Attachments

Login to view attachments

Login to post a reply

Server time is: 2022-10-07 00:32:17
Your offset time is: 2022-10-07 00:32:17