~sforman/Yengapult

a22d9201d2c4faed059dde760ca63486a86c30d9 — Simon Forman 4 years ago f922748
Add directional light; move boop to boulder.

So following proper OOP doctrine I put the "boop" noise audio player node
into the Boulder scene because boulders boop when they are created so
that's obviously the responsibility of the boulder class, eh?  Yet, this
seems less efficient than having one reference to the player in the
toplevel context and playing the noise "externally" as it were (the way
it was before this change.)

Whatever.  On the gripping hand, no machine likely to play this program
will struggle with this, so it's fine.
5 files changed, 19 insertions(+), 9 deletions(-)

A Boulder/Boulder.gd
M Boulder/Boulder.tscn
M Yengapult.gd
M Yengapult.tscn
M default_env.tres
A Boulder/Boulder.gd => Boulder/Boulder.gd +7 -0
@@ 0,0 1,7 @@
extends RigidBody

onready var boop = $BoopSound

func _ready():
	boop.play()


M Boulder/Boulder.tscn => Boulder/Boulder.tscn +7 -1
@@ 1,6 1,8 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Boulder/meteorFull.obj" type="ArrayMesh" id=1]
[ext_resource path="res://Boulder/Boulder.gd" type="Script" id=2]
[ext_resource path="res://SoundEffects/Blop-Mark_DiAngelo-79054334.wav" type="AudioStream" id=3]

[sub_resource type="ConvexPolygonShape" id=1]
points = PoolVector3Array( -5.59792, 2.23085, 0.260751, -5.59671, 2.23036, -0.263552, -5.54536, -2.29536, -0.261147, -5.42102, -2.14134, 0.610498, -5.41762, 2.57798, 0.0851891, -5.11468, 1.15042, -1.79135, -4.35964, -3.87995, -0.0878669, -4.20144, -3.1937, -2.53939, -4.19323, -3.71118, -1.83545, -4.18925, 3.0987, 2.70323, -4.18647, 3.96887, -0.262861, -3.85139, 3.63336, 2.53712, -2.97279, 2.23053, 4.808, -2.97214, 2.23003, -4.80981, -2.94552, -2.29553, 4.76388, -2.94487, -2.29503, -4.76569, -2.6379, -2.68052, -4.66234, -2.62611, 4.6848, -0.0882079, -2.29448, 3.66293, 3.96982, -2.29398, 3.66213, -3.97181, -2.26916, 3.97175, -3.57968, -2.26569, -4.74887, 0.43359, -2.10801, -4.08409, 3.60043, -2.10777, -4.08363, -3.60288, -1.93397, 4.17593, 3.42592, -1.571, -0.914622, 5.32111, -1.53761, 0.81024, 5.208, -1.40212, 4.68923, 2.18892, -1.40196, 4.68869, -2.19153, -1.23172, -4.79544, 2.02177, -1.23158, -4.79489, -2.02439, -1.22, -1.26306, -5.31892, 0.517245, 0.474756, -5.26971, 0.524961, -1.2698, -5.3483, 1.23158, -4.79489, -2.02439, 1.23172, -4.79544, 2.02177, 1.40196, 4.68869, -2.19153, 1.40212, 4.68923, 2.18892, 1.92072, 4.32395, 2.88073, 2.10777, -4.08363, -3.60288, 2.10801, -4.08409, 3.60043, 2.26543, -4.74833, -0.436397, 2.26916, 3.97175, -3.57968, 2.29448, 3.66293, 3.96982, 2.62611, 4.6848, -0.0882079, 2.63905, -2.68167, 4.66153, 2.80926, 2.41559, -4.83114, 2.80988, 2.41612, 4.82933, 2.94487, -2.29503, -4.76569, 2.94552, -2.29553, 4.76388, 2.97214, 2.23003, -4.80981, 2.97279, 2.23053, 4.808, 3.49944, -2.14272, -3.93871, 4.18689, 3.97031, 0.260098, 4.19354, -3.71241, 1.83321, 4.35965, -3.87995, -0.087867, 4.55447, 3.63597, -1.31555, 4.74233, -3.02931, 1.84267, 4.88412, 2.92263, -1.65871, 5.15742, -1.76156, 1.80345, 5.52094, -1.76744, 1.1194, 5.54535, -2.29536, -0.261147, 5.59671, 2.23036, -0.263552, 5.59792, 2.23085, 0.260751 )


@@ 9,6 11,7 @@ points = PoolVector3Array( -5.59792, 2.23085, 0.260751, -5.59671, 2.23036, -0.26
transform = Transform( 0.888337, -0.459192, 0, 0.459192, 0.888337, 0, 0, 0, 1, -10.7821, 10.9966, 0 )
mass = 3.0
continuous_cd = true
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true
}


@@ 21,3 24,6 @@ material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 0.07, 0, 0, 0, 0.07, 0, 0, 0, 0.07, 0, 0, 0 )
shape = SubResource( 1 )

[node name="BoopSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )

M Yengapult.gd => Yengapult.gd +0 -2
@@ 3,7 3,6 @@ extends Spatial
var Boulder = preload("res://Boulder/Boulder.tscn")
var Tower = preload("res://Tower/TowerPile.tscn")
onready var bucket = $Catapult/Arm/bucketMesh
onready var boop = $BoopSound
onready var tower = $TowerPile

export var starting_location = Vector3(58, 0, 0)


@@ 14,7 13,6 @@ func _input(event):
		newball.transform.origin = bucket.global_transform.origin
		add_child(newball)
		newball.set_owner(self)
		boop.play()
	
	elif event.is_action_pressed("ui_reset_tower"):
		tower.queue_free()

M Yengapult.tscn => Yengapult.tscn +5 -5
@@ 1,6 1,5 @@
[gd_scene load_steps=28 format=2]
[gd_scene load_steps=27 format=2]

[ext_resource path="res://SoundEffects/Blop-Mark_DiAngelo-79054334.wav" type="AudioStream" id=1]
[ext_resource path="res://Catapult/Catapult.gd" type="Script" id=2]
[ext_resource path="res://Tower/TowerPile.tscn" type="PackedScene" id=3]
[ext_resource path="res://Catapult/bucket.obj" type="ArrayMesh" id=4]


@@ 87,6 86,10 @@ material/0 = null
visible = false
shape = SubResource( 5 )

[node name="DirectionalLight" type="DirectionalLight" parent="Floor"]
transform = Transform( -0.860042, -0.102837, -0.499753, -0.371271, 0.797993, 0.474726, 0.349979, 0.593828, -0.724488, 0, 0, 0 )
shadow_enabled = true

[node name="Catapult" type="Spatial" parent="."]
script = ExtResource( 2 )
__meta__ = {


@@ 195,6 198,3 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 58, 0, 0 )
transform = Transform( -0.999792, 0, -0.0204012, 0, 1, 0, 0.0204012, 0, -0.999792, 30.4309, 15.7816, -52.3154 )
far = 1000.0
script = ExtResource( 7 )

[node name="BoopSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 1 )

M default_env.tres => default_env.tres +0 -1
@@ 5,7 5,6 @@ sky_top_color = Color( 0.294118, 0.603922, 0.772549, 1 )
ground_bottom_color = Color( 0.085144, 0.234375, 0.142541, 1 )
ground_horizon_color = Color( 0.188235, 0.345098, 0.678431, 1 )
ground_curve = 0.0090125
sun_energy = 64.0

[resource]
background_mode = 2