Posts ID:212739 Favorites Medals
ID:212739

(See the best response by Zaoshi.)
Well i've made a post about this (I think...) But seems like it's gone ;_; So i have to repost... I've got this so far using Forum_account MousePosition library.

 ```obj/Capturing/Stylus icon = 'Stylus.dmi'; icon_state = "Stylus"; screen_loc = "1,1"turf icon = 'trf.dmi';client MouseUpdate(tx, px, ty, py) var/mob/A = src.mob; A.MyStylus.screen_loc = "[tx]:[px - 16],[ty]:[py - 16]"mob Login() ..() track_mouse() var obj/Capturing/Stylus/MyStylus;client/MouseDown() { var/obj/Capturing/Stylus/Stylus = new(); mob.MyStylus = Stylus; src.screen += Stylus;} ```

What i'm missing is the line drawing (Which in my oppinion is a little hard depending on the direction.)

Something like this: http://youtu.be/eFbqywlRZa8?t=3m22s (How line is begin drawed... and how the system checks that pokemon is inside the "circle", i've been looking and seems like this is done by some maths.)

Thanks.
 #1 Jan 28 2012, 11:43 am Well for line drawing, you would want to find the slope between every two points that the mouse enters and create static particles along that path between the two points using the slope. Or you could do the same thing but with angles however computing an angle requires much more math than just finding x and y intercepts
 #2 Jan 28 2012, 3:03 pm Best response Just draw line between last mouse position and new mouse position. For circle thing: 1. Calculate center of pokemon (or define one manually); 2. Calculate center of drawn circle; to simplify process use center of AABB; 3. If center of pokemon is closer to the center of the circle than the closest point of the circle to the center of the circle then pokemon is inside circle.