added music/sounds
This commit is contained in:
@@ -10,66 +10,66 @@ var counter: int = 0
|
||||
signal demon_boss_death
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
var angle = position.angle_to_point(player.position)
|
||||
if abs(angle) > PI/2:
|
||||
$AnimatedSprite1.scale.x = -0.563
|
||||
else:
|
||||
$AnimatedSprite1.scale.x = 0.563
|
||||
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite1.visible = false
|
||||
else:
|
||||
$AnimatedSprite1.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
hit = false
|
||||
counter = 0
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
var angle = position.angle_to_point(player.position)
|
||||
if abs(angle) > PI/2:
|
||||
$AnimatedSprite1.scale.x = -0.563
|
||||
else:
|
||||
$AnimatedSprite1.scale.x = 0.563
|
||||
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite1.visible = false
|
||||
else:
|
||||
$AnimatedSprite1.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
hit = false
|
||||
counter = 0
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Walk'
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Walk'
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_exited(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
$AnimatedSprite1.animation = 'Idle'
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
$AnimatedSprite1.animation = 'Idle'
|
||||
return
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
emit_signal("demon_boss_death")
|
||||
return
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
emit_signal("demon_boss_death")
|
||||
return
|
||||
|
||||
func _on_Player_Detector__Attack_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Attack'
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Attack'
|
||||
|
||||
|
||||
func _on_Player_Detector__Attack_body_exited(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Walk'
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Walk'
|
||||
|
@@ -6,6 +6,50 @@
|
||||
[ext_resource path="res://Sprites/Enemies/Demon_Slime_Spritesheet.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=7]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=37]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=38]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=39]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=40]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=41]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=42]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1440, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=58]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=59]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=60]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=61]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=62]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 640, 288, 160 )
|
||||
@@ -94,6 +138,54 @@ region = Rect2( 5760, 640, 288, 160 )
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 6048, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=25]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=26]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=27]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=28]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=29]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=30]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1440, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=31]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1728, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=32]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2016, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=33]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2304, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=34]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2592, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=35]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2880, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=36]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 3168, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=43]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 320, 288, 160 )
|
||||
@@ -154,124 +246,32 @@ region = Rect2( 3744, 320, 288, 160 )
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 4032, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=58]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=59]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=60]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=61]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=62]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=25]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=26]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=27]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=28]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=29]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=30]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1440, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=31]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1728, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=32]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2016, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=33]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2304, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=34]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2592, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=35]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 2880, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=36]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 3168, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=37]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=38]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 288, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=39]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 576, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=40]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 864, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=41]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1152, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=42]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 1440, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=63]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||
"frames": [ SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ) ],
|
||||
"loop": true,
|
||||
"name": "Death",
|
||||
"name": "Idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ) ],
|
||||
"loop": true,
|
||||
"name": "Attack",
|
||||
"speed": 15.0
|
||||
}, {
|
||||
"frames": [ SubResource( 58 ), SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ) ],
|
||||
"loop": true,
|
||||
"name": "Hit",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||
"loop": true,
|
||||
"name": "Death",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ) ],
|
||||
"loop": true,
|
||||
"name": "Walk",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ) ],
|
||||
"frames": [ SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ) ],
|
||||
"loop": true,
|
||||
"name": "Idle",
|
||||
"speed": 5.0
|
||||
"name": "Attack",
|
||||
"speed": 15.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=64]
|
||||
@@ -299,7 +299,7 @@ position = Vector2( 2, -15 )
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
frames = SubResource( 63 )
|
||||
animation = "Idle"
|
||||
frame = 5
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
@@ -10,49 +10,49 @@ var counter: int = 0
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
|
||||
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite.visible = false
|
||||
else:
|
||||
$AnimatedSprite.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
counter = 0
|
||||
hit = false
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite.visible = false
|
||||
else:
|
||||
$AnimatedSprite.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
counter = 0
|
||||
hit = false
|
||||
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_exited(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
return
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
|
@@ -10,65 +10,65 @@ var counter: int = 0
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
var angle = position.angle_to_point(player.position)
|
||||
if abs(angle) > PI/2:
|
||||
$AnimatedSprite1.scale.x = -0.563
|
||||
else:
|
||||
$AnimatedSprite1.scale.x = 0.563
|
||||
if player and position.distance_to(player.position) > 1:
|
||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||
var angle = position.angle_to_point(player.position)
|
||||
if abs(angle) > PI/2:
|
||||
$AnimatedSprite1.scale.x = -0.563
|
||||
else:
|
||||
$AnimatedSprite1.scale.x = 0.563
|
||||
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite1.visible = false
|
||||
else:
|
||||
$AnimatedSprite1.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
counter = 0
|
||||
hit = false
|
||||
if hit == true:
|
||||
if counter < 15:
|
||||
if counter % 5 == 0:
|
||||
$AnimatedSprite1.visible = false
|
||||
else:
|
||||
$AnimatedSprite1.visible = true
|
||||
counter += 1
|
||||
velocity = Vector2.ZERO
|
||||
else:
|
||||
counter = 0
|
||||
hit = false
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Running'
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Running'
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_body_exited(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
$AnimatedSprite1.animation = 'Idle'
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
player = null
|
||||
$AnimatedSprite1.animation = 'Idle'
|
||||
return
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
hit = true
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
hit = true
|
||||
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
|
||||
func _on_Player_Detector__Attack_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Jump'
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Jump'
|
||||
|
||||
|
||||
func _on_Player_Detector__Attack_body_exited(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Running'
|
||||
if body.is_in_group('player'):
|
||||
player = body
|
||||
$AnimatedSprite1.animation = 'Running'
|
||||
|
88
GUI/HUD.gd
88
GUI/HUD.gd
@@ -5,76 +5,76 @@ var weapon = "sword"
|
||||
|
||||
|
||||
func _on_Add_Currency_pressed() -> void:
|
||||
emit_signal('add_currency', 1)
|
||||
return
|
||||
emit_signal('add_currency', 1)
|
||||
return
|
||||
|
||||
|
||||
func update_currency(amount: int) -> void:
|
||||
$Currency.set_text(String(amount))
|
||||
return
|
||||
$Currency.set_text(String(amount))
|
||||
return
|
||||
|
||||
|
||||
func update_health(value: int) -> void:
|
||||
$'Health Bar'.value = value
|
||||
return
|
||||
$'Health Bar'.value = value
|
||||
return
|
||||
|
||||
|
||||
func _on_weapon_slot_pressed() -> void:
|
||||
$'Weapon Selection'.set_visible(not $'Weapon Selection'.visible)
|
||||
return
|
||||
$'Weapon Selection'.set_visible(not $'Weapon Selection'.visible)
|
||||
return
|
||||
|
||||
|
||||
func _on_select_bow_pressed() -> void:
|
||||
$'Weapon Selection/Bow'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Bow/Weapon'.get_normal_texture())
|
||||
$'Weapon Selection/Bow'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Bow/Weapon'.get_normal_texture())
|
||||
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "bow"
|
||||
return
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "bow"
|
||||
return
|
||||
|
||||
|
||||
func _on_select_javelin_pressed() -> void:
|
||||
$'Weapon Selection/Javelin'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Javelin/Weapon'.get_normal_texture())
|
||||
$'Weapon Selection/Javelin'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Javelin/Weapon'.get_normal_texture())
|
||||
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "javelin"
|
||||
return
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "javelin"
|
||||
return
|
||||
|
||||
|
||||
func _on_select_staff_pressed() -> void:
|
||||
$'Weapon Selection/Staff'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Staff/Weapon'.get_normal_texture())
|
||||
$'Weapon Selection/Staff'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Staff/Weapon'.get_normal_texture())
|
||||
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Sword'.set_visible(true)
|
||||
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "staff"
|
||||
return
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "staff"
|
||||
return
|
||||
|
||||
|
||||
func _on_select_sword_pressed() -> void:
|
||||
$'Weapon Selection/Sword'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Sword/Weapon'.get_normal_texture())
|
||||
$'Weapon Selection/Sword'.set_visible(false)
|
||||
$'Equipped Weapon/Weapon'.set_normal_texture(
|
||||
$'Weapon Selection/Sword/Weapon'.get_normal_texture())
|
||||
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
$'Weapon Selection/Bow'.set_visible(true)
|
||||
$'Weapon Selection/Javelin'.set_visible(true)
|
||||
$'Weapon Selection/Staff'.set_visible(true)
|
||||
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "sword"
|
||||
return
|
||||
$'Weapon Selection'.set_visible(false)
|
||||
weapon = "sword"
|
||||
return
|
||||
|
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=15 format=2]
|
||||
[gd_scene load_steps=16 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/Black_Background.png" type="Texture" id=1]
|
||||
[ext_resource path="res://GUI/Level Ending.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Resources/Ash.tres" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://Sprites/Assets/Smol_P.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Music/Level_Complete.mp3" type="AudioStream" id=5]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
font_data = ExtResource( 3 )
|
||||
@@ -82,6 +83,7 @@ __meta__ = {
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 160, 120 )
|
||||
frames = SubResource( 10 )
|
||||
frame = 6
|
||||
playing = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
@@ -89,4 +91,9 @@ wait_time = 4.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 5 )
|
||||
volume_db = -10.0
|
||||
autoplay = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
@@ -4,7 +4,7 @@ export var hub_world_path: String = 'res://Levels/Hub World.tscn'
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
if get_tree().change_scene(hub_world_path) != OK:
|
||||
print('ERROR: Level Ending failed to change scene to Hub World.')
|
||||
queue_free()
|
||||
return
|
||||
if get_tree().change_scene(hub_world_path) != OK:
|
||||
print('ERROR: Level Ending failed to change scene to Hub World.')
|
||||
queue_free()
|
||||
return
|
||||
|
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=15 format=2]
|
||||
[gd_scene load_steps=16 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/Black_Background.png" type="Texture" id=1]
|
||||
[ext_resource path="res://GUI/Level Ending.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Resources/Ash.tres" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://Sprites/Assets/Smol_P.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Music/Level_Failed.wav" type="AudioStream" id=5]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
font_data = ExtResource( 3 )
|
||||
@@ -82,7 +83,7 @@ __meta__ = {
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 160, 120 )
|
||||
frames = SubResource( 10 )
|
||||
frame = 7
|
||||
frame = 5
|
||||
playing = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
@@ -90,4 +91,9 @@ wait_time = 4.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 5 )
|
||||
volume_db = -10.0
|
||||
autoplay = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
@@ -4,36 +4,36 @@ signal complete(option)
|
||||
|
||||
|
||||
func _on_new_game_button_pressed() -> void:
|
||||
emit_signal('complete', 'new game')
|
||||
return
|
||||
emit_signal('complete', 'new game')
|
||||
return
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
get_tree().quit()
|
||||
return
|
||||
get_tree().quit()
|
||||
return
|
||||
|
||||
|
||||
func _on_continue_button_mouse_entered() -> void:
|
||||
if not $'Menu/Menu Elements/Menu Options/Continue/Continue Button'.disabled:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
if not $'Menu/Menu Elements/Menu Options/Continue/Continue Button'.disabled:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
|
||||
|
||||
func _on_new_game_button_mouse_entered() -> void:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
|
||||
|
||||
func _on_settings_button_mouse_entered() -> void:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
|
||||
|
||||
func _on_credits_button_mouse_entered() -> void:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
|
||||
|
||||
func _on_quit_button_mouse_entered() -> void:
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
$'Menu Button Hover'.play(0.0)
|
||||
return
|
||||
|
@@ -4,26 +4,26 @@ signal complete
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Fade in
|
||||
if not $Tween.interpolate_property(self, 'self_modulate:a', 0, 1, 3, Tween.TRANS_LINEAR, Tween.EASE_IN):
|
||||
print('ERROR: Splash Screen fade in animation has errors.')
|
||||
if not $Tween.start():
|
||||
print('ERROR: Splash Screen fade in animation failed to start.')
|
||||
# Fade in
|
||||
if not $Tween.interpolate_property(self, 'self_modulate:a', 0, 1, 3, Tween.TRANS_LINEAR, Tween.EASE_IN):
|
||||
print('ERROR: Splash Screen fade in animation has errors.')
|
||||
if not $Tween.start():
|
||||
print('ERROR: Splash Screen fade in animation failed to start.')
|
||||
|
||||
yield($Tween, 'tween_completed') # Wait for fade in to complete
|
||||
yield($Tween, 'tween_completed') # Wait for fade in to complete
|
||||
|
||||
# Fade out
|
||||
if not $Tween.interpolate_property(self, 'self_modulate:a', 1, 0, 3, Tween.TRANS_LINEAR, Tween.EASE_OUT, 2):
|
||||
print('ERROR: Splash Screen fade out animation has errors.')
|
||||
if not $Tween.start():
|
||||
print('ERROR: Splash Screen fade out animation failed to start.')
|
||||
# Fade out
|
||||
if not $Tween.interpolate_property(self, 'self_modulate:a', 1, 0, 3, Tween.TRANS_LINEAR, Tween.EASE_OUT, 2):
|
||||
print('ERROR: Splash Screen fade out animation has errors.')
|
||||
if not $Tween.start():
|
||||
print('ERROR: Splash Screen fade out animation failed to start.')
|
||||
|
||||
yield($Tween, 'tween_completed') # Wait for fade out to complete
|
||||
emit_signal('complete')
|
||||
return
|
||||
yield($Tween, 'tween_completed') # Wait for fade out to complete
|
||||
emit_signal('complete')
|
||||
return
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('ui_accept'):
|
||||
emit_signal('complete')
|
||||
return
|
||||
if event.is_action_pressed('ui_accept'):
|
||||
emit_signal('complete')
|
||||
return
|
||||
|
@@ -9,7 +9,7 @@ onready var shape = portal.get_child(0)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
shape.set_deferred("disabled",true)
|
||||
shape.set_deferred("disabled",true)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -18,4 +18,4 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_ChestDetection_body_entered(body: Node) -> void:
|
||||
shape.set_deferred("disabled",false)
|
||||
shape.set_deferred("disabled",false)
|
||||
|
@@ -5,6 +5,8 @@ extends Camera2D
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
signal enter_portal
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@@ -17,9 +19,11 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_PortalDarkForest_body_entered(body: Node) -> void:
|
||||
self.limit_bottom = -224
|
||||
self.limit_top = -736
|
||||
self.limit_left = -32
|
||||
self.limit_right = 448
|
||||
var player = get_parent()
|
||||
player.position = Vector2(256,-232)
|
||||
self.limit_bottom = -224
|
||||
self.limit_top = -736
|
||||
self.limit_left = -32
|
||||
self.limit_right = 448
|
||||
var player = get_parent()
|
||||
player.position = Vector2(256,-232)
|
||||
emit_signal('enter_portal')
|
||||
|
||||
|
@@ -2,16 +2,16 @@ extends Node2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
$YSort/Player.load_hud($HUD)
|
||||
|
||||
for level_portal in $'YSort/Level Portals'.get_children():
|
||||
if level_portal.connect('enter_level', self, 'enter_level') != OK:
|
||||
print('ERROR: Level Portal "enter_level" signal already connected.')
|
||||
return
|
||||
for level_portal in $'YSort/Level Portals'.get_children():
|
||||
if level_portal.connect('enter_level', self, 'enter_level') != OK:
|
||||
print('ERROR: Level Portal "enter_level" signal already connected.')
|
||||
return
|
||||
|
||||
|
||||
func enter_level(level: String) -> void:
|
||||
if get_tree().change_scene(level) != OK:
|
||||
print('ERROR: Hub World failed to change scene to Level.')
|
||||
queue_free()
|
||||
return
|
||||
if get_tree().change_scene(level) != OK:
|
||||
print('ERROR: Hub World failed to change scene to Level.')
|
||||
queue_free()
|
||||
return
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Hub World.gd" type="Script" id=2]
|
||||
@@ -7,6 +7,7 @@
|
||||
[ext_resource path="res://Sprites/Levels/Tilesets/Hub_World_Grass_Atlas.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Sprites/Assets/Black_Tile.png" type="Texture" id=6]
|
||||
[ext_resource path="res://Levels/Interactables/Level Portal.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://Music/Hub_World.mp3" type="AudioStream" id=8]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=2]
|
||||
points = PoolVector2Array( 0, 0, 2, 0, 2, 2, 0, 2 )
|
||||
@@ -125,3 +126,8 @@ level_path = "res://Levels/Level 5.tscn"
|
||||
|
||||
[node name="Pause Screen" parent="." instance=ExtResource( 4 )]
|
||||
disable_back_to_hub = true
|
||||
|
||||
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 8 )
|
||||
volume_db = -10.0
|
||||
autoplay = true
|
||||
|
@@ -4,14 +4,14 @@ var death_count: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
|
||||
|
||||
func _on_dark_matter_death() -> void:
|
||||
death_count += 1
|
||||
if death_count == 5:
|
||||
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||
print('ERROR: Level 1 failed to change scene to Level Complete.')
|
||||
queue_free()
|
||||
return
|
||||
death_count += 1
|
||||
if death_count == 5:
|
||||
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||
print('ERROR: Level 1 failed to change scene to Level Complete.')
|
||||
queue_free()
|
||||
return
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/galaxy_background.png" type="Texture" id=1]
|
||||
[ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=2]
|
||||
@@ -7,6 +7,7 @@
|
||||
[ext_resource path="res://Levels/Level 1.gd" type="Script" id=5]
|
||||
[ext_resource path="res://Enemies/Dark Matter.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://Levels/Interactables/Star.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://Music/Level_1.mp3" type="AudioStream" id=8]
|
||||
|
||||
[node name="Space Level" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
@@ -73,6 +74,11 @@ mode = 1
|
||||
build_mode = 1
|
||||
polygon = PoolVector2Array( 0.762451, -22.0982, 427.859, -18.7308, 425.053, 245.609, -22.248, 248.976, -21.1256, -22.6594, -0.589813, -21.9661, -0.589806, 225.272, 400.359, 224.843, 399.969, -0.312477, 0.455406, -0.154987 )
|
||||
|
||||
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 8 )
|
||||
volume_db = -7.0
|
||||
autoplay = true
|
||||
|
||||
[connection signal="death" from="YSort/Enemies/Dark Matter" to="." method="_on_dark_matter_death"]
|
||||
[connection signal="death" from="YSort/Enemies/Dark Matter2" to="." method="_on_dark_matter_death"]
|
||||
[connection signal="death" from="YSort/Enemies/Dark Matter3" to="." method="_on_dark_matter_death"]
|
||||
|
@@ -1,13 +1,18 @@
|
||||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
#$YSort/Player.position = get_viewport_rect().size / 2
|
||||
$YSort/Player.position = Vector2(0,0)
|
||||
$YSort/Player.load_hud($HUD)
|
||||
$HUD/Control.visible = false
|
||||
return
|
||||
#$YSort/Player.position = get_viewport_rect().size / 2
|
||||
$YSort/Player.position = Vector2(0,0)
|
||||
$YSort/Player.load_hud($HUD)
|
||||
$HUD/Control.visible = false
|
||||
return
|
||||
|
||||
|
||||
func _on_Area2D_body_entered(body):
|
||||
$HUD/Control.visible = true
|
||||
print("j")
|
||||
#print("j")
|
||||
|
||||
|
||||
func _on_Camera2D_enter_portal() -> void:
|
||||
$BGM1.stop()
|
||||
$BGM2.play()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=88 format=2]
|
||||
[gd_scene load_steps=90 format=2]
|
||||
|
||||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Level 2.gd" type="Script" id=2]
|
||||
@@ -19,6 +19,8 @@
|
||||
[ext_resource path="res://Sprites/Assets/grassPatch.png" type="Texture" id=17]
|
||||
[ext_resource path="res://Sprites/Assets/JournalScrap.png" type="Texture" id=18]
|
||||
[ext_resource path="res://Levels/Objects/Dialogue.tscn" type="PackedScene" id=19]
|
||||
[ext_resource path="res://Music/Level_2_2.mp3" type="AudioStream" id=20]
|
||||
[ext_resource path="res://Music/Level_2_1.mp3" type="AudioStream" id=21]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "darkForestTileset.png 0"
|
||||
@@ -940,6 +942,16 @@ tile_set = SubResource( 67 )
|
||||
format = 1
|
||||
tile_data = PoolIntArray( -589828, 0, 0, -458754, 0, 0, -393220, 0, 0 )
|
||||
|
||||
[node name="BGM1" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 21 )
|
||||
volume_db = -10.0
|
||||
autoplay = true
|
||||
|
||||
[node name="BGM2" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 20 )
|
||||
volume_db = -10.0
|
||||
|
||||
[connection signal="enter_portal" from="YSort/Player/Camera2D" to="." method="_on_Camera2D_enter_portal"]
|
||||
[connection signal="body_entered" from="Collectible/Area2D" to="." method="_on_Area2D_body_entered"]
|
||||
[connection signal="body_entered" from="TreasureChest/ChestDetection" to="TreasureChest/ChestDetection" method="_on_ChestDetection_body_entered"]
|
||||
[connection signal="body_entered" from="TreasureChest/PortalDarkForest" to="YSort/Player/Camera2D" method="_on_PortalDarkForest_body_entered"]
|
||||
|
@@ -7,51 +7,51 @@ var score = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
screensize = get_viewport_rect().size
|
||||
spawn_coins(8)
|
||||
return
|
||||
$YSort/Player.load_hud($HUD)
|
||||
screensize = get_viewport_rect().size
|
||||
spawn_coins(8)
|
||||
return
|
||||
|
||||
|
||||
func spawn_coins(num: int) -> void:
|
||||
for _i in range(num):
|
||||
var g: Node = coin.instance()
|
||||
$'coin_container'.add_child(g)
|
||||
g.connect('coin_grabbed', self, '_on_coin_grabbed')
|
||||
#g.set_pos(Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40)))
|
||||
g.position = Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40))
|
||||
return
|
||||
for _i in range(num):
|
||||
var g: Node = coin.instance()
|
||||
$'coin_container'.add_child(g)
|
||||
g.connect('coin_grabbed', self, '_on_coin_grabbed')
|
||||
#g.set_pos(Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40)))
|
||||
g.position = Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40))
|
||||
return
|
||||
|
||||
|
||||
func _on_coin_grabbed() -> void:
|
||||
score += 1
|
||||
print(score)
|
||||
$'Level 3 HUD/Label'.set_text(str(score) + '/5')
|
||||
return
|
||||
score += 1
|
||||
print(score)
|
||||
$'Level 3 HUD/Label'.set_text(str(score) + '/5')
|
||||
return
|
||||
|
||||
|
||||
func _timer_out() -> void:
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
queue_free()
|
||||
return
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
queue_free()
|
||||
return
|
||||
|
||||
|
||||
func _on_TreasureChest_ice_key_collected() -> void:
|
||||
$YSort/Door/doorClosed.visible = false
|
||||
$YSort/Door/doorOpened.visible = true
|
||||
$YSort/DoorCollision.layers = 5
|
||||
return
|
||||
$YSort/Door/doorClosed.visible = false
|
||||
$YSort/Door/doorOpened.visible = true
|
||||
$YSort/DoorCollision.layers = 5
|
||||
return
|
||||
|
||||
|
||||
func _on_DoorDetector_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
print('WIN WIN WIN')
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
print('WIN WIN WIN')
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
return
|
||||
|
||||
|
||||
func _on_DoorDetector_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
||||
queue_free()
|
||||
return
|
||||
if area.get_parent().name == 'Player':
|
||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
||||
queue_free()
|
||||
return
|
||||
|
@@ -4,31 +4,31 @@ var gems: int = 4
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
|
||||
|
||||
func _on_TreasureChest_gem_collected() -> void:
|
||||
gems -= 1
|
||||
gems -= 1
|
||||
|
||||
if gems == 0:
|
||||
$YSort/Items/Door/doorClosed.visible = false
|
||||
$YSort/Items/Door/doorOpened.visible = true
|
||||
$DoorCollision.layers = 5
|
||||
return
|
||||
if gems == 0:
|
||||
$YSort/Items/Door/doorClosed.visible = false
|
||||
$YSort/Items/Door/doorOpened.visible = true
|
||||
$DoorCollision.layers = 5
|
||||
return
|
||||
|
||||
|
||||
func _on_NextArea_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
$YSort/Player.position.x = 195
|
||||
$YSort/Player.position.y = -335
|
||||
return
|
||||
if area.get_parent().name == 'Player':
|
||||
$YSort/Player.position.x = 195
|
||||
$YSort/Player.position.y = -335
|
||||
return
|
||||
|
||||
|
||||
func _on_Demon_Boss_demon_boss_death() -> void:
|
||||
$Timer.start()
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _on_Timer_timeout() -> void:
|
||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
||||
queue_free()
|
||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
||||
queue_free()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=31 format=2]
|
||||
[gd_scene load_steps=32 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Levels/Environment/Fire_Column_Medium_12.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Enemies/Hellhound.tscn" type="PackedScene" id=2]
|
||||
@@ -24,6 +24,7 @@
|
||||
[ext_resource path="res://GUI/Pause Screen.tscn" type="PackedScene" id=22]
|
||||
[ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=23]
|
||||
[ext_resource path="res://Enemies/Flaming Skull.tscn" type="PackedScene" id=24]
|
||||
[ext_resource path="res://Music/Level_4.mp3" type="AudioStream" id=25]
|
||||
[ext_resource path="res://Enemies/Demon Boss.tscn" type="PackedScene" id=26]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
@@ -86,34 +87,35 @@ tile_data = PoolIntArray( -2686978, 0, 5, -2686977, 0, 196610, -2752512, 0, 1966
|
||||
[node name="Fire3" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -607.628, -210.601 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 9
|
||||
playing = true
|
||||
offset = Vector2( 679.819, 333.222 )
|
||||
|
||||
[node name="Fire2" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -543.25, -212.563 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 3
|
||||
frame = 12
|
||||
playing = true
|
||||
offset = Vector2( 679.819, 333.222 )
|
||||
|
||||
[node name="Fire1" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -479.806, -214.167 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 10
|
||||
frame = 5
|
||||
playing = true
|
||||
offset = Vector2( 679.819, 333.222 )
|
||||
|
||||
[node name="Fire4" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -319, -843 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 10
|
||||
frame = 5
|
||||
playing = true
|
||||
offset = Vector2( 679.819, 333.222 )
|
||||
|
||||
[node name="Fire5" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( -623, -844 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 9
|
||||
frame = 4
|
||||
playing = true
|
||||
offset = Vector2( 679.819, 333.222 )
|
||||
|
||||
@@ -236,6 +238,11 @@ shape = SubResource( 5 )
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 2.5
|
||||
|
||||
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 25 )
|
||||
volume_db = -10.0
|
||||
autoplay = true
|
||||
|
||||
[connection signal="demon_boss_death" from="YSort/Enemies/Demon Boss" to="." method="_on_Demon_Boss_demon_boss_death"]
|
||||
[connection signal="gem_collected" from="YSort/Items/TreasureChest" to="." method="_on_TreasureChest_gem_collected"]
|
||||
[connection signal="gem_collected" from="YSort/Items/TreasureChest2" to="." method="_on_TreasureChest_gem_collected"]
|
||||
|
@@ -2,27 +2,27 @@ extends Node2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
|
||||
|
||||
func _on_activate_boss_teleporter_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
$'Interactables/Boss Teleporter'.set_deferred('visible', true)
|
||||
$'Interactables/Activate Boss Teleporter'.call_deferred('queue_free')
|
||||
return
|
||||
if body.is_in_group('player'):
|
||||
$'Interactables/Boss Teleporter'.set_deferred('visible', true)
|
||||
$'Interactables/Activate Boss Teleporter'.call_deferred('queue_free')
|
||||
return
|
||||
|
||||
|
||||
func _on_eyeball_boss_death() -> void:
|
||||
$YSort/Enemies.call_deferred('queue_free')
|
||||
$Lights.call_deferred('queue_free')
|
||||
$Darkness.set_visible(false)
|
||||
$Ending.start()
|
||||
return
|
||||
$YSort/Enemies.call_deferred('queue_free')
|
||||
$Lights.call_deferred('queue_free')
|
||||
$Darkness.set_visible(false)
|
||||
$Ending.start()
|
||||
return
|
||||
|
||||
|
||||
func _on_ending_timeout():
|
||||
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||
print('ERROR: Level 5 failed to change scene to Level Complete.')
|
||||
queue_free()
|
||||
return
|
||||
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||
print('ERROR: Level 5 failed to change scene to Level Complete.')
|
||||
queue_free()
|
||||
return
|
||||
|
96
Main.gd
96
Main.gd
@@ -7,76 +7,76 @@ export var hub_world_path: String
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
var splash_screen: Node = play_splash_screen()
|
||||
yield(splash_screen, 'complete')
|
||||
splash_screen = null
|
||||
randomize()
|
||||
var splash_screen: Node = play_splash_screen()
|
||||
yield(splash_screen, 'complete')
|
||||
splash_screen = null
|
||||
|
||||
var main_menu: Node = play_main_menu()
|
||||
yield(main_menu, 'complete')
|
||||
free_connected_node(main_menu, 'main_menu_option')
|
||||
main_menu = null
|
||||
return
|
||||
var main_menu: Node = play_main_menu()
|
||||
yield(main_menu, 'complete')
|
||||
free_connected_node(main_menu, 'main_menu_option')
|
||||
main_menu = null
|
||||
return
|
||||
|
||||
|
||||
func play_splash_screen() -> Node:
|
||||
var splash_screen: Node = load(splash_screen_path).instance()
|
||||
if splash_screen.connect('complete', self, 'free_connected_node',
|
||||
[splash_screen, 'free_connected_node']) != OK:
|
||||
print('ERROR: Splash Screen "complete" signal already connected.')
|
||||
var splash_screen: Node = load(splash_screen_path).instance()
|
||||
if splash_screen.connect('complete', self, 'free_connected_node',
|
||||
[splash_screen, 'free_connected_node']) != OK:
|
||||
print('ERROR: Splash Screen "complete" signal already connected.')
|
||||
|
||||
add_child(splash_screen)
|
||||
return splash_screen
|
||||
add_child(splash_screen)
|
||||
return splash_screen
|
||||
|
||||
|
||||
func play_main_menu() -> Node:
|
||||
var main_menu: Node = load(main_menu_path).instance()
|
||||
if main_menu.connect('complete', self, 'main_menu_option') != OK:
|
||||
print('ERROR: Main Menu "complete" signal already connected.')
|
||||
var main_menu: Node = load(main_menu_path).instance()
|
||||
if main_menu.connect('complete', self, 'main_menu_option') != OK:
|
||||
print('ERROR: Main Menu "complete" signal already connected.')
|
||||
|
||||
add_child(main_menu)
|
||||
return main_menu
|
||||
add_child(main_menu)
|
||||
return main_menu
|
||||
|
||||
|
||||
func main_menu_option(option: String) -> void:
|
||||
if option == 'new game':
|
||||
if get_tree().change_scene(hub_world_path) != OK:
|
||||
print('ERROR: Main failed to change scene to Hub World.')
|
||||
queue_free()
|
||||
#var level_select_menu: Node = play_level_select_menu()
|
||||
#yield(level_select_menu, 'complete')
|
||||
#free_connected_node(level_select_menu, 'level_select_menu_option')
|
||||
#level_select_menu = null
|
||||
return
|
||||
if option == 'new game':
|
||||
if get_tree().change_scene(hub_world_path) != OK:
|
||||
print('ERROR: Main failed to change scene to Hub World.')
|
||||
queue_free()
|
||||
#var level_select_menu: Node = play_level_select_menu()
|
||||
#yield(level_select_menu, 'complete')
|
||||
#free_connected_node(level_select_menu, 'level_select_menu_option')
|
||||
#level_select_menu = null
|
||||
return
|
||||
|
||||
|
||||
func play_level_select_menu() -> Node:
|
||||
var level_select_menu: Node = load(level_select_menu_path).instance()
|
||||
if level_select_menu.connect('complete', self, 'level_select_menu_option') != OK:
|
||||
print('ERROR: Level Select Menu "complete" signal already connected.')
|
||||
var level_select_menu: Node = load(level_select_menu_path).instance()
|
||||
if level_select_menu.connect('complete', self, 'level_select_menu_option') != OK:
|
||||
print('ERROR: Level Select Menu "complete" signal already connected.')
|
||||
|
||||
add_child(level_select_menu)
|
||||
return level_select_menu
|
||||
add_child(level_select_menu)
|
||||
return level_select_menu
|
||||
|
||||
|
||||
func level_select_menu_option(option: String) -> void:
|
||||
var level: String = 'res://Levels/'
|
||||
if option == 'H':
|
||||
level += 'Hub World.tscn'
|
||||
else:
|
||||
level += 'Level ' + option + '.tscn'
|
||||
var level: String = 'res://Levels/'
|
||||
if option == 'H':
|
||||
level += 'Hub World.tscn'
|
||||
else:
|
||||
level += 'Level ' + option + '.tscn'
|
||||
|
||||
new_game(level)
|
||||
return
|
||||
new_game(level)
|
||||
return
|
||||
|
||||
func free_connected_node(node: Node, connected_function: String) -> void:
|
||||
node.disconnect('complete', self, connected_function)
|
||||
node.queue_free()
|
||||
return
|
||||
node.disconnect('complete', self, connected_function)
|
||||
node.queue_free()
|
||||
return
|
||||
|
||||
|
||||
func new_game(level: String) -> void:
|
||||
if get_tree().change_scene(level) != OK:
|
||||
print('ERROR: Main failed to change scene to Level.')
|
||||
queue_free()
|
||||
return
|
||||
if get_tree().change_scene(level) != OK:
|
||||
print('ERROR: Main failed to change scene to Level.')
|
||||
queue_free()
|
||||
return
|
||||
|
BIN
Music/Hub_World.mp3
Normal file
BIN
Music/Hub_World.mp3
Normal file
Binary file not shown.
15
Music/Hub_World.mp3.import
Normal file
15
Music/Hub_World.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Hub_World.mp3-42885cef66c1c7343770523f6d96d156.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Hub_World.mp3"
|
||||
dest_files=[ "res://.import/Hub_World.mp3-42885cef66c1c7343770523f6d96d156.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_1.mp3
Normal file
BIN
Music/Level_1.mp3
Normal file
Binary file not shown.
15
Music/Level_1.mp3.import
Normal file
15
Music/Level_1.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Level_1.mp3-9039f67add638808045184c34f72f9a7.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_1.mp3"
|
||||
dest_files=[ "res://.import/Level_1.mp3-9039f67add638808045184c34f72f9a7.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_2_1.mp3
Normal file
BIN
Music/Level_2_1.mp3
Normal file
Binary file not shown.
15
Music/Level_2_1.mp3.import
Normal file
15
Music/Level_2_1.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Level_2_1.mp3-ee2c847c916154147d31f02fcb5a48e1.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_2_1.mp3"
|
||||
dest_files=[ "res://.import/Level_2_1.mp3-ee2c847c916154147d31f02fcb5a48e1.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_2_2.mp3
Normal file
BIN
Music/Level_2_2.mp3
Normal file
Binary file not shown.
15
Music/Level_2_2.mp3.import
Normal file
15
Music/Level_2_2.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Level_2_2.mp3-134340b5ecee726d2d95e042e2c114d0.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_2_2.mp3"
|
||||
dest_files=[ "res://.import/Level_2_2.mp3-134340b5ecee726d2d95e042e2c114d0.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_4.mp3
Normal file
BIN
Music/Level_4.mp3
Normal file
Binary file not shown.
15
Music/Level_4.mp3.import
Normal file
15
Music/Level_4.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Level_4.mp3-109bbc88c479a0242f45096987fd4cb3.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_4.mp3"
|
||||
dest_files=[ "res://.import/Level_4.mp3-109bbc88c479a0242f45096987fd4cb3.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_Complete.mp3
Normal file
BIN
Music/Level_Complete.mp3
Normal file
Binary file not shown.
15
Music/Level_Complete.mp3.import
Normal file
15
Music/Level_Complete.mp3.import
Normal file
@@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
path="res://.import/Level_Complete.mp3-ae5af4a1ee7128809b313389d42673b2.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_Complete.mp3"
|
||||
dest_files=[ "res://.import/Level_Complete.mp3-ae5af4a1ee7128809b313389d42673b2.mp3str" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
Music/Level_Failed.wav
Normal file
BIN
Music/Level_Failed.wav
Normal file
Binary file not shown.
21
Music/Level_Failed.wav.import
Normal file
21
Music/Level_Failed.wav.import
Normal file
@@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/Level_Failed.wav-b9c2b0727fa0fd5a5f7230cad50c2000.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Level_Failed.wav"
|
||||
dest_files=[ "res://.import/Level_Failed.wav-b9c2b0727fa0fd5a5f7230cad50c2000.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop=false
|
||||
compress/mode=0
|
174
Player/Player.gd
174
Player/Player.gd
@@ -14,137 +14,137 @@ var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_weapon_position(Vector2(1, 0))
|
||||
return
|
||||
set_weapon_position(Vector2(1, 0))
|
||||
return
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var input_vector: Vector2 = Vector2.ZERO
|
||||
var input_vector: Vector2 = Vector2.ZERO
|
||||
|
||||
input_vector.x = Input.get_action_strength('player_right') \
|
||||
- Input.get_action_strength('player_left')
|
||||
input_vector.y = Input.get_action_strength('player_down') \
|
||||
- Input.get_action_strength('player_up')
|
||||
input_vector = input_vector.normalized()
|
||||
input_vector.x = Input.get_action_strength('player_right') \
|
||||
- Input.get_action_strength('player_left')
|
||||
input_vector.y = Input.get_action_strength('player_down') \
|
||||
- Input.get_action_strength('player_up')
|
||||
input_vector = input_vector.normalized()
|
||||
|
||||
if input_vector != Vector2.ZERO:
|
||||
$AnimationTree.set('parameters/Idle/blend_position', input_vector)
|
||||
velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
|
||||
set_weapon_position(input_vector)
|
||||
else:
|
||||
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
if input_vector != Vector2.ZERO:
|
||||
$AnimationTree.set('parameters/Idle/blend_position', input_vector)
|
||||
velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
|
||||
set_weapon_position(input_vector)
|
||||
else:
|
||||
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func load_hud(node: CanvasLayer) -> void:
|
||||
hud = node
|
||||
if hud.connect('add_currency', self, 'add_currency') != OK:
|
||||
print('ERROR: HUD "add_currency" signal already connected.')
|
||||
hud = node
|
||||
if hud.connect('add_currency', self, 'add_currency') != OK:
|
||||
print('ERROR: HUD "add_currency" signal already connected.')
|
||||
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
hud.update_currency($Inventory.get_currency())
|
||||
return
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
hud.update_currency($Inventory.get_currency())
|
||||
return
|
||||
|
||||
|
||||
func set_weapon_position(pos: Vector2) -> void:
|
||||
# Facing left
|
||||
if pos[0] < 0:
|
||||
$Sword.rotation_degrees = -90
|
||||
$Javelin.rotation_degrees = -90
|
||||
# Facing left
|
||||
if pos[0] < 0:
|
||||
$Sword.rotation_degrees = -90
|
||||
$Javelin.rotation_degrees = -90
|
||||
|
||||
# Facing right
|
||||
elif pos[0] > 0:
|
||||
$Sword.rotation_degrees = 90
|
||||
$Javelin.rotation_degrees = 90
|
||||
# Facing right
|
||||
elif pos[0] > 0:
|
||||
$Sword.rotation_degrees = 90
|
||||
$Javelin.rotation_degrees = 90
|
||||
|
||||
# Facing up
|
||||
elif pos[1] < 0:
|
||||
$Sword.rotation_degrees = 0
|
||||
$Javelin.rotation_degrees = 0
|
||||
# Facing up
|
||||
elif pos[1] < 0:
|
||||
$Sword.rotation_degrees = 0
|
||||
$Javelin.rotation_degrees = 0
|
||||
|
||||
# Facing down
|
||||
elif pos[1] > 0:
|
||||
$Sword.rotation_degrees = 180
|
||||
$Javelin.rotation_degrees = 180
|
||||
return
|
||||
# Facing down
|
||||
elif pos[1] > 0:
|
||||
$Sword.rotation_degrees = 180
|
||||
$Javelin.rotation_degrees = 180
|
||||
return
|
||||
|
||||
|
||||
func add_currency(amount: int) -> void:
|
||||
$Inventory.add_currency(amount)
|
||||
return
|
||||
$Inventory.add_currency(amount)
|
||||
return
|
||||
|
||||
|
||||
func has_item(item: String) -> bool:
|
||||
return $Inventory.contains(item)
|
||||
return $Inventory.contains(item)
|
||||
|
||||
|
||||
func add_item(item: String) -> void:
|
||||
$Inventory.add(item)
|
||||
return
|
||||
$Inventory.add(item)
|
||||
return
|
||||
|
||||
|
||||
func remove_item(item: String) -> void:
|
||||
$Inventory.remove(item)
|
||||
return
|
||||
$Inventory.remove(item)
|
||||
return
|
||||
|
||||
|
||||
func _on_Inventory_update_currency(amount: int) -> void:
|
||||
hud.update_currency(amount)
|
||||
return
|
||||
hud.update_currency(amount)
|
||||
return
|
||||
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
var hit: int = 0
|
||||
var hit: int = 0
|
||||
|
||||
if area.is_in_group('enemy_hitbox_1') or area.is_in_group('enemy_projectile_1'):
|
||||
hit = 1
|
||||
elif area.is_in_group('enemy_hitbox_2') or area.is_in_group('enemy_projectile_2'):
|
||||
hit = 2
|
||||
elif area.is_in_group('enemy_hitbox_3') or area.is_in_group('enemy_projectile_3'):
|
||||
hit = 3
|
||||
elif area.is_in_group('freeze'):
|
||||
emit_signal('frozen')
|
||||
$Sprite.self_modulate = Color(0, 0.5, 1)
|
||||
else:
|
||||
return
|
||||
if area.is_in_group('enemy_hitbox_1') or area.is_in_group('enemy_projectile_1'):
|
||||
hit = 1
|
||||
elif area.is_in_group('enemy_hitbox_2') or area.is_in_group('enemy_projectile_2'):
|
||||
hit = 2
|
||||
elif area.is_in_group('enemy_hitbox_3') or area.is_in_group('enemy_projectile_3'):
|
||||
hit = 3
|
||||
elif area.is_in_group('freeze'):
|
||||
emit_signal('frozen')
|
||||
$Sprite.self_modulate = Color(0, 0.5, 1)
|
||||
else:
|
||||
return
|
||||
|
||||
if health_index != 0:
|
||||
health_index -= hit
|
||||
if health_index < 0:
|
||||
health_index = 0
|
||||
if health_index != 0:
|
||||
health_index -= hit
|
||||
if health_index < 0:
|
||||
health_index = 0
|
||||
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
else:
|
||||
if get_tree().change_scene('res://GUI/Level Failed.tscn') != OK:
|
||||
print('ERROR: Player failed to change scene to Level Failed.')
|
||||
queue_free()
|
||||
return
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
else:
|
||||
if get_tree().change_scene('res://GUI/Level Failed.tscn') != OK:
|
||||
print('ERROR: Player failed to change scene to Level Failed.')
|
||||
queue_free()
|
||||
return
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('player_attack'):
|
||||
if hud.weapon == 'sword':
|
||||
$'Sword/Sword Animation'.play('swing')
|
||||
elif hud.weapon == 'javelin':
|
||||
$'Javelin/Javelin Animation'.play('swing')
|
||||
if event.is_action_pressed('player_attack'):
|
||||
if hud.weapon == 'sword':
|
||||
$'Sword/Sword Animation'.play('swing')
|
||||
elif hud.weapon == 'javelin':
|
||||
$'Javelin/Javelin Animation'.play('swing')
|
||||
|
||||
elif event.is_action_pressed('screenshot'):
|
||||
var img: Image = get_viewport().get_texture().get_data()
|
||||
yield(get_tree(), 'idle_frame')
|
||||
yield(get_tree(), 'idle_frame')
|
||||
elif event.is_action_pressed('screenshot'):
|
||||
var img: Image = get_viewport().get_texture().get_data()
|
||||
yield(get_tree(), 'idle_frame')
|
||||
yield(get_tree(), 'idle_frame')
|
||||
|
||||
img.flip_y()
|
||||
img.flip_y()
|
||||
|
||||
var time: Dictionary = OS.get_datetime_from_unix_time(OS.get_unix_time())
|
||||
var time_msecs: int = OS.get_system_time_msecs()
|
||||
var time: Dictionary = OS.get_datetime_from_unix_time(OS.get_unix_time())
|
||||
var time_msecs: int = OS.get_system_time_msecs()
|
||||
|
||||
if img.save_png('user://Screenshot_%d%d%d_%d.png' % [time.year, time.month, time.day, time_msecs]) != OK:
|
||||
print('ERROR: Failed saving screenshot.')
|
||||
return
|
||||
if img.save_png('user://Screenshot_%d%d%d_%d.png' % [time.year, time.month, time.day, time_msecs]) != OK:
|
||||
print('ERROR: Failed saving screenshot.')
|
||||
return
|
||||
|
||||
|
||||
func _on_SlowTime_unfreeze() -> void:
|
||||
$Sprite.self_modulate = Color(1, 1, 1)
|
||||
return
|
||||
$Sprite.self_modulate = Color(1, 1, 1)
|
||||
return
|
||||
|
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
|
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
|
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
|
@@ -12,11 +12,11 @@ config_version=4
|
||||
|
||||
config/name="Embodiment"
|
||||
run/main_scene="res://Main.tscn"
|
||||
run/delta_sync_after_draw=true
|
||||
boot_splash/image="res://Sprites/Assets/Black_Background.png"
|
||||
boot_splash/use_filter=false
|
||||
boot_splash/bg_color=Color( 0, 0, 0, 1 )
|
||||
config/icon="res://Sprites/Assets/icon.png"
|
||||
run/delta_sync_after_draw=true
|
||||
|
||||
[display]
|
||||
|
||||
@@ -31,33 +31,33 @@ window/stretch/aspect="keep"
|
||||
|
||||
player_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
screenshot={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_attack={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user