Godot Version
4.2.1
Question
Hey, im making a cat raising game, where there is a mechanic of “patting” the cat to increase “Bonding points” over time. The player has to tap/pat on the cat, to increase the value of a progress bad. It is basically a Quick time event like system where the taps have to be timed correctly based on a moving QTE bar on top, much like the fishing system in Dredge.
The issue is that, during development and testing i had set up a simple left click input action and ti worked. But now im trying to implement it for touch response , since the game is intended for mobile, it wont work. I have also set up most of the UI control nodes in the scene to mouse flag ignore , since i heard that might also not let your inputs pass onto the sprite. The cat sprite has a area2d setup with pickable on. And im connecting the area2d interaction through :
” func _on_patpat_area_input_event(viewport, event, shape_idx):
if event is InputEventScreenTouch and event.pressed:
print(“Touched”) “
I have attached the full code below, and also a screenshot of the tree in case that have some issue with this.
Thanks for your time ![]()
If you share code, please wrap it inside three backticks or replace the code in the next block:
extends Node2D
@onready var name_label = $"../../parlor-top/Panel/NameLabel"
@onready var main_cat_player = $"."
@onready var pat_qte = $"../../Qte-UI/pat_QTE"
@onready var tails = $Tails
@onready var bodies = $Bodies
@onready var eyes = $Eyes
@onready var patterns = $Patterns
@onready var ears = $Ears
var sprites = [ tails , bodies , eyes , patterns , ears ]
var curr_meta
func _ready():
setup_player_cat()
func setup_player_cat():
curr_meta = CatCustomization.curr_cat_meta
tails.play(curr_meta["tail"])
bodies.play(curr_meta["body"])
eyes.play(curr_meta["eye"])
ears.play(curr_meta["ear"])
patterns.play(curr_meta["pattern"])
bodies.self_modulate = curr_meta["body_c"]
tails.self_modulate = curr_meta["tail_c"]
eyes.self_modulate = curr_meta["eye_c"]
patterns.self_modulate = curr_meta["pattern_c"]
ears.self_modulate = curr_meta["ear_c"]
name_label.text = curr_meta["name"]
func handle_anime():
pass
func _on_patpat_area_input_event(viewport, event, shape_idx):
if event is InputEventScreenTouch and event.pressed:
print("Touched")
pat_qte.call("check_if_land_on_paw")
if event is InputEventMouseButton and event.pressed:
print("Clicked")
pat_qte.call("check_if_land_on_paw")
# the land on paw function is in the QTE_bar scene :
func check_if_land_on_paw():
false_paws = 0
scroll_bar.scale.y = 1.2
revert_timer.start()
for i in spawned_paws:
if i.local_paw == true:
i.change_ui()
#print("Hit a paw : ") # add pat pat score
tamebar.value += 2
else:
false_paws +=1
if false_paws == 3:
#print("oops") # subtract pat pat score
tamebar.value -= 1
