This commit is contained in:
Merlar 2019-11-24 14:47:40 +00:00
commit 3a4529e85e
18 changed files with 3821 additions and 71 deletions

View File

@ -3,8 +3,13 @@ extends KinematicBody
export(NodePath) var player_path
export(float) var speed
onready var growl_sound = get_node("GrowlSound")
onready var confuse_sound = get_node("ConfuseSound")
onready var see_sound = get_node("SeeSound")
var _current_nav_path: PoolVector3Array
var _player
var _had_path_in_previous_frame = false
onready var _navigation = get_parent()
@ -13,6 +18,14 @@ func _ready():
_player = get_node(player_path)
func _physics_process(delta: float) -> void:
# Play growling sound at random interval
var distance_to_player = (_player.transform.origin - transform.origin).length()
if randi() % 1000 == 1 and not _is_any_sound_playing():
growl_sound.play()
func _process(delta):
var to = _navigation.get_closest_point(_player.transform.origin)
_current_nav_path = _navigation.get_simple_path(transform.origin, to)
@ -20,14 +33,27 @@ func _process(delta):
var dir: Vector3
if _current_nav_path.size() > 0:
if not _had_path_in_previous_frame and not _is_any_sound_playing():
see_sound.play()
var index = 0
if (_current_nav_path[0] - transform.origin).length() < 0.1: index = 1
dir = (_current_nav_path[index] - transform.origin).normalized()
_had_path_in_previous_frame = true
else:
if _had_path_in_previous_frame and not _is_any_sound_playing():
confuse_sound.play()
dir = (_player.transform.origin - transform.origin).normalized()
_had_path_in_previous_frame = false
if (dir.x != 0.0 and dir.z != 0.0):
look_at(transform.origin + Vector3(dir.x, 0.0, dir.z), Vector3.UP)
move_and_slide(dir * speed)
func _is_any_sound_playing():
return growl_sound.playing or confuse_sound.playing or see_sound.playing

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Level/Objects/Crystal.gd" type="Script" id=1]
[ext_resource path="res://Models/Material.material" type="Material" id=2]
@ -32,8 +32,25 @@ emission_energy = 0.2
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="Animation" id=4]
resource_name = "Rotate"
length = 4.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1, 2, 3, 4 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 90, 0, 0 ), Vector3( 90, 90, 0 ), Vector3( 90, 180, 0 ), Vector3( 90, 270, 0 ), Vector3( 90, 360, 0 ) ]
}
[node name="Crystal" type="Spatial"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 2, 0 )
transform = Transform( -0.615359, 0.788247, -3.44554e-08, 0, -4.37114e-08, -1, -0.788247, -0.615359, 2.68982e-08, 0, 2, 0 )
script = ExtResource( 1 )
[node name="Area" type="Area" parent="." groups=[
@ -47,3 +64,8 @@ shape = SubResource( 2 )
transform = Transform( 0.169835, 0.0974797, 0.0406649, -0.061109, 0.0278815, 0.188383, 0.0861488, -0.172396, 0.0534608, 0.20461, 0.0198549, 0.709478 )
mesh = SubResource( 1 )
material/0 = SubResource( 3 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Rotate"
playback_speed = 0.5
anims/Rotate = SubResource( 4 )

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
WikiJam/Models/WallGate.glb Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -88,10 +88,11 @@ stream = ExtResource( 5 )
[node name="CollectSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
volume_db = -20.0
[node name="InteractArea" type="Area" parent="."]
gravity = 0.0
[node name="CollisionShape" type="CollisionShape" parent="InteractArea"]
transform = Transform( 1, 0, 0, 0, -4.37114e-008, -1, 0, 1, -4.37114e-008, 0, 2, 0 )
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 2, 0 )
shape = SubResource( 3 )

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/dino-roar-01.wav-7fa350978a52d71549e669c356502e2a.sample"
[deps]
source_file="res://Sounds/dino-roar-01.wav"
dest_files=[ "res://.import/dino-roar-01.wav-7fa350978a52d71549e669c356502e2a.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
compress/mode=0

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/dino-roar-02.wav-96b26c60e5b27094944f1a870608fe6e.sample"
[deps]
source_file="res://Sounds/dino-roar-02.wav"
dest_files=[ "res://.import/dino-roar-02.wav-96b26c60e5b27094944f1a870608fe6e.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
compress/mode=0

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/dino-roar-03.wav-8ef75c8ff2c4701c8e0659ab73f9b9cc.sample"
[deps]
source_file="res://Sounds/dino-roar-03.wav"
dest_files=[ "res://.import/dino-roar-03.wav-8ef75c8ff2c4701c8e0659ab73f9b9cc.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
compress/mode=0