Lesson 3
This commit is contained in:
20
BaloonPopper/Balloon.tscn
Normal file
20
BaloonPopper/Balloon.tscn
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://dx4fsec1do8jf"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://c30ldumgb7qiu" path="res://BaloonPopper/Balloon.gd" id="1_kf32r"]
|
||||||
|
[ext_resource type="Material" uid="uid://bdq28mtbdbb0n" path="res://BaloonPopper/Balloon.tres" id="2_c7wbr"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id="SphereMesh_7wxj3"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_x0uas"]
|
||||||
|
|
||||||
|
[node name="Balloon" type="Area3D"]
|
||||||
|
script = ExtResource("1_kf32r")
|
||||||
|
|
||||||
|
[node name="Model" type="MeshInstance3D" parent="."]
|
||||||
|
material_override = ExtResource("2_c7wbr")
|
||||||
|
mesh = SubResource("SphereMesh_7wxj3")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
shape = SubResource("SphereShape3D_x0uas")
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
@@ -1,23 +1,12 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://2ods25xi0dka"]
|
[gd_scene load_steps=3 format=3 uid="uid://2ods25xi0dka"]
|
||||||
|
|
||||||
[ext_resource type="Material" uid="uid://bdq28mtbdbb0n" path="res://BaloonPopper/Balloon.tres" id="1_5iqhe"]
|
[ext_resource type="Script" uid="uid://cr25cj1q88j1m" path="res://BaloonPopper/BaloonManager.gd" id="1_degi4"]
|
||||||
[ext_resource type="Script" uid="uid://c30ldumgb7qiu" path="res://BaloonPopper/balloon.gd" id="1_f5668"]
|
[ext_resource type="PackedScene" uid="uid://dx4fsec1do8jf" path="res://BaloonPopper/Balloon.tscn" id="2_f5668"]
|
||||||
|
|
||||||
[sub_resource type="SphereMesh" id="SphereMesh_7wxj3"]
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_x0uas"]
|
|
||||||
|
|
||||||
[node name="Main" type="Node3D"]
|
[node name="Main" type="Node3D"]
|
||||||
|
script = ExtResource("1_degi4")
|
||||||
|
|
||||||
[node name="Balloon" type="Area3D" parent="."]
|
[node name="Balloon" parent="." instance=ExtResource("2_f5668")]
|
||||||
script = ExtResource("1_f5668")
|
|
||||||
|
|
||||||
[node name="Model" type="MeshInstance3D" parent="Balloon"]
|
|
||||||
material_override = ExtResource("1_5iqhe")
|
|
||||||
mesh = SubResource("SphereMesh_7wxj3")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Balloon"]
|
|
||||||
shape = SubResource("SphereShape3D_x0uas")
|
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4)
|
||||||
@@ -26,4 +15,14 @@ current = true
|
|||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 2, 3)
|
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 2, 3)
|
||||||
|
|
||||||
[connection signal="input_event" from="Balloon" to="Balloon" method="_on_input_event"]
|
[node name="Balloon2" parent="." instance=ExtResource("2_f5668")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.94194, 1.15659, 0)
|
||||||
|
|
||||||
|
[node name="Balloon3" parent="." instance=ExtResource("2_f5668")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.14232, 0)
|
||||||
|
|
||||||
|
[node name="Balloon4" parent="." instance=ExtResource("2_f5668")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.8991, 0, 0)
|
||||||
|
|
||||||
|
[node name="Balloon5" parent="." instance=ExtResource("2_f5668")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.92766, 0, 0)
|
||||||
|
|||||||
7
BaloonPopper/BaloonManager.gd
Normal file
7
BaloonPopper/BaloonManager.gd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
var score : int = 0
|
||||||
|
|
||||||
|
func increase_score (amount):
|
||||||
|
score += amount
|
||||||
|
print(score)
|
||||||
1
BaloonPopper/BaloonManager.gd.uid
Normal file
1
BaloonPopper/BaloonManager.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cr25cj1q88j1m
|
||||||
@@ -8,3 +8,9 @@ var score_to_give : int = 1
|
|||||||
func _on_input_event(camera, event, event_position, normal, shape_idx):
|
func _on_input_event(camera, event, event_position, normal, shape_idx):
|
||||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed :
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed :
|
||||||
print ("Increase Balloon Size")
|
print ("Increase Balloon Size")
|
||||||
|
scale += Vector3.ONE * size_increase
|
||||||
|
clicks_to_pop -= 1
|
||||||
|
|
||||||
|
if clicks_to_pop == 0:
|
||||||
|
get_node("/root/Main").increase_score(score_to_give)
|
||||||
|
queue_free()
|
||||||
|
|||||||
Reference in New Issue
Block a user