Here's the concept, but with a square boundary instead of a circle. It's late, so remembering the math required to make the boundary a circle is giving me a headache right now even though i'm sure it's simple
I'm sure one of the other participants in the thread could modify it easily, if they so chose.
crosshair by mouse delta.mfa
Last edited by casleziro; 16th January 2018 at 06:00 AM.
Another feature I'd like, and I know I'm pushing it here, but if the crosshair could track alongside the player. So if you're aiming to the left and move the player up, the crosshair goes up as well, and same for every other direction.
I haven't really read this forum so sorry if this has already been covered or if I'm way off the mark but this is a pretty crude version of what I think you are after. I was expecting to have to do some work to stop the cursor getting stuck to the side of the circle but actually it's not too bad as it is. It is a little bit sticky though so if you want me to smooth it out I can give it a go.
I feel like I'm putting people through a lot here, so if someone fixes this up for me all nice I'll... I don't know, find some way to get $5 to you or something
Yeah, I'd quite like to fix the stickiness too; I'll do it when I've got a bit more time.
As for attaching the thing to a moving object; that should be very simple. The x and y coordinates of the centre of the restricted zone are stored in a pair of alterable values in the Cursor Object. Just change the values to whatever the moving objects coordinates are each turn and things should work fine.
Don't worry about it; I'm happy to help. I get a lot of assistance from the Clickteam community and it's nice to be able to give back when I can.
Sorry, not quite as simple as I initially thought. The cursor doesn't get dragged along by the edge of the restricted zone if the zone moves beyond the cursor. Won't be too hard to fix but I don't have time now. I'll try and send you something within the next day or two.
Wow, I must have something wrong with me; you'd already said that. I thought I'd read your post. I'll fix it soon but I definitely don't have time now.
Last edited by CoffeeCup; 16th January 2018 at 09:07 AM.
Perhaps there's a quick & short solution,
if I got it right from this picture you posted
(sorry didn't read the whole thing so maybe I've misunderstood!)
you can customize the max distance the cursor can travel in its alt. value "max_dist"
(can change it in runtime too if you wish)
@schrodinger great example! But the "orbit from center" approach isn't what bhlaab was looking for.
I managed to shave the edges off the square and it should be working exactly as you want it right now. I added the crosshair moving along with the player: it just follows the same logic as the crosshair being moved by the mouse (add player delta to crosshair position).
crosshair by mouse delta_2.mfa
EDIT x2: Take care with the order of your events. The events from this example (minus the "start of frame" one) should go below your player movement code if you are using a custom engine, otherwise the system will break.
Last edited by casleziro; 17th January 2018 at 04:28 AM. Reason: messed up first few edits
if i understand correctly what is wanted is to keep the crosshairs contrained within the area of the circle but not only on the outer perimeter.
Sent from my iPhone using Tapatalk