added objective, added boss
50
Enemies/DemonBoss.gd
Normal file
@@ -0,0 +1,50 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
const SPEED: int = 30
|
||||
|
||||
var player: KinematicBody2D = null
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
var status = "walk"
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
|
||||
if player:
|
||||
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
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
player = area.get_parent()
|
||||
$AnimatedSprite1.animation = "Walk"
|
||||
return
|
||||
|
||||
|
||||
func _on_player_detector_area_exited(_area: Area2D):
|
||||
player = null
|
||||
$AnimatedSprite1.animation = "Idle"
|
||||
return
|
||||
|
||||
|
||||
func _on_Player_Attack_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
player = area.get_parent()
|
||||
$AnimatedSprite1.animation = "Attack"
|
||||
status = "attack"
|
||||
return
|
||||
|
||||
|
||||
func _on_Player_Attack_area_exited(area: Area2D) -> void:
|
||||
player = null
|
||||
if not status == "attack":
|
||||
$AnimatedSprite1.animation = "Walk"
|
||||
return
|
404
Enemies/DemonBoss.tscn
Normal file
@@ -0,0 +1,404 @@
|
||||
[gd_scene load_steps=68 format=2]
|
||||
|
||||
[ext_resource path="res://Resources/Level_5_Enemy_Glowing_Ghost_Occluder.tres" type="OccluderPolygon2D" id=1]
|
||||
[ext_resource path="res://Sprites/Assets/Light.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Sprites/Enemies/demon_slime_FREE_v1.0_288x160_spritesheet.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Enemies/DemonBoss.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 288, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 576, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 864, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=7]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1152, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=8]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1440, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=9]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1728, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2016, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=11]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2304, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=12]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2592, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=13]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2880, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=14]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3168, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=15]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3456, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=16]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3744, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=17]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 4032, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=18]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 4320, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=19]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 4608, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=20]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 4896, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=21]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 5184, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=22]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 5472, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=23]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 5760, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=24]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 6048, 640, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=25]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=26]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 288, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=27]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 576, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=28]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 864, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=29]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1152, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=30]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1440, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=31]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1728, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=32]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2016, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=33]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2304, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=34]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2592, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=35]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2880, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=36]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3168, 160, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=37]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=38]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 288, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=39]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 576, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=40]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 864, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=41]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1152, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=42]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1440, 0, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=43]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=44]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 288, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=45]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 576, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=46]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 864, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=47]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1152, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=48]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1440, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=49]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1728, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=50]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2016, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=51]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2304, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=52]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2592, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=53]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 2880, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=54]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3168, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=55]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3456, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=56]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 3744, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=57]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 4032, 320, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=58]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=59]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 288, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=60]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 576, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=61]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 864, 480, 288, 160 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=62]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 1152, 480, 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 ) ],
|
||||
"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 ) ],
|
||||
"loop": true,
|
||||
"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
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 3.0
|
||||
height = 2.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 50.0
|
||||
|
||||
[node name="DemonBoss" type="KinematicBody2D" groups=["enemies"]]
|
||||
collision_layer = 2
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="AnimatedSprite1" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 1, -3 )
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
frames = SubResource( 63 )
|
||||
animation = "Idle"
|
||||
playing = true
|
||||
|
||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2( 0, -3 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Player Detector" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
|
||||
scale = Vector2( 2, 2 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Player Attack" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
|
||||
[node name="Attack" type="CollisionShape2D" parent="Player Attack"]
|
||||
position = Vector2( 0, 7 )
|
||||
scale = Vector2( 1, 0.75 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Light2D" type="Light2D" parent="."]
|
||||
visible = false
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 2 )
|
||||
color = Color( 0.984314, 0.94902, 0.211765, 0.392157 )
|
||||
energy = 2.0
|
||||
range_item_cull_mask = 11
|
||||
|
||||
[node name="Light2DEyes" type="Light2D" parent="."]
|
||||
visible = false
|
||||
scale = Vector2( 0.1, 0.1 )
|
||||
texture = ExtResource( 2 )
|
||||
offset = Vector2( 5, -40 )
|
||||
range_item_cull_mask = 4
|
||||
|
||||
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
|
||||
visible = false
|
||||
show_behind_parent = true
|
||||
occluder = ExtResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="Player Detector" to="." method="_on_player_detector_area_entered"]
|
||||
[connection signal="area_exited" from="Player Detector" to="." method="_on_player_detector_area_exited"]
|
||||
[connection signal="area_entered" from="Player Attack" to="." method="_on_Player_Attack_area_entered"]
|
||||
[connection signal="area_exited" from="Player Attack" to="." method="_on_Player_Attack_area_exited"]
|
@@ -19,6 +19,7 @@ func _physics_process(_delta: float) -> void:
|
||||
func _on_player_detector_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
player = area.get_parent()
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
@@ -126,7 +126,7 @@ position = Vector2( 1, -3 )
|
||||
scale = Vector2( 0.5625, 0.5625 )
|
||||
frames = SubResource( 20 )
|
||||
animation = "Idle"
|
||||
frame = 1
|
||||
frame = 5
|
||||
playing = true
|
||||
|
||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
||||
|
@@ -1,6 +1,24 @@
|
||||
extends Node2D
|
||||
|
||||
var gems: int = 4
|
||||
|
||||
func _ready() -> void:
|
||||
#$YSort/Player.position = get_viewport_rect().size / 2
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
||||
|
||||
|
||||
func _on_TreasureChest_gem_collected() -> void:
|
||||
gems -= 1
|
||||
|
||||
if gems == 0:
|
||||
$YSort/Items/Door/doorClosed.visible = false
|
||||
$YSort/Items/Door/doorOpened.visible = true
|
||||
$DoorCollision.layers = 5
|
||||
|
||||
|
||||
|
||||
func _on_NextArea_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
$YSort/Player.position.x = 195
|
||||
$YSort/Player.position.y = -335
|
||||
|
13
Levels/Objects/Door.tscn
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/DoorOpen.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Sprites/Assets/DoorClosed.png" type="Texture" id=2]
|
||||
|
||||
[node name="Door" type="Sprite"]
|
||||
|
||||
[node name="doorClosed" type="Sprite" parent="."]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="doorOpened" type="Sprite" parent="."]
|
||||
visible = false
|
||||
texture = ExtResource( 1 )
|
24
Levels/Objects/Gem.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta: float) -> void:
|
||||
# pass
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name: String) -> void:
|
||||
$GemSprite.visible = false
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_started(anim_name: String) -> void:
|
||||
$GemSprite.visible = true
|
34
Levels/Objects/Gem.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/resources_basic.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Levels/Objects/Gem.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "rise"
|
||||
length = 1.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("GemSprite:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.3, 0.8, 1.2 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, -10 ), Vector2( 0, -18 ), Vector2( 0, -20 ) ]
|
||||
}
|
||||
|
||||
[node name="Gem" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="GemSprite" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -20 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 2, 50, 20, 20 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/rise = SubResource( 3 )
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
33
Levels/Objects/TreasureChest.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Sprite
|
||||
|
||||
var is_player_inside: bool = false
|
||||
var is_opened: bool = false
|
||||
var has_gem: bool = true
|
||||
|
||||
signal gem_collected
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta: float) -> void:
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Player_Detector_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
if is_opened == false:
|
||||
$chestClosed.visible = false
|
||||
$chestOpened.visible = true
|
||||
$Gem.visible = true
|
||||
$Gem/AnimationPlayer.play("rise")
|
||||
is_opened = true
|
||||
has_gem = false
|
||||
emit_signal("gem_collected")
|
36
Levels/Objects/TreasureChest.tscn
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Assets/treasureChestOpen.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Sprites/Assets/treasureChest.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Levels/Objects/Gem.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Levels/Objects/TreasureChest.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 21.3333, 17.3333 )
|
||||
|
||||
[node name="TreasureChest" type="Sprite" groups=["enemies"]]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="chestOpened" type="Sprite" parent="."]
|
||||
visible = false
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="chestClosed" type="Sprite" parent="."]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Gem" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
||||
[node name="Player Detector" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
input_pickable = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
|
||||
visible = false
|
||||
position = Vector2( 1, -1 )
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="Player Detector" to="." method="_on_Player_Detector_area_entered"]
|
@@ -7,6 +7,8 @@ export var FRICTION: int = 1000
|
||||
const HEALTH_SLICES: Array = [0, 18, 35, 50, 65, 82, 100]
|
||||
var health_index: int = 6
|
||||
|
||||
var l5_gems: int = 0
|
||||
|
||||
var hud: CanvasLayer = null
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
@@ -40,6 +42,7 @@ func load_hud(node: CanvasLayer) -> void:
|
||||
return
|
||||
|
||||
func set_weapon_position(pos: Vector2) -> void:
|
||||
|
||||
if pos[0] < 0: # facing left
|
||||
$SwordAnimation.position.x = -8
|
||||
$SwordAnimation.position.y = -6
|
||||
|
@@ -10,11 +10,6 @@
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": false,
|
||||
"name": "look_down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 4 ) ],
|
||||
"loop": false,
|
||||
"name": "look_up",
|
||||
@@ -22,12 +17,17 @@ animations = [ {
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": false,
|
||||
"name": "look_left",
|
||||
"name": "look_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": false,
|
||||
"name": "look_down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": false,
|
||||
"name": "look_right",
|
||||
"name": "look_left",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
|
BIN
Sprites/Assets/DoorClosed.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
35
Sprites/Assets/DoorClosed.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/DoorClosed.png-340ce2146c1723bbbb0ecf4b22bb6686.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/DoorClosed.png"
|
||||
dest_files=[ "res://.import/DoorClosed.png-340ce2146c1723bbbb0ecf4b22bb6686.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Assets/DoorOpen.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
35
Sprites/Assets/DoorOpen.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/DoorOpen.png-254ded2a22f6986dd6bf633ed69b1e9b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/DoorOpen.png"
|
||||
dest_files=[ "res://.import/DoorOpen.png-254ded2a22f6986dd6bf633ed69b1e9b.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Assets/Key.png
Normal file
After Width: | Height: | Size: 146 B |
35
Sprites/Assets/Key.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Key.png-355b2247adfc82050edc9f2df9c6440a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/Key.png"
|
||||
dest_files=[ "res://.import/Key.png-355b2247adfc82050edc9f2df9c6440a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Assets/resources_basic.png
Normal file
After Width: | Height: | Size: 34 KiB |
35
Sprites/Assets/resources_basic.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/resources_basic.png-128bab182945611297ec1bda48bed0c4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/resources_basic.png"
|
||||
dest_files=[ "res://.import/resources_basic.png-128bab182945611297ec1bda48bed0c4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Assets/treasureChest.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
35
Sprites/Assets/treasureChest.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/treasureChest.png-86b17411eece118bad038c3b29b862c9.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/treasureChest.png"
|
||||
dest_files=[ "res://.import/treasureChest.png-86b17411eece118bad038c3b29b862c9.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Assets/treasureChestOpen.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
35
Sprites/Assets/treasureChestOpen.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/treasureChestOpen.png-e2d4ac62f4d1073320b3dfdd26f9b59d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Assets/treasureChestOpen.png"
|
||||
dest_files=[ "res://.import/treasureChestOpen.png-e2d4ac62f4d1073320b3dfdd26f9b59d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|
BIN
Sprites/Enemies/demon_slime_FREE_v1.0_288x160_spritesheet.png
Normal file
After Width: | Height: | Size: 157 KiB |
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/demon_slime_FREE_v1.0_288x160_spritesheet.png-da4c04e9c38eb5ed99cae0d2f557eb77.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Enemies/demon_slime_FREE_v1.0_288x160_spritesheet.png"
|
||||
dest_files=[ "res://.import/demon_slime_FREE_v1.0_288x160_spritesheet.png-da4c04e9c38eb5ed99cae0d2f557eb77.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
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=true
|
||||
svg/scale=1.0
|