#How to make a speed up powerup?

1 messages · Page 1 of 1 (latest)

jagged quest
#

I want to make a function inside the player script that will alter the players speed when you touch the powerup, I managed to make something on my own but its not working and its not giving any errors.

hot cedar
#

Do an on collide with the power up and change the speed variable

#

What node type is the power up

jagged quest
jagged quest
olive heath
#

it looks like your powerup is a Node2D with an Area2D attached to it; the player's area won't emit on_body_entered because neither of those types are a physics body (like StaticBody2D or CharacterBody2D)

#

you can use on_area_entered instead

func _on_area_entered(area: Area2D) -> void:
  if area.get_parent().has_method("get_fast"):
  ...
#

you have to connect the proper signal though