add dropoff point

This commit is contained in:
mightypanders 2021-06-12 02:05:05 +02:00
parent 87b72d6131
commit 99388bd9ad
2 changed files with 55 additions and 0 deletions

36
DropOffPoint.gd Normal file
View File

@ -0,0 +1,36 @@
extends Node2D
export var entity_name = "DROPOFF"
export var destinationColor = Color.yellow
var rng = RandomNumberGenerator.new()
onready var sprite = $Sprite
var colorList = [
Color.yellow,
Color.violet,
Color.red,
Color.turquoise,
Color.orange
]
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
rng.randomize()
var n = rng.randi_range(0,4)
print(n)
destinationColor = colorList[n]
print(destinationColor)
sprite.modulate = destinationColor
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

19
DropOffPoint.tscn Normal file
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/placeholder_white.png" type="Texture" id=1]
[ext_resource path="res://DropOffPoint.gd" type="Script" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 25.16
[node name="DropOffPoint" type="Node2D"]
script = ExtResource( 2 )
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
rotation = 0.785398
texture = ExtResource( 1 )