0 votes

I'm trying to make spikes that every time that you touch them they take away some points but right now it just does it really fast and that's not what I want

Heres my code:
extends Area2D

func physicsprocess(delta):
var boide = getoverlappingbodies()
for body in boide:
if body.name == "Player":
global.Coins -= global.Takeaway
if global.Coins < 0:
get
tree().change_scene("res://Scenes/Death screen.tscn")

in Engine by (27 points)
edited by

1 Answer

0 votes

I Figured it out:
extends Area2D

onready var timer = get_node("Timer")

func onArea2Dbodyentered(body):
if body.name == "Player":
timer.start()
pass # Replace with function body.

func onTimertimeout():
global.Coins -= global.Take
away
pass

by (27 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.