0 votes

Someone help

onready var player = $"../player"
var _player = false

func _ready():
pass

func physicsprocess(delta):
if player == true:
var dir = (player.global
position - globalposition).normalized()
move
andcollide(dir * runspeed * delta)

func onAreadoperigobodyentered(body):
if body.name == "player":
_player = true

func onAreadoperigobodyexited(body):
if body.name == "player":
_player = false

func onSimareaentered(area):
vida = vida - dano
emit_signal("tomardano")

Godot version v3
in Engine by (20 points)

I'm not sure I know what you mean - could you please elaborate on your issue, and update the question. This will make it more likely for your question to be answered.

Snail is totally right, please: if you have questions then tell us something about what's (not) happening so that we can help you better. Questions without the essential details will very often never get answered.

That said, I can see from your code the issue that you're probably having.

func _physics_process(delta):
    if player == true:

var player is missing an underscore here.
If you need your if statement to be affected by the variable _player then it should be:

func _physics_process(delta):
    if _player == true:

Is that correct?

I'm sorry for borrowing your time but i just fixed my problem thank you anyway!

That's good to hear, however you should create an answer (also select it as the best answer) explaining what you did to solve this problem, so that other people can solve this problem too.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.