

The reason for checking keys is it is the only way i know how to do it. This input handling script is what im finding the most trouble with, a lot of the lines are added because I read a 6yr old reddit comment that said to use it and im not sure if I should remove it because then bugs start appearing.
The reason for unhandled input was the first input handling code example I saw and honestly I forgot about input(). I’ll look into the creating input actions but at a glance it doesn’t seem like it could work for my game. This game is pretty much left click right click on a 2d space and depending on what tool is selected.
I really do want to move some of the code into other functions but im not sure how to make a function that handles the input over multiple different states.
For example dragging a box. needs to check for the left click then check for the dragging state and draw on drag then check for a release. I have a lot of tools that will need to implement this so I’d really like to get this logic out of the main function and into a nice reusable block.
code example
elif selected_type == "command":
if selected_item == "structure_dict_growing":
if is_dragging and event is InputEventMouseMotion:
var grid_pos = tilemap.local_to_map(camera.get_global_mouse_position())
var local_pos = tilemap.map_to_local(grid_pos)
drag_end = local_pos + Vector2(32, 32)
cam_drag_end = get_viewport().get_mouse_position()
gui.queue_redraw()
get_viewport().set_input_as_handled()
return
elif event is InputEventMouseButton and not event.pressed:
if event.button_index == MOUSE_BUTTON_LEFT:
is_dragging = false
gui.queue_redraw()
get_viewport().set_input_as_handled()
MessageBus.rpc_id(1, "request_zone_growing", selected_item ,drag_start, drag_end, multiplayer.get_unique_id())
drag_start = null
drag_end = null
return
elif event is InputEventMouseButton and event.pressed:
if event.button_index == MOUSE_BUTTON_LEFT:
is_dragging = true
#to snap to grid
var grid_pos = tilemap.local_to_map(camera.get_global_mouse_position())
var local_pos = tilemap.map_to_local(grid_pos)
drag_start = local_pos - Vector2(32, 32)
cam_drag_start = get_viewport().get_mouse_position()
gui.queue_redraw()
get_viewport().set_input_as_handled()
return




















Yes you are almost correct for once. They didnt defeat nazism they helped defeat nazism.It only happened because they were betrayed.
ITS BAD.