added coin spawner
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -46,15 +46,14 @@ blend_shape_mode = 0
|
|||||||
shadow_mesh = SubResource("ArrayMesh_hrwv8")
|
shadow_mesh = SubResource("ArrayMesh_hrwv8")
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_2djid"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_2djid"]
|
||||||
margin = 0.001
|
margin = 0.0
|
||||||
radius = 0.124843
|
radius = 0.124843
|
||||||
|
|
||||||
[node name="GOLDCOIN" type="RigidBody3D"]
|
[node name="GOLDCOIN" type="RigidBody3D"]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
mass = 0.1
|
||||||
continuous_cd = true
|
continuous_cd = true
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
linear_damp = 1.0
|
|
||||||
angular_damp = 1.0
|
|
||||||
|
|
||||||
[node name="Cylinder" type="MeshInstance3D" parent="."]
|
[node name="Cylinder" type="MeshInstance3D" parent="."]
|
||||||
material_override = ExtResource("1_2djid")
|
material_override = ExtResource("1_2djid")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://dbqyyunvx6fdj"]
|
[gd_scene load_steps=14 format=3 uid="uid://dbqyyunvx6fdj"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://hmyrn2pbbhpm" path="res://Prefabs/PlayerCamera.tscn" id="2_qq11w"]
|
[ext_resource type="PackedScene" uid="uid://hmyrn2pbbhpm" path="res://Prefabs/PlayerCamera.tscn" id="2_qq11w"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bacgd5lmvaxea" path="res://Prefabs/player.tscn" id="3_hfnh2"]
|
[ext_resource type="PackedScene" uid="uid://bacgd5lmvaxea" path="res://Prefabs/player.tscn" id="3_hfnh2"]
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://lhqrdftu1js3" path="res://Prefabs/Decorations/tombstone.tscn" id="7_uchfh"]
|
[ext_resource type="PackedScene" uid="uid://lhqrdftu1js3" path="res://Prefabs/Decorations/tombstone.tscn" id="7_uchfh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d0u2u3cvfkdlj" path="res://Assets/Models/Test1.blend" id="8_46b76"]
|
[ext_resource type="PackedScene" uid="uid://d0u2u3cvfkdlj" path="res://Assets/Models/Test1.blend" id="8_46b76"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dctwrgdviw2bq" path="res://Prefabs/rat.tscn" id="8_igv2b"]
|
[ext_resource type="PackedScene" uid="uid://dctwrgdviw2bq" path="res://Prefabs/rat.tscn" id="8_igv2b"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://1shngq3vrbu" path="res://coin_spawner.tscn" id="9_46b76"]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_31lxn"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_31lxn"]
|
||||||
sky_top_color = Color(0.1, 0.1, 0.1, 1)
|
sky_top_color = Color(0.1, 0.1, 0.1, 1)
|
||||||
@@ -160,3 +161,6 @@ transform = Transform3D(-0.687493, 0, 0.726191, 0, 1, 0, -0.726191, 0, -0.687493
|
|||||||
transform = Transform3D(0.0790682, 0, 0.996869, 0, 1, 0, -0.996869, 0, 0.0790682, 2.84781, 0.16998, -2.15342)
|
transform = Transform3D(0.0790682, 0, 0.996869, 0, 1, 0, -0.996869, 0, 0.0790682, 2.84781, 0.16998, -2.15342)
|
||||||
|
|
||||||
[node name="Test2" parent="." instance=ExtResource("8_46b76")]
|
[node name="Test2" parent="." instance=ExtResource("8_46b76")]
|
||||||
|
|
||||||
|
[node name="CoinSpawner" parent="." instance=ExtResource("9_46b76")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.81324, 3.94453, 0.757049)
|
||||||
|
|||||||
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
|
||||||
12
coin_spawner.tscn
Normal file
12
coin_spawner.tscn
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://1shngq3vrbu"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bn2u3tc7cwlhc" path="res://Scripts/coin_spawner.gd" id="1_7h776"]
|
||||||
|
|
||||||
|
[node name="CoinSpawner" type="Marker3D"]
|
||||||
|
script = ExtResource("1_7h776")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 0.1
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||||
Reference in New Issue
Block a user