add dropoff point
This commit is contained in:
parent
87b72d6131
commit
99388bd9ad
|
@ -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
|
|
@ -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 )
|
Loading…
Reference in New Issue