Godot Version
4.6.1.stable
Question
Hey guys, so I’m trying to make a minigame for my mobile pet sim game where you have to clean your pet by swiping on its dirty areas to clean them, gradually making the filth disappear by decrementing the alpha value of the modulate.
However, for some reason, the game detects my input and successfully goes down the code path that activates the bubble emitter and which SHOULD turn my scrubbing variable to true, however this never happens. On computer, it works just fine and sets the value as it should, but in the mobile export, the variable somehow doesn’t get set.
extends Area2D
var has_mouse := false
var scrubbing := false
signal finished
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
randomize_filth()
# Set a random filth texture to be applied
func randomize_filth()->void:
$Sprite2D.texture.region.position = Vector2(randi_range(0,4)*16,0)
func _input(event: InputEvent) -> void:
if has_mouse:
if event is InputEventMouseMotion:
$"../../Bubbles".emitting = true
scrubbing = true
else:
scrubbing = false
func _on_mouse_entered() -> void:
has_mouse = true
func _on_mouse_exited() -> void:
$"../../Bubbles".emitting = false
has_mouse = false
func _process(delta: float) -> void:
if scrubbing:
modulate.a -= .8*delta
modulate.a = clamp(modulate.a,0,1)
if modulate.a == 0:
finished.emit()
queue_free()
scrubbing = false