Skip to content

Commit

Permalink
chore/house-keeping (#58)
Browse files Browse the repository at this point in the history
* Defined chasing speed for blue enemy

* Removed .gdignore file that was not doing anything

* Made adjustments to Goweti

* Made platforms faster

* Stop chasing player when squashed

* Hide exclamation mark when enemy is squashed

Co-authored-by: Telmo Valverde <[email protected]>
  • Loading branch information
telmotrooper and telmotrooper authored May 25, 2022
1 parent 4063aba commit 91adbcf
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
1 change: 0 additions & 1 deletion .gdignore

This file was deleted.

11 changes: 8 additions & 3 deletions entities/enemy/blue_enemy.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends Enemy

export var patrolling_speed = 9

export var chasing_speed = 13
enum {
PATROLLING,
ALERT,
Expand All @@ -28,8 +28,8 @@ func _process(delta):
if get_parent() is PathFollow:
# Reset rotation, otherwise enemy won't be able to chase player.
get_parent().rotation = Vector3.ZERO
if is_instance_valid(GameState.Player):
initiliaze(self.transform.origin, GameState.Player.transform.origin, false)
if is_instance_valid(GameState.Player) and not already_squashed:
initiliaze(self.transform.origin, GameState.Player.transform.origin, false, chasing_speed)

func _on_VisibilityNotifier_screen_exited():
pass # Prevent "queue_free()" from parent.
Expand All @@ -38,6 +38,11 @@ func _on_PrismArea_body_entered(_body):
if state != CHASING:
state = ALERT

func squash():
# When squashed, always hide exclamation mark.
$ExclamationMark.visible = false
.squash()

func _on_AlertTimer_timeout():
$ExclamationMark.visible = false
state = CHASING
Expand Down
2 changes: 1 addition & 1 deletion maps/test_map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ func _on_Player_hit():
GameState.UserInterface.retry()

func _on_RedButton_pressed():
$Goweti/Manual/AnimationPlayer.play("move_platforms")
$Goweti/Manual.move_platforms()
6 changes: 3 additions & 3 deletions maps/test_map.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,6 @@ transform = Transform( 0.625493, 1.00824e-08, 0.230657, 0.230657, -2.73412e-08,
transform = Transform( -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 55.6152, 2.24891, -3.78947 )
direction = 1

[node name="Goweti" parent="." instance=ExtResource( 18 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 60.906, -0.312, -0.581 )

[node name="PortalPlaceholder" parent="." instance=ExtResource( 21 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0670445, 0.144789, -135.074 )
map_name = "mountain_map"
Expand Down Expand Up @@ -378,6 +375,9 @@ patrolling_speed = 18
transform = Transform( 1, 0, 0, 0, 0.969876, 0.243598, 0, -0.243598, 0.969876, 0, 15.2, 45.4 )
far = 200.0

[node name="Goweti" parent="." instance=ExtResource( 18 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 60.906, -0.312, -0.581 )

[connection signal="hit" from="Player" to="." method="_on_Player_hit"]
[connection signal="timeout" from="EnemyTimer" to="." method="_on_EnemyTimer_timeout"]
[connection signal="pressed" from="RedButton" to="." method="_on_RedButton_pressed"]
14 changes: 0 additions & 14 deletions models/goweti/Manual.gd

This file was deleted.

Binary file modified models/goweti/goweti.blend
Binary file not shown.
23 changes: 23 additions & 0 deletions models/goweti/goweti.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
extends Node

# If re-importing from Blender, remember to "Clear inheritance" and make the
# floating platforms of type "KinematicBody". Also, adjust the "move_platforms"
# animation and make "RESET" go to meeting position.

enum { MOVING_CLOSER, MOVING_AWAY }

var direction := MOVING_AWAY

func move_platforms():
_on_FloatingPlatformTimer_timeout()

func _on_AnimationPlayer_animation_finished(anim_name: String):
if anim_name == "move_platforms":
$FloatingPlatformTimer.start()

func _on_FloatingPlatformTimer_timeout():
if direction == MOVING_CLOSER:
$AnimationPlayer.play("move_platforms")
else: # MOVING_AWAY
$AnimationPlayer.play_backwards("move_platforms")
direction = !direction
Binary file modified models/goweti/goweti.glb
Binary file not shown.
31 changes: 15 additions & 16 deletions models/goweti/goweti.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene load_steps=17 format=2]

[ext_resource path="res://models/goweti/Manual.gd" type="Script" id=1]
[ext_resource path="res://models/goweti/goweti.gd" type="Script" id=1]

[sub_resource type="SpatialMaterial" id=1]
resource_name = "Material"
Expand Down Expand Up @@ -113,7 +113,7 @@ data = PoolVector3Array( -5.3, 0.25, -6.9702, 5.3, 0.25, 6.9702, 5.3, 0.25, -6.9
[sub_resource type="Animation" id=14]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("FloatingPlatform:translation")
tracks/0/path = NodePath("../FloatingPlatform:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
Expand All @@ -122,10 +122,10 @@ tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 0, 6.67, -41 ) ]
"values": [ Vector3( 0, 6.67, -32 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("FloatingPlatform001:translation")
tracks/1/path = NodePath("../FloatingPlatform001:translation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
Expand All @@ -134,35 +134,34 @@ tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 0, 6.67, -56 ) ]
"values": [ Vector3( 0, 6.67, -47 ) ]
}

[sub_resource type="Animation" id=15]
resource_name = "move_platforms"
length = 3.5
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("FloatingPlatform:translation")
tracks/0/path = NodePath("../FloatingPlatform:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3.5 ),
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 6.67, -41 ), Vector3( 0, 6.67, -14 ) ]
"values": [ Vector3( 0, 6.67009, -13.991 ), Vector3( 0, 6.67, -32 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("FloatingPlatform001:translation")
tracks/1/path = NodePath("../FloatingPlatform001:translation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 3.5 ),
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 6.67, -56 ), Vector3( 0, 6.67, -83 ) ]
"values": [ Vector3( 0, 6.67009, -66.3179 ), Vector3( 0, 6.67, -47 ) ]
}

[node name="goweti" type="Spatial"]
Expand All @@ -188,7 +187,7 @@ material/0 = null
shape = SubResource( 6 )

[node name="FloatingPlatform" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6.67, -41 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6.67, -32 )
mesh = SubResource( 8 )
material/0 = null

Expand All @@ -208,7 +207,7 @@ material/0 = null
shape = SubResource( 11 )

[node name="FloatingPlatform001" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6.67, -56 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6.67, -47 )
mesh = SubResource( 12 )
material/0 = null

Expand All @@ -221,7 +220,7 @@ shape = SubResource( 13 )
script = ExtResource( 1 )

[node name="AnimationPlayer" type="AnimationPlayer" parent="Manual"]
root_node = NodePath("../..")
root_node = NodePath("../../BaseCube")
autoplay = "RESET"
playback_process_mode = 0
anims/RESET = SubResource( 14 )
Expand Down

0 comments on commit 91adbcf

Please sign in to comment.