forked from funnymemellama/funnymemellama
Button and stuff
Added button Moved kreb and light into devscene NOTE: It looks like godot saves positions mid animation and also saves the pan location on the shader editor so basically looking at either of these things then saving the game will cause a change. Not really important but slightly annoying to see them pop up in git for no real reason
This commit is contained in:
parent
1a96b2ac58
commit
f2094c8ae7
7 changed files with 167 additions and 15 deletions
75
Button.gd
Normal file
75
Button.gd
Normal file
|
@ -0,0 +1,75 @@
|
|||
extends StaticBody3D
|
||||
|
||||
signal triggered(by_what: Node3D)
|
||||
|
||||
|
||||
@export_category('Button')
|
||||
@export
|
||||
var momentary: bool = false
|
||||
|
||||
@export_subgroup('Material')
|
||||
@export
|
||||
var released_material: StandardMaterial3D = null
|
||||
@export
|
||||
var pressed_material: StandardMaterial3D = null
|
||||
|
||||
# NOTE: These functions need to use the $ notation instead of the @onready sound
|
||||
# because it seems like the editor calls these before @onready fires.
|
||||
# Not sure why this doesnt work...
|
||||
@export_subgroup('Sound')
|
||||
@export
|
||||
var sound: AudioStream = null :
|
||||
get:
|
||||
return $AudioStreamPlayer3D.stream
|
||||
set(value):
|
||||
$AudioStreamPlayer3D.stream = value
|
||||
|
||||
@export_range(-80, 80, 1, "suffix:dB")
|
||||
var volume = 0.0 :
|
||||
get:
|
||||
return $AudioStreamPlayer3D.volume_db
|
||||
set(value):
|
||||
$AudioStreamPlayer3D.volume_db = value
|
||||
|
||||
|
||||
@onready
|
||||
var _anim = $AnimationPlayer
|
||||
@onready
|
||||
var _button = $CSGMesh3D
|
||||
@onready
|
||||
var _sound = $AudioStreamPlayer3D
|
||||
|
||||
|
||||
var _triggered = false
|
||||
var _resetting = false
|
||||
|
||||
|
||||
func _ready():
|
||||
_anim.animation_finished.connect(_on_anim_finished)
|
||||
triggered.connect(test)
|
||||
|
||||
func test(other):
|
||||
print('Button triggered by ', other)
|
||||
|
||||
|
||||
func interact(other):
|
||||
if _triggered:
|
||||
return
|
||||
_triggered = true
|
||||
|
||||
triggered.emit(other)
|
||||
_sound.play()
|
||||
_anim.play('trigger')
|
||||
_button.material = pressed_material
|
||||
|
||||
|
||||
func _on_anim_finished(name):
|
||||
if _resetting:
|
||||
_button.material = released_material
|
||||
_resetting = false
|
||||
_triggered = false
|
||||
|
||||
if momentary and _triggered:
|
||||
_anim.play_backwards('trigger')
|
||||
_resetting = true
|
||||
|
62
Button.tscn
Normal file
62
Button.tscn
Normal file
|
@ -0,0 +1,62 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://ce7nfed54mwps"]
|
||||
|
||||
[ext_resource type="Script" path="res://Button.gd" id="1_3i6hf"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_ft4xr"]
|
||||
size = Vector3(0.5, 0.3, 0.1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_r4q7f"]
|
||||
albedo_color = Color(1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_6r330"]
|
||||
size = Vector3(0.5, 0.3, 0.1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mhyv4"]
|
||||
resource_name = "trigger"
|
||||
length = 0.5
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("CSGMesh3D:position:z")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0.05, -0.25, 0, 0, -0.025, 0.025, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("CSGMesh3D:scale:z")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(1, -0.25, 0, 0, -0.5, 0.5, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_25oyh"]
|
||||
_data = {
|
||||
"trigger": SubResource("Animation_mhyv4")
|
||||
}
|
||||
|
||||
[node name="Button" type="StaticBody3D"]
|
||||
script = ExtResource("1_3i6hf")
|
||||
|
||||
[node name="CSGMesh3D" type="CSGMesh3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.05)
|
||||
mesh = SubResource("BoxMesh_ft4xr")
|
||||
material = SubResource("StandardMaterial3D_r4q7f")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.0497138)
|
||||
shape = SubResource("BoxShape3D_6r330")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_25oyh")
|
||||
}
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
|
@ -33,7 +33,7 @@ size = Vector3(1, 1.5, 1)
|
|||
script = ExtResource("1_omu2m")
|
||||
|
||||
[node name="Koob" type="CSGMesh3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1606, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.20345, 0)
|
||||
mesh = SubResource("BoxMesh_sbsxh")
|
||||
material = SubResource("StandardMaterial3D_8bjqg")
|
||||
|
||||
|
|
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 15470ad69c0f04aa350d3a87e6e050a76d4c4cf3
|
||||
Subproject commit d8582bc4f90dc3db654dc4c2b462d8b33ede3dd0
|
|
@ -98,7 +98,6 @@ void fragment() {
|
|||
|
||||
}
|
||||
"
|
||||
graph_offset = Vector2(-588.944, 111.566)
|
||||
modes/cull = 2
|
||||
nodes/fragment/0/position = Vector2(800, 100)
|
||||
nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_o5oup")
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bp1fooevcl4lk"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bp1fooevcl4lk"]
|
||||
|
||||
[ext_resource type="ArrayMesh" uid="uid://cfm21e1rmsbvt" path="res://assets/maps/devworld.obj" id="1_67d5q"]
|
||||
[ext_resource type="PackedScene" uid="uid://wl1n3y8mcq0x" path="res://Commentary.tscn" id="2_3gk04"]
|
||||
[ext_resource type="AudioStream" uid="uid://d100ilqihkimr" path="res://whatareyouwatchingbro.mp3" id="3_qy4vp"]
|
||||
[ext_resource type="AudioStream" uid="uid://7s6wb487kv2d" path="res://bomb-has-been-defused-csgo-sound-effect.mp3" id="3_sy6mw"]
|
||||
[ext_resource type="PackedScene" uid="uid://ce7nfed54mwps" path="res://Button.tscn" id="5_57sxr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cp4rwojl3c3y3" path="res://test.tscn" id="6_8wwor"]
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_fwixm"]
|
||||
data = PackedVector3Array(-504, -64, 256, -504, -64, 128, -504, -192, 128, -504, -192, 256, -504, -64, 256, -504, -192, 128, -504, -64, 256, -512, -64, 256, -512, -64, 128, -504, -64, 128, -504, -64, 256, -512, -64, 128, -504, -64, 256, -504, -192, 256, -512, -192, 256, -512, -64, 256, -504, -64, 256, -512, -192, 256, -504, -64, 128, -512, -64, 128, -512, -192, 128, -504, -192, 128, -504, -64, 128, -512, -192, 128, -504, -192, 256, -504, -192, 128, -512, -192, 128, -512, -192, 256, -504, -192, 256, -512, -192, 128, -512, -64, 256, -512, -192, 256, -512, -192, 128, -512, -64, 128, -512, -64, 256, -512, -192, 128, -128, 64, 8, -128, 64, 0, -128, -320, 0, -128, -320, 8, -128, 64, 8, -128, -320, 0, -128, 64, 8, -512, 64, 8, -512, 64, 0, -128, 64, 0, -128, 64, 8, -512, 64, 0, -128, 64, 8, -128, -320, 8, -512, -320, 8, -512, 64, 8, -128, 64, 8, -512, -320, 8, -128, 64, 0, -512, 64, 0, -512, -320, 0, -128, -320, 0, -128, 64, 0, -512, -320, 0, -128, -320, 8, -128, -320, 0, -512, -320, 0, -512, -320, 8, -128, -320, 8, -512, -320, 0, -512, 64, 8, -512, -320, 8, -512, -320, 0, -512, 64, 0, -512, 64, 8, -512, -320, 0, -512, 64, 392, -512, 64, 8, -512, -320, 8, -512, -320, 392, -512, 64, 392, -512, -320, 8, -512, 64, 392, -520, 64, 392, -520, 64, 8, -512, 64, 8, -512, 64, 392, -520, 64, 8, -512, 64, 392, -512, -320, 392, -520, -320, 392, -520, 64, 392, -512, 64, 392, -520, -320, 392, -512, 64, 8, -520, 64, 8, -520, -320, 8, -512, -320, 8, -512, 64, 8, -520, -320, 8, -520, 64, 392, -520, -320, 392, -520, -320, 8, -520, 64, 8, -520, 64, 392, -520, -320, 8, -512, -320, 392, -512, -320, 8, -520, -320, 8, -520, -320, 392, -512, -320, 392, -520, -320, 8, 512, 1024, 416, 512, 1024, 96, 512, 1016, 96, 512, 1016, 416, 512, 1024, 416, 512, 1016, 96, 512, 1016, 96, 512, 1024, 96, 512, 1016, 0, 512, 1024, 96, 512, 1024, 0, 512, 1016, 0, -512, 1024, 96, 512, 1024, 96, 512, 1024, 416, 512, 1024, 96, 16, 1024, 96, 16, 1024, 0, 512, 1024, 96, 16, 1024, 0, 512, 1024, 0, -512, 1024, 96, 512, 1024, 416, -512, 1024, 416, -32, 1024, 96, -512, 1024, 96, -512, 1024, 0, -32, 1024, 96, -512, 1024, 0, -32, 1024, 0, 512, 1024, 96, 512, 1016, 96, 16, 1016, 96, 16, 1024, 96, 512, 1024, 96, 16, 1016, 96, 512, 1024, 0, 16, 1024, 0, 16, 1016, 0, 512, 1016, 0, 512, 1024, 0, 16, 1016, 0, 512, 1016, 416, 512, 1016, 96, -512, 1016, 96, 512, 1016, 96, 512, 1016, 0, 16, 1016, 0, 512, 1016, 96, 16, 1016, 0, 16, 1016, 96, 512, 1016, 416, -512, 1016, 96, -512, 1016, 416, -512, 1016, 0, -512, 1016, 96, -32, 1016, 96, -512, 1016, 0, -32, 1016, 96, -32, 1016, 0, 16, 1024, 96, 16, 1016, 96, 16, 1016, 0, 16, 1024, 0, 16, 1024, 96, 16, 1016, 0, -32, 1024, 96, -32, 1024, 0, -32, 1016, 0, -32, 1016, 96, -32, 1024, 96, -32, 1016, 0, 512, 1024, 416, 512, 1016, 416, -512, 1016, 416, -512, 1024, 416, 512, 1024, 416, -512, 1016, 416, -32, 1024, 96, -32, 1016, 96, -512, 1016, 96, -512, 1024, 96, -32, 1024, 96, -512, 1016, 96, 512, 1024, 96, -512, 1024, 96, -512, 1016, 96, 512, 1016, 96, 512, 1024, 96, -512, 1016, 96, -512, 1024, 416, -512, 1016, 416, -512, 1016, 96, -512, 1024, 96, -512, 1024, 416, -512, 1016, 96, -512, 1024, 96, -512, 1016, 96, -512, 1016, 0, -512, 1024, 0, -512, 1024, 96, -512, 1016, 0, -32, 1024, 0, -512, 1024, 0, -512, 1016, 0, -32, 1016, 0, -32, 1024, 0, -512, 1016, 0, 1024, 1024, 0, 1024, 1024, -64, 1024, -1024, -64, 1024, -1024, 0, 1024, 1024, 0, 1024, -1024, -64, 1024, 1024, 0, -1024, 1024, 0, -1024, 1024, -64, 1024, 1024, -64, 1024, 1024, 0, -1024, 1024, -64, 1024, 1024, 0, 1024, -1024, 0, -1024, -1024, 0, -1024, 1024, 0, 1024, 1024, 0, -1024, -1024, 0, 1024, 1024, -64, -1024, 1024, -64, -1024, -1024, -64, 1024, -1024, -64, 1024, 1024, -64, -1024, -1024, -64, 1024, -1024, 0, 1024, -1024, -64, -1024, -1024, -64, -1024, -1024, 0, 1024, -1024, 0, -1024, -1024, -64, -1024, 1024, 0, -1024, -1024, 0, -1024, -1024, -64, -1024, 1024, -64, -1024, 1024, 0, -1024, -1024, -64)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pr3ys"]
|
||||
albedo_color = Color(1, 0, 0, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tselo"]
|
||||
albedo_color = Color(0, 1, 0, 1)
|
||||
|
||||
[node name="devworld" type="StaticBody3D"]
|
||||
|
||||
[node name="Devworld" type="MeshInstance3D" parent="."]
|
||||
|
@ -29,3 +37,21 @@ low_speed = 2.0
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.06073, -0.25, 3.2)
|
||||
sound = ExtResource("3_qy4vp")
|
||||
volume = -30.0
|
||||
|
||||
[node name="Button" parent="." instance=ExtResource("5_57sxr")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -20.48, 2.15927, 5.76)
|
||||
momentary = true
|
||||
released_material = SubResource("StandardMaterial3D_pr3ys")
|
||||
pressed_material = SubResource("StandardMaterial3D_tselo")
|
||||
sound = ExtResource("3_sy6mw")
|
||||
volume = -10.0
|
||||
|
||||
[node name="CardboardKreb" parent="." instance=ExtResource("6_8wwor")]
|
||||
transform = Transform3D(1.79237, 0, 2.4057, 0, 3, 0, -2.4057, 0, 1.79237, -9.69573, 0.32, -0.222977)
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="."]
|
||||
transform = Transform3D(0.356027, -0.671061, 0.650325, 0.115038, 0.722105, 0.682151, -0.927368, -0.168052, 0.334286, -7.26707, 3.85234, 1.00559)
|
||||
light_color = Color(1, 0, 1, 1)
|
||||
light_energy = 16.0
|
||||
spot_range = 7.86984
|
||||
spot_angle = 35.8279
|
||||
|
|
12
world.tscn
12
world.tscn
|
@ -30,9 +30,6 @@ light_energy = 16.0
|
|||
light_size = 400.0
|
||||
omni_range = 99.7884
|
||||
|
||||
[node name="CardboardKreb" parent="." instance=ExtResource("3_wlkcu")]
|
||||
transform = Transform3D(1.79237, 0, 2.4057, 0, 3, 0, -2.4057, 0, 1.79237, -9.69573, 0.32, -0.222977)
|
||||
|
||||
[node name="Mapentities" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.039, 0, 0, 0, -1.70474e-09, 0.039, 0, -0.039, -1.70474e-09, 0, 0, 0)
|
||||
mesh = ExtResource("5_wn745")
|
||||
|
@ -40,14 +37,7 @@ mesh = ExtResource("5_wn745")
|
|||
[node name="CardboardKreb2" parent="." instance=ExtResource("3_wlkcu")]
|
||||
transform = Transform3D(-1.74846e-07, 0, 4, 0, 4, 0, -4, 0, -1.74846e-07, -100.286, 5.12, -18.5951)
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="."]
|
||||
transform = Transform3D(0.356027, -0.671061, 0.650325, 0.115038, 0.722105, 0.682151, -0.927368, -0.168052, 0.334286, -7.26707, 3.85234, 1.00559)
|
||||
light_color = Color(1, 0, 1, 1)
|
||||
light_energy = 16.0
|
||||
spot_range = 7.86984
|
||||
spot_angle = 35.8279
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
[node name="KeyOverlay" type="Label" parent="."]
|
||||
offset_left = 21.0
|
||||
offset_top = 2.0
|
||||
offset_right = 214.0
|
||||
|
|
Loading…
Reference in a new issue