Level 1 implemented

Level 1 playable; more to be added
This commit is contained in:
Jane Cho
2021-12-08 03:05:02 -06:00
parent 6e4284a792
commit d6e7dd9db3
6 changed files with 86 additions and 33 deletions

View File

@@ -5,18 +5,20 @@
[ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=3] [ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=3]
[ext_resource path="res://Enemies/Chasing Glowing Ghost.gd" type="Script" id=4] [ext_resource path="res://Enemies/Chasing Glowing Ghost.gd" type="Script" id=4]
[sub_resource type="CapsuleShape2D" id=3] [sub_resource type="CapsuleShape2D" id=1]
radius = 1.5 radius = 1.5
height = 3.0 height = 3.0
[sub_resource type="CapsuleShape2D" id=1] [sub_resource type="CapsuleShape2D" id=2]
radius = 3.0 radius = 3.0
height = 2.0 height = 2.0
[sub_resource type="CircleShape2D" id=2] [sub_resource type="CircleShape2D" id=3]
radius = 50.0 radius = 50.0
[node name="Chasing Glowing Ghost" type="KinematicBody2D" groups=["enemy"]] [node name="Chasing Glowing Ghost" type="KinematicBody2D" groups=[
"enemy",
]]
light_mask = 0 light_mask = 0
collision_layer = 4 collision_layer = 4
collision_mask = 5 collision_mask = 5
@@ -32,9 +34,11 @@ offset = Vector2( 0, 0.5 )
visible = false visible = false
light_mask = 0 light_mask = 0
rotation = 1.5708 rotation = 1.5708
shape = SubResource( 3 ) shape = SubResource( 1 )
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox_1"]] [node name="Hitbox" type="Area2D" parent="." groups=[
"enemy_hitbox_1",
]]
light_mask = 0 light_mask = 0
collision_layer = 4 collision_layer = 4
collision_mask = 2 collision_mask = 2
@@ -43,19 +47,19 @@ collision_mask = 2
visible = false visible = false
light_mask = 0 light_mask = 0
position = Vector2( 0, -2.5 ) position = Vector2( 0, -2.5 )
shape = SubResource( 1 ) shape = SubResource( 2 )
[node name="Player Detector" type="Area2D" parent="."] [node name="Player Detector" type="Area2D" parent="."]
light_mask = 0 light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false input_pickable = false
monitorable = false monitorable = false
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
visible = false visible = false
light_mask = 0 light_mask = 0
shape = SubResource( 2 ) shape = SubResource( 3 )
[node name="Light" type="Light2D" parent="."] [node name="Light" type="Light2D" parent="."]
texture = ExtResource( 2 ) texture = ExtResource( 2 )

View File

@@ -10,6 +10,7 @@ var position_tracker = 0.0
var player = null var player = null
var obstacle = null var obstacle = null
var DisplayValue = 10 var DisplayValue = 10
var health: int = 2
# 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() -> void: func _ready() -> void:
pass # Replace with function body. pass # Replace with function body.
@@ -47,7 +48,7 @@ func _on_Player_detect_body_exited(_body):
func _on_Star_detect_body_entered(body_star): func _on_Star_detect_body_entered(body_star):
#print("obstacle entered") #print("obstacle entered")
#print(body_star.name)#Obstacle #print(body_star.name)#Obstacle
if body_star.name == 'Star': if 'Star' in body_star.name:
obstacle = body_star obstacle = body_star
timer.set_wait_time(DisplayValue) timer.set_wait_time(DisplayValue)
timer.start() timer.start()
@@ -63,3 +64,15 @@ func _on_Star_detect_body_exited(_body):
func _on_Timer_timeout(): func _on_Timer_timeout():
#print("time out") #print("time out")
obstacle = null # Replace with function body. obstacle = null # Replace with function body.
func _on_Hitbox_area_entered(area: Area2D):
if obstacle: #when the enemy is vulnerable
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
if health <= 0:
call_deferred('queue_free')
return

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://Sprites/Enemies/DarkMatter_barrier.png" type="Texture" id=1] [ext_resource path="res://Sprites/Enemies/DarkMatter_barrier.png" type="Texture" id=1]
[ext_resource path="res://Enemies/Dark Matter.gd" type="Script" id=2] [ext_resource path="res://Enemies/Dark Matter.gd" type="Script" id=2]
@@ -12,6 +12,9 @@ radius = 55.4916
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 5.48996, 5.06427 ) extents = Vector2( 5.48996, 5.06427 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 5.50204, 4.89798 )
[node name="Dark Matter" type="KinematicBody2D"] [node name="Dark Matter" type="KinematicBody2D"]
collision_layer = 2 collision_layer = 2
collision_mask = 6 collision_mask = 6
@@ -39,8 +42,16 @@ shape = SubResource( 3 )
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
[node name="Hitbox" type="Area2D" parent="."]
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
shape = SubResource( 4 )
[connection signal="body_entered" from="Player_detect" to="." method="_on_Player_detect_body_entered"] [connection signal="body_entered" from="Player_detect" to="." method="_on_Player_detect_body_entered"]
[connection signal="body_exited" from="Player_detect" to="." method="_on_Player_detect_body_exited"] [connection signal="body_exited" from="Player_detect" to="." method="_on_Player_detect_body_exited"]
[connection signal="body_entered" from="Star_detect" to="." method="_on_Star_detect_body_entered"] [connection signal="body_entered" from="Star_detect" to="." method="_on_Star_detect_body_entered"]
[connection signal="body_exited" from="Star_detect" to="." method="_on_Star_detect_body_exited"] [connection signal="body_exited" from="Star_detect" to="." method="_on_Star_detect_body_exited"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]

