generated from krampus/template-godot4
	Input polling looks for exact match to avoid smashing modifier inputs
This commit is contained in:
		
							parent
							
								
									8dd9e0b4c5
								
							
						
					
					
						commit
						b633ceb0c4
					
				| @ -579,7 +579,7 @@ func _process(_delta: float) -> void: | ||||
| 
 | ||||
| 	## Input Handling | ||||
| 	if control_disabled: | ||||
| 		if Input.is_action_just_pressed("camera_cancel"): | ||||
| 		if Input.is_action_just_pressed("camera_cancel", true): | ||||
| 			if is_instance_valid(_free_camera) and not _returning_free_camera: | ||||
| 				_returning_free_camera = true | ||||
| 				var tween := get_tree().create_tween() | ||||
| @ -599,76 +599,76 @@ func _process(_delta: float) -> void: | ||||
| 	match phase: | ||||
| 		Phase.AIM: | ||||
| 			# Camera zoom | ||||
| 			if Input.is_action_just_pressed("shot_zoom_in"): | ||||
| 			if Input.is_action_just_pressed("shot_zoom_in", true): | ||||
| 				camera_distance = max(camera_distance - 1.0, ZOOM_MIN) | ||||
| 			if Input.is_action_just_pressed("shot_zoom_out"): | ||||
| 			if Input.is_action_just_pressed("shot_zoom_out", true): | ||||
| 				camera_distance = min(camera_distance + 1.0, ZOOM_MAX) | ||||
| 
 | ||||
| 			# Club select | ||||
| 			if Input.is_action_just_pressed("club_next"): | ||||
| 			if Input.is_action_just_pressed("club_next", true): | ||||
| 				club_type = _get_relative_club(1) | ||||
| 			if Input.is_action_just_pressed("club_previous"): | ||||
| 			if Input.is_action_just_pressed("club_previous", true): | ||||
| 				club_type = _get_relative_club(-1) | ||||
| 			if Input.is_action_just_pressed("select_driver"): | ||||
| 			if Input.is_action_just_pressed("select_driver", true): | ||||
| 				club_type = Club.Type.DRIVER | ||||
| 			if Input.is_action_just_pressed("select_iron"): | ||||
| 			if Input.is_action_just_pressed("select_iron", true): | ||||
| 				club_type = Club.Type.IRON | ||||
| 			if Input.is_action_just_pressed("select_wedge"): | ||||
| 			if Input.is_action_just_pressed("select_wedge", true): | ||||
| 				club_type = Club.Type.WEDGE | ||||
| 			if Input.is_action_just_pressed("select_special"): | ||||
| 			if Input.is_action_just_pressed("select_special", true): | ||||
| 				club_type = Club.Type.SPECIAL | ||||
| 			if Input.is_action_just_pressed("select_putter"): | ||||
| 			if Input.is_action_just_pressed("select_putter", true): | ||||
| 				club_type = Club.Type.PUTTER | ||||
| 
 | ||||
| 			# Ball select | ||||
| 			if Input.is_action_just_pressed("ball_next"): | ||||
| 			if Input.is_action_just_pressed("ball_next", true): | ||||
| 				ball_type = player.next_ball(ball_type) | ||||
| 			if Input.is_action_just_pressed("ball_previous"): | ||||
| 			if Input.is_action_just_pressed("ball_previous", true): | ||||
| 				ball_type = player.prev_ball(ball_type) | ||||
| 
 | ||||
| 			# Switch to free cam | ||||
| 			if ( | ||||
| 				Input.is_action_just_pressed("camera_back") | ||||
| 				or Input.is_action_just_pressed("camera_forward") | ||||
| 				or Input.is_action_just_pressed("camera_left") | ||||
| 				or Input.is_action_just_pressed("camera_right") | ||||
| 				Input.is_action_just_pressed("camera_back", true) | ||||
| 				or Input.is_action_just_pressed("camera_forward", true) | ||||
| 				or Input.is_action_just_pressed("camera_left", true) | ||||
| 				or Input.is_action_just_pressed("camera_right", true) | ||||
| 			): | ||||
| 				insert_free_cam() | ||||
| 
 | ||||
| 			# Advance to next phase | ||||
| 			if Input.is_action_just_pressed("shot_accept"): | ||||
| 			if Input.is_action_just_pressed("shot_accept", true): | ||||
| 				if player.get_balls(ball_type) != 0: | ||||
| 					# Check that player has enough of the selected ball (<0 means unlimited) | ||||
| 					phase = Phase.POWER_ADJUST | ||||
| 				# TODO play UI bonk if player doesn't have balls (lmao) | ||||
| 		Phase.POWER_ADJUST: | ||||
| 			if Input.is_action_just_pressed("shot_accept"): | ||||
| 			if Input.is_action_just_pressed("shot_accept", true): | ||||
| 				# TODO set power gauge parameters if needed | ||||
| 				character.start_upswing() | ||||
| 				hud.start_power_bar() | ||||
| 			if Input.is_action_just_pressed("shot_cancel"): | ||||
| 			if Input.is_action_just_pressed("shot_cancel", true): | ||||
| 				hud.reset_power_bar() | ||||
| 				phase = Phase.AIM | ||||
| 			if Input.is_action_just_released("shot_accept") and shot_power > 0: | ||||
| 			if Input.is_action_just_released("shot_accept", true) and shot_power > 0: | ||||
| 				hud.stop_power_bar() | ||||
| 				phase = Phase.CURVE_ADJUST | ||||
| 		Phase.CURVE_ADJUST: | ||||
| 			if Input.is_action_just_pressed("shot_cancel"): | ||||
| 			if Input.is_action_just_pressed("shot_cancel", true): | ||||
| 				hud.reset_curve_bar() | ||||
| 				phase = Phase.POWER_ADJUST | ||||
| 			if Input.is_action_just_pressed("shot_accept"): | ||||
| 			if Input.is_action_just_pressed("shot_accept", true): | ||||
| 				hud.stop_curve_bar() | ||||
| 				phase = Phase.DOWNSWING | ||||
| 		Phase.SHOT: | ||||
| 			if reset_enabled and Input.is_action_just_pressed("shot_reset"): | ||||
| 			if reset_enabled and Input.is_action_just_pressed("shot_reset", true): | ||||
| 				phase = Phase.SHOT_RESET | ||||
| 				reset_enabled = false | ||||
| 				return_ball() | ||||
| 
 | ||||
| 			if Input.is_action_just_pressed("activate_ball"): | ||||
| 			if Input.is_action_just_pressed("activate_ball", true): | ||||
| 				game_ball.activate_ability() | ||||
| 
 | ||||
| 			if driving_range and Input.is_action_just_pressed("shot_accept"): | ||||
| 			if driving_range and Input.is_action_just_pressed("shot_accept", true): | ||||
| 				phase = Phase.AIM | ||||
| 				return_ball() | ||||
| 		Phase.FINISHED: | ||||
|  | ||||
| @ -42,7 +42,7 @@ func _physics_process(_delta: float) -> void: | ||||
| 	var direction := (transform.basis * Vector3(xz_input.x, y_input.y, xz_input.y)).normalized() | ||||
| 
 | ||||
| 	var speed := Game.settings.free_camera_speed | ||||
| 	if Input.is_action_pressed("camera_sprint"): | ||||
| 	if Input.is_action_pressed("camera_sprint", true): | ||||
| 		speed *= SPRINT_MULT | ||||
| 
 | ||||
| 	if direction: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user