Grappling hook: Add hook indicators#2215
Conversation
Rename the assets to how they are used in the game. Duplicate the previously named "indicator_down.png" and modify this asset so it looks like a yellow arrow. The red one (which matches the aim indicator around the player) will be used for indicating when something can be hooked.
|
Play this branch at https://play.threadbare.game/branches/endlessm/indicators/. (This launches the game from the start, not directly at the change(s) in this pull request.) |
Maintain an array of observers in HookableArea. In the same way as InteractArea. But these are the HookControl nodes that are pointing at this area. Add a marker for the indicator in HookableBox. The fallback that automatically creates the marker 32 pixels above the anchor point seems fine for pins and needles. Resolve #1503
|
I recommend testing this in the following scenes:
recording.webmIt seems to work. The problem I'm still trying to solve is that the indicator stays after throwing. This is noticeable when collecting buttons: recording.webmThe HookControl has a AIMING_PAUSED state and I'm trying to use it, but that state is obviously not being set. |
The last hook control was set to the AIMING_PAUSED state only when hitting a wall or the air. It should pause too while hooking. As before, if the hooked area has a hook control (like the needles), disable this control to "transfer" the aiming to the next one.
|
OK I've found and fixed the issue above. It was indeed a case that was missing setting the control to "aiming paused". |
wjt
left a comment
There was a problem hiding this comment.
Looks great! I like that the new interact indicator is a different shape as well as colour.
There was a problem hiding this comment.
This is a copy-paste of interact_indicator.gd. I guess we may want to change the behaviour of one or the other at some point in the future, so, OK!
| _indicator = HOOKABLE_INDICATOR.instantiate() | ||
| if indicator_point: | ||
| indicator_point.add_child(_indicator) | ||
| # _indicator.bouncing = true |
| func _set_state(new_state: State) -> void: | ||
| state = new_state | ||
| if not ready: | ||
| if not is_node_ready(): |
There was a problem hiding this comment.
What's the difference between property ready and function is_node_ready? Oh, the former is a signal so is always truthy! Good catch.
| ## If an area was being pointed at, clear it. | ||
| func clear_pointing_at_area() -> void: | ||
| if _pointing_at_area: | ||
| _pointing_at_area.remove_observer(self) | ||
| _pointing_at_area = null |
There was a problem hiding this comment.
Another way to spell this would be with a setter on the property above:
var _pointing_at_area: HookableArea:
set = _set_pointing_at_area
func _set_pointing_at_area(new_value: HookableArea) -> void:
if _pointing_at_area == new_value:
return
if _pointing_at_area:
_pointing_at_area.remove_observer(self)
_pointing_at_area = new_value
if _pointing_at_area:
_pointing_at_area.add_observer(self)Then you would just assign to _pointing_at_area in _update_pointing_at_area. Not sure if it's clearer!
There was a problem hiding this comment.
OK, it's more complicated than I thought because of the exclude_areas. Ignore my suggestion!
UI indicators: Add specific asset for interacting
Rename the assets to how they are used in the game. Duplicate the previously named "indicator_down.png" and modify this asset so it looks like a yellow arrow. The red one (which matches the aim indicator around the player) will be used for indicating when something can be hooked.
Grappling hook: Add hook indicators
Maintain an array of observers in HookableArea. In the same way as InteractArea.
But these are the HookControl nodes that are pointing at this area.
Add a marker for the indicator in HookableBox. The fallback that automatically
creates the marker 32 pixels above the anchor point seems fine for pins and
needles.
Grappling hook: Pause aiming also when hooking
The last hook control was set to the AIMING_PAUSED state only when hitting a
wall or the air. It should pause too while hooking. As before, if the hooked
area has a hook control (like the needles), disable this control to "transfer"
the aiming to the next one.
Resolve #1503