teststrecke-game/scripts/car_node.gd

19 lines
398 B
GDScript3
Raw Normal View History

2024-11-03 18:16:30 +00:00
extends Node2D
@onready var car: CharacterBody2D = $Car
2024-11-04 18:55:13 +00:00
@onready var carbody: Sprite2D = $Car/sprite_body
2024-11-03 18:16:30 +00:00
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
2024-11-04 18:55:13 +00:00
carbody.modulate = playercolor#Color(0, 0, 1)