Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | halcyon |
I’m very new to the engine and encountered something that I don’t think is normal. I did this very small bit of code.
var activationKeyReleased : bool = false
func _physics_process(delta):
fall_down(delta)
func fall_down(delta):
if activationKeyReleased == true:
self.rotation_degrees += 70 * delta
if self.rotation_degrees >=90:
activationKeyReleased = false
print(self.rotation_degrees)
func _input(ev):
if Input.is_key_pressed(KEY_SPACE) and ev.echo == true:
self.scale.y += 0.15
elif ev.is_action_released("ACTIVATEINCREASE"):
activationKeyReleased = true
I get the message in the debugger "Invalid get index ‘echo’ (on base: ‘InputEventMouseMotion’)
Sometimes it works and sometimes it doesn’t when I run the code. When I exported it, it worked fine everytime thought. Maybe its to do with mouse movement but I don’t know why.
I fixed it, figured out _input(ev) detects all inputs which include mouse movement, so if I’m holding space and moving the mouse thats new input and mouse movement is not .echo I don’t think.
func _input(ev):
if Input.is_key_pressed(KEY_SPACE) and ev is InputEventKey:
if ev.echo == true:
self.scale.y += 0.15