fix: angle enemy bounce
This commit is contained in:
parent
29489a6565
commit
328abd6b54
@ -2,25 +2,25 @@ extends Actor
|
|||||||
class_name Enemy
|
class_name Enemy
|
||||||
|
|
||||||
func _on_StompDetector_body_entered(body: Node) -> void:
|
func _on_StompDetector_body_entered(body: Node) -> void:
|
||||||
if !body.is_in_group("player"):
|
if !body.is_in_group("player"):
|
||||||
return
|
return
|
||||||
var incoming_vel_vector: Vector2 = body.velocity.normalized()
|
var incoming_vel_vector: Vector2 = body.velocity.normalized()
|
||||||
print(rad2deg(abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation)))))
|
print(rad2deg(abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation)))))
|
||||||
if abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation))) > deg2rad(40):
|
if abs(incoming_vel_vector.angle_to(Vector2.DOWN.rotated(rotation))) > deg2rad(90):
|
||||||
print("too shallow entry")
|
print("too shallow entry")
|
||||||
return
|
return
|
||||||
signalManager.emit_signal("got_stomped")
|
signalManager.emit_signal("got_stomped")
|
||||||
remove_from_group("harmful")
|
remove_from_group("harmful")
|
||||||
$StompDetector.remove_from_group("weakpoint")
|
$StompDetector.remove_from_group("weakpoint")
|
||||||
get_node("EnemyBody").disabled = true
|
get_node("EnemyBody").disabled = true
|
||||||
die()
|
die()
|
||||||
|
|
||||||
func die() -> void:
|
func die() -> void:
|
||||||
queue_free()
|
queue_free()
|
||||||
# TODO make batterr
|
# TODO make batterr
|
||||||
levelState.kills += 1
|
levelState.kills += 1
|
||||||
|
|
||||||
func _on_EnemySkin_area_entered(area:Area2D) -> void:
|
func _on_EnemySkin_area_entered(area:Area2D) -> void:
|
||||||
if area.is_in_group("harmful"):
|
if area.is_in_group("harmful"):
|
||||||
get_node("EnemyBody").disabled = true
|
get_node("EnemyBody").disabled = true
|
||||||
die()
|
die()
|
||||||
|
|||||||
@ -63,10 +63,7 @@ drag_margin_top = 0.1
|
|||||||
drag_margin_bottom = 0.1
|
drag_margin_bottom = 0.1
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 9
|
frame = 5
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
|
||||||
frame = 8
|
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 8 )]
|
[node name="Blobby" parent="." instance=ExtResource( 8 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -80,10 +80,10 @@ wait_time = 20.0
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 9
|
frame = 2
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 8
|
frame = 1
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 10 )]
|
[node name="Blobby" parent="." instance=ExtResource( 10 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=28 format=2]
|
[gd_scene load_steps=29 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/Environment/GreenHouseTiles.tres" type="TileSet" id=1]
|
[ext_resource path="res://src/Environment/GreenHouseTiles.tres" type="TileSet" id=1]
|
||||||
[ext_resource path="res://src/Environment/DropThroughPlatforms.tres" type="TileSet" id=2]
|
[ext_resource path="res://src/Environment/DropThroughPlatforms.tres" type="TileSet" id=2]
|
||||||
@ -19,6 +19,7 @@
|
|||||||
[ext_resource path="res://assets/contraption/floating_platform_test.png" type="Texture" id=17]
|
[ext_resource path="res://assets/contraption/floating_platform_test.png" type="Texture" id=17]
|
||||||
[ext_resource path="res://src/Contraptions/Triggers/GateButton.tscn" type="PackedScene" id=18]
|
[ext_resource path="res://src/Contraptions/Triggers/GateButton.tscn" type="PackedScene" id=18]
|
||||||
[ext_resource path="res://src/Platforms/FlyingLaserCutter.tscn" type="PackedScene" id=19]
|
[ext_resource path="res://src/Platforms/FlyingLaserCutter.tscn" type="PackedScene" id=19]
|
||||||
|
[ext_resource path="res://src/Actors/Enemies/Beings/DartingEnemy.tscn" type="PackedScene" id=20]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachinePlayback" id=4]
|
[sub_resource type="AnimationNodeStateMachinePlayback" id=4]
|
||||||
|
|
||||||
@ -164,10 +165,10 @@ unique_name_in_owner = true
|
|||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 2
|
frame = 1
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 1
|
frame = 0
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 8 )]
|
[node name="Blobby" parent="." instance=ExtResource( 8 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -208,6 +209,9 @@ position = Vector2( 0, 24 )
|
|||||||
scale = Vector2( 0.5, 0.5 )
|
scale = Vector2( 0.5, 0.5 )
|
||||||
next_scene = "res://src/Levels/5 Tutorial Level.tscn"
|
next_scene = "res://src/Levels/5 Tutorial Level.tscn"
|
||||||
|
|
||||||
|
[node name="DartingEnemy" parent="ElevatorButton/Portal" instance=ExtResource( 20 )]
|
||||||
|
position = Vector2( -192, -301 )
|
||||||
|
|
||||||
[node name="Obstacles" type="Node2D" parent="."]
|
[node name="Obstacles" type="Node2D" parent="."]
|
||||||
position = Vector2( -412, -173 )
|
position = Vector2( -412, -173 )
|
||||||
|
|
||||||
|
|||||||
@ -285,11 +285,8 @@ wait_time = 20.0
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
|
||||||
frame = 10
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 9
|
frame = 12
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -259,10 +259,10 @@ visible = false
|
|||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 7
|
frame = 8
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 6
|
frame = 7
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user