Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JoseDTD |
extends Node2D
# Declare member variables here. Examples:
var points = 0
onready var point_text = $INTERFAZ/Label #variable
func get_axis() -> Vector2:
var axis = Vector2.ZERO
axis.x = int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left"))
return axis
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
point_text.text = "Points: " + str(points)
func _on_Area2D_body_entered(body):
if body.name == "Player":
points += 1
$StaticBody2D5.queue_free()
Edited to fix forum code formatting…
jgodfrey | 2023-05-27 14:02