Couldn't think of a better place to put this.
Basically, for a small project I'm working on (will be released as a script, don't worry) I'm setting up more advanced mouse interactions. All was going well, until I stumbled upon one algorithm that just hates me, and I've been staring at a blank canvas since.
I need to detect if the mouse has drawn a circle around an event. I already determine a single pixel to be the event's checking point, to allow moderate crudeness in regards to bounding box sizes. I had an idea, at some point and time, but it escaped me, and I cannot seem to get it back. I provided a couple of the supporting methods so at least my blank canvas can be understood.
def update_mouse_buffer
if @counter == 3
@m_buff_array_x << @mouse.x
@m_buff_array_y << @mouse.y
@counter = 0
endif
@counter += 1
end
def update_mouse_commands
check_mouse_click
check_mouse_rclick
check_mouse_hover
check_mouse_hold
check_mouse_slash
check_mouse_circle
clear_mouse_buffer if @clear_buffer
end
def check_mouse_circle
(logic, not syntactically correct!)
for event in $game_map.events[]
for count in @m_buff_array_y.size
mouse_x = @m_buff_array_x[count]
mouse_y = @m_buff_array_y[count]
check_event_centers(event)
target_y = @event_center_y
target_x = @event_center_x
##What to do next??
end
end
end
If someone helps my scrambled brain, I'll give credit of course! And thanks! That's right, both!
lol Thanks guys.
Basically, for a small project I'm working on (will be released as a script, don't worry) I'm setting up more advanced mouse interactions. All was going well, until I stumbled upon one algorithm that just hates me, and I've been staring at a blank canvas since.
I need to detect if the mouse has drawn a circle around an event. I already determine a single pixel to be the event's checking point, to allow moderate crudeness in regards to bounding box sizes. I had an idea, at some point and time, but it escaped me, and I cannot seem to get it back. I provided a couple of the supporting methods so at least my blank canvas can be understood.
def update_mouse_buffer
if @counter == 3
@m_buff_array_x << @mouse.x
@m_buff_array_y << @mouse.y
@counter = 0
endif
@counter += 1
end
def update_mouse_commands
check_mouse_click
check_mouse_rclick
check_mouse_hover
check_mouse_hold
check_mouse_slash
check_mouse_circle
clear_mouse_buffer if @clear_buffer
end
def check_mouse_circle
(logic, not syntactically correct!)
for event in $game_map.events[]
for count in @m_buff_array_y.size
mouse_x = @m_buff_array_x[count]
mouse_y = @m_buff_array_y[count]
check_event_centers(event)
target_y = @event_center_y
target_x = @event_center_x
##What to do next??
end
end
end
If someone helps my scrambled brain, I'll give credit of course! And thanks! That's right, both!
lol Thanks guys.