View File

@@ -7,8 +7,9 @@ extends Node2D
# 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() -> void:
pass # Replace with function body. $YSort/Player.load_hud($HUD)
return
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.

View File

@@ -11,32 +11,56 @@
[node name="Space Level" type="Node2D"] [node name="Space Level" type="Node2D"]
script = ExtResource( 5 ) script = ExtResource( 5 )
[node name="Player" parent="." instance=ExtResource( 4 )]
position = Vector2( 178.673, 89.1493 )
[node name="Camera2D" type="Camera2D" parent="Player"]
current = true
limit_left = 0
limit_top = 0
limit_right = 640
limit_bottom = 360
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
margin_right = 40.0 margin_right = 160.0
margin_bottom = 40.0 margin_bottom = 90.0
rect_scale = Vector2( 4, 4 ) rect_scale = Vector2( 2.5, 2.5 )
texture = ExtResource( 1 ) texture = ExtResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="HUD" parent="." instance=ExtResource( 2 )] [node name="YSort" type="YSort" parent="."]
[node name="Pause Screen" parent="." instance=ExtResource( 3 )] [node name="Player" parent="YSort" instance=ExtResource( 4 )]
position = Vector2( 178.673, 89.1493 )
[node name="Dark Matter" parent="." instance=ExtResource( 6 )] [node name="Camera2D" type="Camera2D" parent="YSort/Player"]
current = true
limit_left = 0
limit_top = 0
limit_right = 400
limit_bottom = 225
[node name="Enemies" type="YSort" parent="YSort"]
[node name="Dark Matter" parent="YSort/Enemies" instance=ExtResource( 6 )]
position = Vector2( 97.0154, 82.0323 ) position = Vector2( 97.0154, 82.0323 )
collision_mask = 0 collision_mask = 0
[node name="Star" parent="." instance=ExtResource( 7 )] [node name="Dark Matter2" parent="YSort/Enemies" instance=ExtResource( 6 )]
position = Vector2( 205.006, 50.8542 )
[node name="Dark Matter3" parent="YSort/Enemies" instance=ExtResource( 6 )]
position = Vector2( 321.547, 98.5301 )
[node name="Dark Matter4" parent="YSort/Enemies" instance=ExtResource( 6 )]
position = Vector2( 72.0435, 202.887 )
[node name="Dark Matter5" parent="YSort/Enemies" instance=ExtResource( 6 )]
position = Vector2( 289.233, 198.649 )
[node name="Stars" type="YSort" parent="YSort"]
[node name="Star" parent="YSort/Stars" instance=ExtResource( 7 )]
position = Vector2( 140.092, 133.724 ) position = Vector2( 140.092, 133.724 )
[node name="Star2" parent="YSort/Stars" instance=ExtResource( 7 )]
position = Vector2( 278.639, 33.3731 )
[node name="Star3" parent="YSort/Stars" instance=ExtResource( 7 )]
position = Vector2( 323.666, 161.038 )
[node name="HUD" parent="." instance=ExtResource( 2 )]
[node name="Pause Screen" parent="." instance=ExtResource( 3 )]

View File

@@ -86,20 +86,20 @@ tile_data = PoolIntArray( -2359292, 0, 5, -2359291, 0, 196610, -2359290, 0, 1966
[node name="Fire3" type="AnimatedSprite" parent="."] [node name="Fire3" type="AnimatedSprite" parent="."]
position = Vector2( -607.628, -210.601 ) position = Vector2( -607.628, -210.601 )
frames = SubResource( 1 ) frames = SubResource( 1 )
frame = 11 frame = 4
playing = true playing = true
offset = Vector2( 679.819, 333.222 ) offset = Vector2( 679.819, 333.222 )
[node name="Fire2" type="AnimatedSprite" parent="."] [node name="Fire2" type="AnimatedSprite" parent="."]
position = Vector2( -543.25, -212.563 ) position = Vector2( -543.25, -212.563 )
frames = SubResource( 1 ) frames = SubResource( 1 )
frame = 7
playing = true playing = true
offset = Vector2( 679.819, 333.222 ) offset = Vector2( 679.819, 333.222 )
[node name="Fire1" type="AnimatedSprite" parent="."] [node name="Fire1" type="AnimatedSprite" parent="."]
position = Vector2( -479.806, -214.167 ) position = Vector2( -479.806, -214.167 )
frames = SubResource( 1 ) frames = SubResource( 1 )
frame = 7
playing = true playing = true
offset = Vector2( 679.819, 333.222 ) offset = Vector2( 679.819, 333.222 )