Level 3 working fr

This commit is contained in:
Diego 2020-07-23 15:32:05 -05:00
parent 5993949373
commit 6733fdbb72
8 changed files with 116 additions and 90 deletions

View file

@ -26,7 +26,7 @@ tracks/0/keys = {
[node name="Demon" type="KinematicBody2D"] [node name="Demon" type="KinematicBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 7 collision_mask = 15
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -26,7 +26,7 @@ tracks/0/keys = {
[node name="Skeleton Enemy" type="KinematicBody2D"] [node name="Skeleton Enemy" type="KinematicBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 7 collision_mask = 15
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -5,8 +5,8 @@
[ext_resource path="res://Music and Fonts(Misc.)/Ogre Hit.tres" type="Animation" id=3] [ext_resource path="res://Music and Fonts(Misc.)/Ogre Hit.tres" type="Animation" id=3]
[ext_resource path="res://Music and Fonts(Misc.)/Ogre Run.tres" type="Animation" id=4] [ext_resource path="res://Music and Fonts(Misc.)/Ogre Run.tres" type="Animation" id=4]
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="CapsuleShape2D" id=1]
extents = Vector2( 10, 11 ) height = 4.0
[sub_resource type="CapsuleShape2D" id=2] [sub_resource type="CapsuleShape2D" id=2]
radius = 12.0 radius = 12.0
@ -15,17 +15,18 @@ height = 6.0
[node name="Ogre" type="KinematicBody2D"] [node name="Ogre" type="KinematicBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 2147483655 collision_mask = 2147483655
collision/safe_margin = 2.518
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0, -17 ) position = Vector2( 0, -17 )
texture = ExtResource( 2 ) texture = ExtResource( 2 )
hframes = 4 hframes = 4
frame = 2 frame = 3
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 1, -11 ) position = Vector2( 1, -12 )
shape = SubResource( 3 ) shape = SubResource( 1 )
[node name="DamageCD" type="Timer" parent="."] [node name="DamageCD" type="Timer" parent="."]
wait_time = 0.5 wait_time = 0.5
@ -40,7 +41,6 @@ anims/Hit = ExtResource( 3 )
"anims/Ogre Hit" = ExtResource( 3 ) "anims/Ogre Hit" = ExtResource( 3 )
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
visible = false
collision_layer = 0 collision_layer = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]

View file

@ -23,12 +23,11 @@ func _physics_process(_delta):
PlayerRaycast.cast_to = player_position - global_position PlayerRaycast.cast_to = player_position - global_position
var collider = PlayerRaycast.get_collider() var collider = PlayerRaycast.get_collider()
if dist >= 200:
if collider != null && collider.has_method("get_type") && collider.get_type() == "player":
shoot_fireball(position.direction_to(player_position))
if dist <= 200: if dist <= 200:
velocity.x = position.direction_to(player_position).normalized().x * speed velocity.x = position.direction_to(player_position).normalized().x * speed
if collider != null && collider.has_method("get_type") && collider.get_type() == "player":
shoot_fireball(position.direction_to(player_position))
else: else:
velocity = Vector2(0, 0) velocity = Vector2(0, 0)

File diff suppressed because one or more lines are too long

View file

@ -1,23 +1,23 @@
extends Area2D extends Area2D
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): #func _process(delta):
# pass # pass
func _on_Area2D_body_entered(body): func _on_Area2D_body_entered(body):
if body.has_method("get_type") and body.get_type() == "player": if body.has_method("get_type") and body.get_type() == "player":
get_tree().change_scene("res://Title/Death Screen'.tscn") get_tree().change_scene("res://Title/Death Screen'.tscn")
else: else:
print("hi") print("hi")

View file

@ -95,7 +95,7 @@ script = ExtResource( 11 )
position = Vector2( 1120, 72 ) position = Vector2( 1120, 72 )
[node name="Player" parent="." instance=ExtResource( 1 )] [node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 35, 219 ) position = Vector2( 431.5, 202 )
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
script = ExtResource( 3 ) script = ExtResource( 3 )
@ -133,9 +133,6 @@ shape = SubResource( 2 )
position = Vector2( -49, -9 ) position = Vector2( -49, -9 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="Demon" parent="StaticBody2D" instance=ExtResource( 10 )]
position = Vector2( -316, 225 )
[node name="Ogre" parent="." instance=ExtResource( 7 )] [node name="Ogre" parent="." instance=ExtResource( 7 )]
position = Vector2( 800, -52 ) position = Vector2( 800, -52 )
@ -150,6 +147,9 @@ position = Vector2( 717, 119 )
[node name="CanvasModulate" type="CanvasModulate" parent="."] [node name="CanvasModulate" type="CanvasModulate" parent="."]
color = Color( 0.564706, 0.564706, 0.564706, 1 ) color = Color( 0.564706, 0.564706, 0.564706, 1 )
[connection signal="on" from="Lever" to="TileMapAppearing" method="_on_Lever_on"]
[node name="Demon" parent="." instance=ExtResource( 10 )]
position = Vector2( 668, 135.5 )
[connection signal="on" from="Lever" to="TileMapDisapearing" method="_on_Lever_on"] [connection signal="on" from="Lever" to="TileMapDisapearing" method="_on_Lever_on"]
[connection signal="on" from="Lever" to="TileMapAppearing" method="_on_Lever_on"]
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_Area2D_body_entered"] [connection signal="body_entered" from="Area2D" to="Area2D" method="_on_Area2D_body_entered"]

View file

@ -1,8 +1,8 @@
extends TileMap extends TileMap
func _on_Lever_on(): func _on_Lever_on():
$AnimationPlayer.play("Appearing Platform") $AnimationPlayer.play("Appearing Platform")
func _on_Lever_off(): func _on_Lever_off():
queue_free() queue_free()