added coin spawner
This commit is contained in:
17
Scripts/coin_spawner.gd
Normal file
17
Scripts/coin_spawner.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Node3D
|
||||
|
||||
const GOLDCOIN = preload("res://Prefabs/goldcoin.tscn")
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
var instance_coin = GOLDCOIN.instantiate()
|
||||
var av_x = randf_range(-10,10)
|
||||
var av_y = randf_range(-10,10)
|
||||
var av_z = randf_range(-10,10)
|
||||
|
||||
instance_coin.global_basis = global_basis
|
||||
instance_coin.global_position = global_position
|
||||
instance_coin.angular_velocity = Vector3(av_x,av_y,av_z)
|
||||
get_tree().current_scene.add_child(instance_coin)
|
||||
1
Scripts/coin_spawner.gd.uid
Normal file
1
Scripts/coin_spawner.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bn2u3tc7cwlhc
|
||||
Reference in New Issue
Block a user