teststrecke-game/scripts/car_node.gd

18 lines
398 B
GDScript

extends Node2D
@onready var car: CharacterBody2D = $Car
@onready var carbody: Sprite2D = $Car/sprite_body
func getSpeed() -> float:
return car.velocity.length()
func getPosition():
return car.position
func setPosition(p:Vector2):
car.position=p
func setPlayerinformation(playerid, playercolor):
car.playerid=playerid
#TODO set playercolor
carbody.modulate = playercolor#Color(0, 0, 1)