Initial commit

This commit is contained in:
2024-02-08 22:16:58 +01:00
commit 89e97a200c
524 changed files with 15626 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
extends CPUParticles2D
func _ready():
emitting = true
await get_tree().create_timer(0.8).timeout
queue_free()
pass # Replace with function body.

135
scenes/characters/Enemy.gd Normal file
View File

@@ -0,0 +1,135 @@
extends CharacterBody2D
class_name Enemy
"""
This implements a very rudimentary state machine. There are better implementations
in the AssetLib if you want to make something more complex. Also it shares code with Enemy.gd
and probably both should extend some parent script
"""
@export var WALK_SPEED: int = 350
@export var ROLL_SPEED: int = 1000
@export var hitpoints: int = 3
var despawn_fx = preload("res://scenes/misc/DespawnFX.tscn")
var linear_vel = Vector2()
@export var facing = "down" # (String, "up", "down", "left", "right")
var anim = ""
var new_anim = ""
enum { STATE_IDLE, STATE_WALKING, STATE_ATTACK, STATE_ROLL, STATE_DIE, STATE_HURT }
var state = STATE_IDLE
func _ready():
randomize()
func _physics_process(_delta):
match state:
STATE_IDLE:
new_anim = "idle_" + facing
STATE_WALKING:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
if facing == "down":
target_speed += Vector2.DOWN
if facing == "left":
target_speed += Vector2.LEFT
if facing == "right":
target_speed += Vector2.RIGHT
if facing == "up":
target_speed += Vector2.UP
target_speed *= WALK_SPEED
linear_vel = linear_vel.lerp(target_speed, 0.9)
new_anim = ""
if abs(linear_vel.x) > abs(linear_vel.y):
if linear_vel.x < 0:
facing = "left"
if linear_vel.x > 0:
facing = "right"
if abs(linear_vel.y) > abs(linear_vel.x):
if linear_vel.y < 0:
facing = "up"
if linear_vel.y > 0:
facing = "down"
if linear_vel != Vector2.ZERO:
new_anim = "walk_" + facing
else:
state = STATE_IDLE
pass
STATE_ATTACK:
new_anim = "slash_" + facing
pass
STATE_ROLL:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
if facing == "up":
target_speed.y = -1
if facing == "down":
target_speed.y = 1
if facing == "left":
target_speed.x = -1
if facing == "right":
target_speed.x = 1
target_speed *= ROLL_SPEED
linear_vel = linear_vel.lerp(target_speed, 0.9)
new_anim = "roll"
pass
STATE_DIE:
new_anim = "die"
STATE_HURT:
new_anim = "hurt"
if new_anim != anim:
anim = new_anim
$anims.play(anim)
pass
func goto_idle():
state = STATE_IDLE
func _on_state_changer_timeout():
$state_changer.wait_time = randf_range(1.0, 5.0)
#state = randi() %3
state = STATE_ATTACK
facing = ["left", "right", "up", "down"][randi()%3]
pass # Replace with function body.
func _on_hurtbox_area_entered(area):
if state != STATE_DIE and area.name == "player_sword":
hitpoints -= 1
var pushback_direction = (global_position - area.global_position).normalized()
set_velocity(pushback_direction * 5000)
move_and_slide()
state = STATE_HURT
$state_changer.start()
if hitpoints <= 0:
$state_changer.stop()
state = STATE_DIE
pass # Replace with function body.
func despawn():
var despawn_particles = despawn_fx.instantiate()
get_parent().add_child(despawn_particles)
despawn_particles.global_position = global_position
if has_node("item_spawner"):
get_node("item_spawner").spawn()
queue_free()
pass

1226
scenes/characters/Enemy.tscn Normal file

File diff suppressed because it is too large Load Diff

54
scenes/characters/Npc.gd Normal file
View File

@@ -0,0 +1,54 @@
extends Area2D
"""
It just wraps around a sequence of dialogs. If it contains a child node named 'Quest'
which should be an instance of Quest.gd it'll become a quest giver and show whatever
text Quest.process() returns
"""
var active = false
@export var character_name: String = "Nameless NPC"
@export var dialogs = ["..."] # (Array, String, MULTILINE)
var current_dialog = 0
# Called when the node enters the scene tree for the first time.
func _ready():
randomize()
# warning-ignore:return_value_discarded
body_entered.connect(_on_body_entered)
# warning-ignore:return_value_discarded
body_exited.connect(_on_body_exited)
pass # Replace with function body.
func _input(event):
# Bail if npc not active (player not inside the collider)
if not active:
return
# Bail if Dialogs singleton is showing another dialog
if Dialogs.active:
return
# Bail if the event is not a pressed "interact" action
if not event.is_action_pressed("interact"):
return
# If the character is a questgiver delegate getting the text
# to the Quest node, show it and end the function
if has_node("Quest"):
var quest_dialog = get_node("Quest").process()
if quest_dialog != "":
Dialogs.show_dialog(quest_dialog, character_name)
return
# If we reached here and there are generic dialogs to show, rotate among them
if not dialogs.is_empty():
Dialogs.show_dialog(dialogs[current_dialog], character_name)
current_dialog = wrapi(current_dialog + 1, 0, dialogs.size())
func _on_body_entered(body):
if body is Player:
active = true
func _on_body_exited(body):
if body is Player:
active = false

View File

@@ -0,0 +1,57 @@
[gd_scene load_steps=5 format=3 uid="uid://b7p1kli4j11fo"]
[ext_resource type="Script" path="res://scenes/characters/Npc.gd" id="1"]
[sub_resource type="Animation" id="1"]
resource_name = "idle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0.564087, 2.50995), Vector2(0.564087, 4.44937)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 0.944064)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k00qb"]
_data = {
"idle": SubResource("1")
}
[sub_resource type="RectangleShape2D" id="2"]
size = Vector2(163.651, 144.825)
[node name="NPC" type="Area2D"]
script = ExtResource("1")
[node name="sprite" type="Sprite2D" parent="."]
position = Vector2(0.564087, 2.50995)
offset = Vector2(3.3446, -93.3282)
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_k00qb")
}
autoplay = "idle"
[node name="trigger" type="CollisionShape2D" parent="."]
position = Vector2(0, 88.8296)
shape = SubResource("2")

203
scenes/characters/Player.gd Normal file
View File

@@ -0,0 +1,203 @@
extends CharacterBody2D
class_name Player
"""
This implements a very rudimentary state machine. There are better implementations
in the AssetLib if you want to make something more complex. Also it shares code with Enemy.gd
and probably both should extend some parent script
"""
@export var WALK_SPEED: int = 70 # pixels per second
@export var ROLL_SPEED: int = 1000 # pixels per second
@export var hitpoints: int = 3
var linear_vel = Vector2()
var roll_direction = Vector2.DOWN
signal health_changed(current_hp)
var despawn_fx = preload("res://scenes/misc/DespawnFX.tscn")
var anim = ""
var new_anim = ""
const N = Vector2.UP
const NE = Vector2(cos(1*PI/4),sin(1*PI/4))
const E = Vector2.RIGHT
const SE = Vector2(cos(7*PI/4),sin(7*PI/4))
const S = Vector2.DOWN
const SW = Vector2(cos(5*PI/4),sin(5*PI/4))
const W = Vector2.LEFT
const NW = Vector2(cos(3*PI/4),sin(3*PI/4))
enum { STATE_BLOCKED, STATE_IDLE, STATE_WALKING, STATE_ATTACK, STATE_ROLL, STATE_DIE, STATE_HURT }
@export var facing = "S" # (String, "up", "down", "left", "right")
var state = STATE_IDLE
var direction = S
# Move the player to the corresponding spawnpoint, if any and connect to the dialog system
func _ready():
var spawnpoints = get_tree().get_nodes_in_group("spawnpoints")
for spawnpoint in spawnpoints:
if spawnpoint.name == Globals.spawnpoint:
global_position = spawnpoint.global_position
break
if not (
Dialogs.dialog_started.connect(_on_dialog_started) == OK and
Dialogs.dialog_ended.connect(_on_dialog_ended) == OK ):
printerr("Error connecting to dialog system")
pass
func _physics_process(_delta):
## PROCESS STATES
match state:
STATE_BLOCKED:
# new_anim = "idle_" + facing
$anims.stop()
pass
STATE_IDLE:
if (
Input.is_action_pressed("move_down") or
Input.is_action_pressed("move_left") or
Input.is_action_pressed("move_right") or
Input.is_action_pressed("move_up")
):
state = STATE_WALKING
if Input.is_action_just_pressed("attack"):
state = STATE_ATTACK
# if Input.is_action_just_pressed("roll"):
# state = STATE_ROLL
# roll_direction = Vector2(
# - int( Input.is_action_pressed("move_left") ) + int( Input.is_action_pressed("move_right") ),
# -int( Input.is_action_pressed("move_up") ) + int( Input.is_action_pressed("move_down") )
# ).normalized()
# _update_facing()
# new_anim = "idle_" + facing
$anims.stop()
pass
STATE_WALKING:
if Input.is_action_just_pressed("attack"):
state = STATE_ATTACK
if Input.is_action_just_pressed("roll"):
state = STATE_ROLL
linear_vel = velocity
var target_speed = Vector2(0,0)
if Input.is_action_pressed("move_down"):
target_speed += Vector2.DOWN
if Input.is_action_pressed("move_left"):
target_speed += Vector2.LEFT
if Input.is_action_pressed("move_right"):
target_speed += Vector2.RIGHT
if Input.is_action_pressed("move_up"):
target_speed += Vector2.UP
target_speed = target_speed.normalized() * WALK_SPEED
target_speed.y *= 0.50 # compensa visione isometrica
#linear_vel = linear_vel.linear_interpolate(target_speed, 0.9)
linear_vel = target_speed
set_velocity(linear_vel)
roll_direction = linear_vel.normalized()
move_and_slide()
_update_facing()
if linear_vel.length() > 5:
new_anim = "walk_" + facing
$anims.play()
else:
goto_idle()
pass
STATE_ATTACK:
new_anim = "walk_" + facing # was splash_
pass
STATE_ROLL:
if roll_direction == Vector2.ZERO:
state = STATE_IDLE
else:
set_velocity(linear_vel)
move_and_slide()
linear_vel = velocity
var target_speed = Vector2()
target_speed = roll_direction
target_speed *= ROLL_SPEED
#linear_vel = linear_vel.linear_interpolate(target_speed, 0.9)
linear_vel = target_speed
new_anim = "roll"
STATE_DIE:
new_anim = "die"
STATE_HURT:
new_anim = "hurt"
## UPDATE ANIMATION
if new_anim != anim:
anim = new_anim
$anims.play(anim)
pass
func _on_dialog_started():
state = STATE_BLOCKED
func _on_dialog_ended():
state = STATE_IDLE
## HELPER FUNCS
func goto_idle():
linear_vel = Vector2.ZERO
# new_anim = "idle_" + facing
state = STATE_IDLE
func _update_facing():
if Input.is_action_pressed("move_left"):
facing = "W"
if Input.is_action_pressed("move_right"):
facing = "E"
if Input.is_action_pressed("move_up"):
facing = "N"
if Input.is_action_pressed("move_left"):
facing = "NW"
if Input.is_action_pressed("move_right"):
facing = "NE"
if Input.is_action_pressed("move_down"):
facing = "S"
if Input.is_action_pressed("move_left"):
facing = "SW"
if Input.is_action_pressed("move_right"):
facing = "SE"
func despawn():
var despawn_particles = despawn_fx.instantiate()
get_parent().add_child(despawn_particles)
despawn_particles.global_position = global_position
hide()
await get_tree().create_timer(5.0).timeout
get_tree().reload_current_scene()
pass
func _on_hurtbox_area_entered(area):
if state != STATE_DIE and area.is_in_group("enemy_weapons"):
hitpoints -= 1
emit_signal("health_changed", hitpoints)
var pushback_direction = (global_position - area.global_position).normalized()
set_velocity(pushback_direction * 5000)
move_and_slide()
state = STATE_HURT
if hitpoints <= 0:
state = STATE_DIE
pass

View File

@@ -0,0 +1,806 @@
[gd_scene load_steps=27 format=3 uid="uid://ctd3mgp0s172q"]
[ext_resource type="Script" path="res://scenes/characters/Player.gd" id="2"]
[ext_resource type="Texture2D" uid="uid://3au1pfa7jj5l" path="res://textures/kid/kid.png" id="2_rhd3n"]
[ext_resource type="PackedScene" path="res://scenes/characters/debug_character.tscn" id="3"]
[sub_resource type="CapsuleShape2D" id="1"]
radius = 9.00003
height = 42.119
[sub_resource type="Animation" id="2"]
resource_name = "die"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [9, 11, 13, 12, 9, 11, 13, 12, 9]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.7),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [true, false, true, false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"despawn"
}]
}
[sub_resource type="Animation" id="3"]
resource_name = "hurt"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(2, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(1, 1, 1, 1)]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="6"]
resource_name = "idle_E"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [154, 163]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="7"]
resource_name = "idle_N"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [22, 43]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="4"]
resource_name = "idle_S"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [88, 97]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="5"]
resource_name = "idle_W"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [11, 21]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("hurtbox:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -3.49902)]
}
[sub_resource type="Animation" id="8"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [2]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("player_sword:monitorable")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("hurtbox:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="9"]
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [15, 16, 17, 18, 19]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="10"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [0, 1, 2]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="11"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [3, 4, 5]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="12"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [3, 4, 5]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="13"]
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [6, 7, 8]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"goto_idle"
}]
}
[sub_resource type="Animation" id="Animation_qdqhh"]
resource_name = "walk_E"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [154, 175]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ef7ow"]
resource_name = "walk_N"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [22, 43]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_m2uo2"]
resource_name = "walk_NE"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [66, 87]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_bcwxc"]
resource_name = "walk_NW"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [44, 65]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ixjcm"]
resource_name = "walk_S"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [88, 109]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_fq7dv"]
resource_name = "walk_SE"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [132, 153]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_ek8m1"]
resource_name = "walk_SW"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [110, 131]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="14"]
resource_name = "walk_W"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0, 21]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:flip_h")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qdvjb"]
_data = {
"die": SubResource("2"),
"hurt": SubResource("3"),
"idle_E": SubResource("6"),
"idle_N": SubResource("7"),
"idle_S": SubResource("4"),
"idle_W": SubResource("5"),
"reset": SubResource("8"),
"roll": SubResource("9"),
"slash_down": SubResource("10"),
"slash_left": SubResource("11"),
"slash_right": SubResource("12"),
"slash_up": SubResource("13"),
"walk_E": SubResource("Animation_qdqhh"),
"walk_N": SubResource("Animation_ef7ow"),
"walk_NE": SubResource("Animation_m2uo2"),
"walk_NW": SubResource("Animation_bcwxc"),
"walk_S": SubResource("Animation_ixjcm"),
"walk_SE": SubResource("Animation_fq7dv"),
"walk_SW": SubResource("Animation_ek8m1"),
"walk_W": SubResource("14")
}
[sub_resource type="CapsuleShape2D" id="18"]
radius = 25.0
height = 80.0
[node name="Player" type="CharacterBody2D" groups=["player"]]
position = Vector2(585.638, 309.087)
script = ExtResource("2")
[node name="sprite" type="Sprite2D" parent="."]
position = Vector2(6.362, -53.087)
scale = Vector2(2, 2)
texture = ExtResource("2_rhd3n")
hframes = 22
vframes = 8
frame = 88
[node name="hitbox" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0.421509, -10.1996)
rotation = 1.5708
shape = SubResource("1")
[node name="player_sword" type="Area2D" parent="."]
visible = false
position = Vector2(6.362, -53.087)
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_qdvjb")
}
[node name="camera" type="Camera2D" parent="."]
position = Vector2(6.362, -53.087)
zoom = Vector2(0.5, 0.5)
[node name="debug" parent="." instance=ExtResource("3")]
path_to_node = NodePath("..")
properties = ["linear_vel", "roll_direction", "facing"]
enabled = false
[node name="hurtbox" type="Area2D" parent="."]
visible = false
[node name="col" type="CollisionShape2D" parent="hurtbox"]
visible = false
position = Vector2(0.362, -48.087)
shape = SubResource("18")
[connection signal="area_entered" from="hurtbox" to="." method="_on_hurtbox_area_entered"]

View File

@@ -0,0 +1,42 @@
extends CanvasLayer
"""
This can be added to any scene and be use to show some properties for debug purposes
"""
@export var path_to_node: NodePath
@export var properties = [] # (Array, String)
@export var enabled: bool = true: get = _get_enabled, set = _set_enabled
var node = null
@onready var stats = $Control/stats
# Called when the node enters the scene tree for the first time.
func _ready():
node = get_node(path_to_node)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
var output = ""
for property in properties:
if not property in node:
printerr("Property %s not found in %s" % [property, node])
properties.erase(property)
continue
output += property + ": " + str(node[property]) + "\n"
stats.text = output
pass
func _set_enabled(value):
enabled = value
if value == true:
$Control.show()
set_process(true)
else:
$Control.hide()
set_process(false)
func _get_enabled():
return enabled

View File

@@ -0,0 +1,29 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://fonts/Candy Demo.ttf" type="FontFile" id=1]
[ext_resource path="res://scenes/characters/debug_character.gd" type="Script" id=2]
[sub_resource type="FontFile" id=1]
size = 32
font_data = ExtResource( 1 )
[node name="debug" type="CanvasLayer"]
script = ExtResource( 2 )
[node name="Control" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="stats" type="Label" parent="Control"]
offset_left = 17.0
offset_top = 16.0
offset_right = 285.0
offset_bottom = 211.0
theme_override_fonts/font = SubResource( 1 )
theme_override_colors/font_color = Color( 0.803922, 0.0784314, 0.0784314, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

15
scenes/items/Item.gd Normal file
View File

@@ -0,0 +1,15 @@
extends Area2D
@export var item_type: String = "Generic Item"
@export var amount: int = 1
func _ready():
body_entered.connect(_on_Item_body_entered)
pass
func _on_Item_body_entered(body):
if body is Player:
body_entered.disconnect(_on_Item_body_entered)
Inventory.add_item(item_type, amount)
$anims.play("collected")
pass

182
scenes/items/Item.tscn Normal file
View File

@@ -0,0 +1,182 @@
[gd_scene load_steps=9 format=3 uid="uid://naq6pppaamdx"]
[ext_resource type="Texture2D" uid="uid://dswhkcoafxmtb" path="res://textures/item.png" id="1"]
[ext_resource type="Script" path="res://scenes/items/Item.gd" id="2"]
[ext_resource type="AudioStream" uid="uid://bkqm1wbxr2gg5" path="res://sounds/item_collected.wav" id="3"]
[sub_resource type="CircleShape2D" id="1"]
radius = 63.7874
[sub_resource type="Animation" id="2"]
resource_name = "collected"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("pickup:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.4),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="3"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="4"]
length = 0.3
step = 0.01
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, -26.4704), Vector2(0, -84.7684), Vector2(0, 0), Vector2(0, 0), Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("sprite:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("sprite:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2, 0.225, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(1.72, 0.159999), Vector2(0.336001, 1.448), Vector2(1, 1), Vector2(1, 1), Vector2(1.36, 0.68), Vector2(1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("sprite:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hhnq1"]
_data = {
"collected": SubResource("2"),
"reset": SubResource("3"),
"spawn": SubResource("4")
}
[node name="Item" type="Area2D" groups=["items"]]
script = ExtResource("2")
[node name="sprite" type="Sprite2D" parent="."]
visible = false
scale = Vector2(1.72, 0.159999)
texture = ExtResource("1")
offset = Vector2(0.36261, -19.2809)
[node name="hitbox" type="CollisionShape2D" parent="."]
position = Vector2(0, -13.2074)
shape = SubResource("1")
[node name="pickup" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3")
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_hhnq1")
}
autoplay = "spawn"

10
scenes/levels/Controls.gd Normal file
View File

@@ -0,0 +1,10 @@
extends Control
func _ready():
$Button.grab_focus()
pass
func _on_Button_pressed():
get_tree().change_scene_to_file("res://scenes/levels/Menu.tscn")
pass # Replace with function body.

View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/levels/Controls.gd" type="Script" id=1]
[ext_resource path="res://textures/misc/controls.png" type="Texture2D" id=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=3]
[node name="Controls" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="controls" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
[node name="Button" type="Button" parent="."]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -114.361
offset_top = 234.378
offset_right = -7.36102
offset_bottom = 283.378
theme_override_fonts/font = ExtResource( 3 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
text = "Back"
flat = true
__meta__ = {
"_editor_description_": ""
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]

240
scenes/levels/Intro.tscn Normal file
View File

@@ -0,0 +1,240 @@
[gd_scene load_steps=8 format=3 uid="uid://cqjxhlcvohevs"]
[ext_resource type="Texture2D" uid="uid://xriucyfo0o30" path="res://textures/misc/logo-bg.png" id="1"]
[ext_resource type="Texture2D" uid="uid://bc8oc41wxytr1" path="res://textures/misc/logo-logo.png" id="2"]
[ext_resource type="Texture2D" uid="uid://dqt0n5ytc0a4r" path="res://textures/misc/logo-studio.png" id="3"]
[ext_resource type="AudioStream" uid="uid://bub2p8fvv46yx" path="res://music/logo.wav" id="4"]
[sub_resource type="Animation" id="1"]
resource_name = "Intro"
length = 4.5
step = 0.01
tracks/0/type = "audio"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("logo")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"clips": [{
"end_offset": 0.219207,
"start_offset": 0.0,
"stream": ExtResource("4")
}],
"times": PackedFloat32Array(1.29)
}
tracks/0/use_blend = true
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("ColorRect:color")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.99, 1.49, 3.55, 3.99),
"transitions": PackedFloat32Array(0.5, 0.5, 1, 2, 1),
"update": 0,
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 1), Color(0, 0, 0, 0), Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("logo-logo:position")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 2, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(504, 733), Vector2(504, 733), Vector2(446, -45), Vector2(212, 109), Vector2(109, 56), Vector2(212, 109)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("logo-logo:rotation")
tracks/3/interp = 2
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("logo-logo:size")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 1.49, 1.6, 1.64, 1.67, 1.83),
"transitions": PackedFloat32Array(0, 2, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(16, 382), Vector2(16, 382), Vector2(132, 689), Vector2(600, 382), Vector2(806, 488), Vector2(600, 382)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("logo-studio:position")
tracks/5/interp = 2
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(185.667, -300.401), Vector2(185.667, -300.401), Vector2(207, -355.62), Vector2(212, 109), Vector2(196.35, 12.4492), Vector2(133, 59), Vector2(212, 109)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("logo-studio:rotation")
tracks/6/interp = 2
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 4.49367, 0.0, 0.0]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("logo-studio:size")
tracks/7/interp = 2
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 1.88, 2.01, 2.04, 2.07, 2.1, 2.13),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(652.667, 415.667), Vector2(652.667, 415.667), Vector2(611, 1452), Vector2(600, 382), Vector2(679, 432.5), Vector2(758, 483), Vector2(600, 382)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("logo-bg:position")
tracks/8/interp = 2
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(212, 491), Vector2(212, 491), Vector2(212, 109), Vector2(141, 64), Vector2(212, 109)]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("logo-bg:rotation")
tracks/9/interp = 2
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 0.0, 0.0, 0.0]
}
tracks/10/type = "value"
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/path = NodePath("logo-bg:size")
tracks/10/interp = 2
tracks/10/loop_wrap = true
tracks/10/keys = {
"times": PackedFloat32Array(0, 2.55, 2.63, 2.68, 2.74),
"transitions": PackedFloat32Array(0, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(600, 0), Vector2(600, 0), Vector2(600, 382), Vector2(742, 472), Vector2(600, 382)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_riwan"]
_data = {
"Intro": SubResource("1")
}
[sub_resource type="GDScript" id="2"]
script/source = "extends AnimationPlayer
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_anims_animation_finished(_anim_name):
get_tree().change_scene_to_file(\"res://scenes/levels/Menu.tscn\")
pass # Replace with function body.
"
[node name="Intro" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0, 0, 0, 1)
[node name="logo-bg" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -300.0
offset_top = 191.0
offset_right = 300.0
offset_bottom = 191.0
texture = ExtResource("1")
expand_mode = 1
[node name="logo-logo" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -8.0
offset_top = 433.0
offset_right = 8.0
offset_bottom = 815.0
texture = ExtResource("2")
expand_mode = 1
[node name="logo-studio" type="TextureRect" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -326.333
offset_top = -600.401
offset_right = 326.334
offset_bottom = -184.734
texture = ExtResource("3")
expand_mode = 1
[node name="logo" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4")
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_riwan")
}
autoplay = "Intro"
script = SubResource("2")
[connection signal="animation_finished" from="anims" to="anims" method="_on_anims_animation_finished"]

46
scenes/levels/Menu.gd Normal file
View File

@@ -0,0 +1,46 @@
extends Control
@export var initial_level = "" # (String, FILE, "*.tscn")
func _ready():
grab_focus()
if Globals.load_game(true):
$continue.disabled = false
else:
$continue.disabled = true
func _on_continue_pressed():
Globals.load_game()
if Globals.current_level != "":
if get_tree().change_scene_to_file(Globals.current_level) != OK:
push_error("Error changing scenes")
else:
push_error("Error: current_level shouldn't be empty")
pass # Replace with function body.
func _on_new_game_pressed():
if initial_level != "":
Globals.current_level = initial_level
if Globals.save_game() == false:
push_error("Error saving game")
var err = get_tree().change_scene_to_file(initial_level)
if err != OK:
push_error("Error changing scene: %s" % err)
else:
push_error("Error: initial_level shouldn't be empty")
pass # Replace with function body.
func _on_quit_pressed():
get_tree().quit()
pass # Replace with function body.
func _on_controls_pressed():
get_tree().change_scene_to_file("res://scenes/levels/Controls.tscn")
pass # Replace with function body.

134
scenes/levels/Menu.tscn Normal file
View File

@@ -0,0 +1,134 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=1]
[ext_resource path="res://textures/menu/game_title.png" type="Texture2D" id=2]
[ext_resource path="res://textures/menu/bg.png" type="Texture2D" id=3]
[ext_resource path="res://scenes/levels/Menu.gd" type="Script" id=4]
[node name="Menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
focus_neighbor_left = NodePath("quit")
focus_neighbor_top = NodePath("continue")
focus_neighbor_right = NodePath("credits")
focus_neighbor_bottom = NodePath("new_game")
focus_mode = 2
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
initial_level = "res://scenes/levels/Outside.tscn"
[node name="BG" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 3 )
expand = true
stretch_mode = 7
__meta__ = {
"_edit_use_anchors_": false
}
[node name="logo" type="TextureRect" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -236.0
offset_top = -185.634
offset_right = 237.0
offset_bottom = -5.63416
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
__meta__ = {
"_edit_use_anchors_": false
}
[node name="new_game" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -57.5
offset_top = 47.9168
offset_right = 57.5
offset_bottom = 96.9168
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../quit")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../continue")
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
text = "New Game"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="continue" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.5
offset_top = 123.626
offset_right = 50.5
offset_bottom = 172.626
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../new_game")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../controls")
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_disabled_color = Color( 0.780392, 0.780392, 0.780392, 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
theme_override_colors/font_hover_color = Color( 0.364706, 0.364706, 0.364706, 1 )
disabled = true
text = "Continue"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="controls" type="Button" parent="."]
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -114.361
offset_top = 234.378
offset_right = -13.3615
offset_bottom = 283.378
focus_neighbor_left = NodePath("../quit")
focus_neighbor_top = NodePath("../continue")
focus_neighbor_right = NodePath("../quit")
focus_neighbor_bottom = NodePath("../new_game")
theme_override_fonts/font = ExtResource( 1 )
text = "Controls"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="quit" type="Button" parent="."]
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 12.9543
offset_top = -69.3568
offset_right = 113.954
offset_bottom = -20.3568
focus_neighbor_left = NodePath("../controls")
focus_neighbor_top = NodePath("../continue")
focus_neighbor_right = NodePath("../controls")
focus_neighbor_bottom = NodePath("../new_game")
theme_override_fonts/font = ExtResource( 1 )
text = "Quit"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="new_game" to="." method="_on_new_game_pressed"]
[connection signal="pressed" from="continue" to="." method="_on_continue_pressed"]
[connection signal="pressed" from="controls" to="." method="_on_controls_pressed"]
[connection signal="pressed" from="quit" to="." method="_on_quit_pressed"]

View File

@@ -0,0 +1,53 @@
[gd_scene load_steps=6 format=3 uid="uid://c5oh2rmcwksmt"]
[ext_resource type="TileSet" uid="uid://c2mhyv81hyxbt" path="res://scenes/tilesets/castle.tres" id="3_ojvwt"]
[ext_resource type="PackedScene" uid="uid://cixovgrvqr2p2" path="res://scenes/props/tree6.tscn" id="4_f0l61"]
[ext_resource type="PackedScene" uid="uid://dvmm1keyq3r5c" path="res://scenes/props/tree2.tscn" id="4_f5et7"]
[ext_resource type="PackedScene" uid="uid://ctd3mgp0s172q" path="res://scenes/characters/Player.tscn" id="5_7pfs4"]
[ext_resource type="PackedScene" uid="uid://deqgnj30xx13t" path="res://scenes/misc/UI.tscn" id="14_jp8qw"]
[node name="test_scene" type="Node"]
[node name="level" type="Node2D" parent="."]
y_sort_enabled = true
position = Vector2(208, 82)
[node name="TileMap" type="TileMap" parent="level"]
y_sort_enabled = true
position = Vector2(1407, 792)
tile_set = ExtResource("3_ojvwt")
format = 2
layer_0/name = "base"
layer_0/y_sort_enabled = true
layer_0/tile_data = PackedInt32Array(-2, 0, 0, 65534, 0, 0, 131070, 65536, 0, 65533, 0, 0, 196606, 0, 0, 262142, 65536, 0, -65539, 0, 0, -3, 0, 0, -65540, 0, 0, -131075, 0, 0, -1, 0, 0, -65538, 0, 0, -131074, 0, 0, -196611, 0, 0, -4, 0, 0, 65532, 0, 0, 131069, 0, 0, 196605, 65536, 0, 131071, 0, 0, 65535, 0, 0, -65536, 65536, 0, -65537, 65536, 0, -131073, 65536, 0, -196610, 65536, 0, -262146, 0, 0, 65531, 65536, 0, 131068, 65536, 0, 196604, 65536, 0, 327676, 65536, 0, 262140, 65536, 0, 262141, 65536, 0, 196603, 65536, 0, 131067, 65536, 0, 65530, 65536, 0, -5, 65536, 0, -65541, 0, 0, -131076, 0, 0, -196612, 0, 0, 327677, 65536, 0, 327678, 65536, 0, 393213, 65536, 0, 458748, 65536, 0, 393214, 65536, 0, 458750, 0, 0, 393215, 65536, 0, 524285, 65536, 0, 458749, 65536, 0, 327675, 65536, 0, 393212, 65536, 0, 262139, 65536, 0, 327674, 0, 0, 393211, 65536, 0, 458746, 65536, 0, 524283, 65536, 0, 589819, 65536, 0, 655356, 65536, 0, 589820, 65536, 0, 458747, 65536, 0, 524284, 65536, 0, 131066, 65536, 0, 196602, 65536, 0, 262138, 65536, 0, 196601, 0, 0, 327673, 65536, 0, 393210, 0, 0, -65542, 65536, 0, -131078, 65536, 0, -65543, 65536, 0, -6, 65536, 0, -131077, 65536, 0, -196614, 0, 0, -262149, 65536, 0, -196613, 0, 0, -262148, 65536, 0, -327685, 0, 0, 262143, 65536, 0, 327679, 65536, 0, 196608, 0, 0, 196607, 65536, 0, 327680, 0, 0, 262144, 0, 0, 131072, 0, 0, 65536, 0, 0, 0, 65536, 0, 65537, 65536, 0, 524287, 65536, 0, 589822, 65536, 0, 655359, 65536, 0, 589823, 65536, 0, 458752, 65536, 0, 458751, 65536, 0, 524286, 65536, 0, -262147, 65536, 0, -327683, 65536, 0, -393218, 65536, 0, -327682, 65536, 0, -262145, 65536, 0, -196608, 65536, 0, -131072, 65536, 0, -196609, 65536, 0, 393216, 0, 0, 393217, 0, 0, 393218, 65536, 0, 393219, 65536, 0, 327683, 65536, 0, 262147, 65536, 0, 262146, 65536, 0, 262145, 65536, 0, 327681, 65536, 0, 196609, 0, 0, 131073, 0, 0, 196610, 0, 0, 131074, 0, 0, 1, 65536, 0, -65535, 65536, 0, -65534, 65536, 0, 2, 0, 0, 65538, 0, 0, 65539, 65536, 0, 131075, 65536, 0, 327682, 65536, 0, 524288, 65536, 0, 458753, 65536, 0, 589821, 65536, 0, 655357, 65536, 0, 655358, 65536, 0, 393209, 65536, 0, 458745, 65536, 0, 524281, 65536, 0, 524282, 65536, 0, 589818, 65536, 0, 262137, 65536, 0, 131065, 0, 0, 65529, 0, 0, -7, 0, 0, 131064, 65536, 0, 65528, 0, 0, -8, 0, 0, 196600, 65536, 0, 262136, 65536, 0, 327672, 65536, 0, -131079, 65536, 0, -65544, 0, 0, 196611, 65536, 0, -65545, 0, 0, -131081, 0, 0, -196617, 0, 0, -196616, 0, 0, -196615, 0, 0, -262150, 0, 0, 589824, 0, 0, 655353, 0, 0, 655354, 0, 0, 655355, 0, 0, -262151, 0, 0, -327687, 0, 0, -327686, 0, 0, -327684, 0, 0, -393219, 0, 0, -131080, 0, 0, 196599, 0, 0, 131063, 0, 0, 65527, 0, 0, -9, 0, 0, -10, 0, 0, -65546, 0, 0, 65526, 0, 0, 131062, 0, 0, -393223, 0, 0, -458759, 0, 0, -458758, 0, 0, -393222, 0, 0, -393221, 0, 0, -458757, 0, 0, -393220, 0, 0, -458756, 0, 0, -327688, 0, 0, -393224, 0, 0, -458760, 0, 0, 655352, 0, 0, 589817, 0, 0, 589816, 0, 0, 524280, 0, 0, 458744, 0, 0, 393208, 0, 0, 327671, 0, 0, 262135, 0, 0, 262134, 0, 0, 196598, 0, 0)
layer_1/name = "wall"
layer_1/y_sort_enabled = true
layer_1/z_index = 1
layer_1/tile_data = PackedInt32Array(655356, 2, 3, 655357, 2, 3, 655358, 2, 3, 655359, 2, 3, 589824, 2, 3, 524288, 2, 3, 458752, 2, 3, 458753, 2, 3, -131080, 2, 3, -6, 65538, 3, 589817, 2, 3, 655353, 2, 3, 655352, 2, 3, 589816, 2, 3, 524280, 2, 3, 458744, 2, 3, 393208, 2, 3, 393207, 2, 3, 327671, 2, 3, 262135, 2, 3, -65546, 2, 3, -131082, 2, 3, -196618, 2, 3, -262154, 2, 3, -262153, 2, 3, -262152, 2, 3, 196598, 2, 3, 131062, 2, 3, 65526, 2, 3, -10, 2, 3, 655355, 65538, 3, -4, 65538, 3, 393218, 65538, 3, 393219, 65538, 3, 327683, 65538, 3, 262147, 65538, 3, 196611, 65538, 3, 131075, 65538, 3, 65539, 65538, 3, 2, 65538, 3, -65534, 65538, 3, -65535, 65538, 3, -196609, 65538, 3, -262145, 65538, 3, -327682, 65538, 3, -393218, 65538, 3, -393219, 65538, 3, -393224, 65538, 3, -327688, 65538, 3, -458760, 65538, 3, -458759, 65538, 3, -458758, 65538, 3, -458757, 65538, 3, -458756, 65538, 3, -2, 65538, 3, -8, 65538, 3)
[node name="Character" parent="level" instance=ExtResource("5_7pfs4")]
z_index = 1
position = Vector2(1009, 772)
[node name="Trees" type="Node2D" parent="level"]
z_index = 1
y_sort_enabled = true
[node name="Tree3" parent="level/Trees" instance=ExtResource("4_f0l61")]
position = Vector2(1385, 434)
scale = Vector2(1.4, 1.4)
[node name="Tree2" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(844, 606)
scale = Vector2(1.3, 1.3)
[node name="Tree4" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(1231, 1053)
scale = Vector2(1.3, 1.3)
[node name="Tree5" parent="level/Trees" instance=ExtResource("4_f5et7")]
position = Vector2(1608, 740)
scale = Vector2(1.3, 1.3)
[node name="UI" parent="." instance=ExtResource("14_jp8qw")]
visible = false

View File

@@ -0,0 +1,34 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/characters/DespawnFx.gd" type="Script" id=1]
[ext_resource path="res://textures/pj/smoke_particle.png" type="Texture2D" id=2]
[sub_resource type="Curve" id=1]
min_value = -360.0
max_value = 360.0
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Curve" id=2]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.383915, 0.8806 ), -1.68353, -1.68353, 0, 0, Vector2( 1, 0.0885999 ), -0.00244711, 0.0, 0, 0 ]
[node name="despawn_fx" type="CPUParticles2D"]
position = Vector2( 443.999, 413.999 )
emitting = false
amount = 16
lifetime = 0.5
one_shot = true
explosiveness = 1.0
texture = ExtResource( 2 )
direction = Vector2( 0, -1 )
gravity = Vector2( 0, 0 )
initial_velocity = 1500.0
initial_velocity_random = 0.5
angular_velocity = 360.0
angular_velocity_random = 1.0
angular_velocity_curve = SubResource( 1 )
linear_accel = -5000.0
linear_accel_random = 0.2
damping = 100.0
scale_amount_random = 0.5
scale_amount_curve = SubResource( 2 )
script = ExtResource( 1 )

43
scenes/misc/Dialog_box.gd Normal file
View File

@@ -0,0 +1,43 @@
extends TextureRect
class_name DialogBox
"""
Exposes the show_dialog function to the Dialogs singleton.
Will show a dialog box with the name of the character and
dialog text, two lines at a time.
"""
@onready var dialog_text = $dialog_text
# warning-ignore:unused_signal
signal dialog_started
# warning-ignore:unused_signal
signal dialog_ended
var lines_to_skip = 0
func _ready():
Dialogs.dialog_box = self
hide()
pass # Replace with function body.
func show_dialog(new_text, speaker):
dialog_text.text = new_text
$nametag/label.text = speaker
lines_to_skip = 0
dialog_text.lines_skipped = lines_to_skip
$anims.play("appear")
pass
func _input(event):
if event.is_action_pressed("interact"):
match $anims.assigned_animation:
"show_text":
$anims.play("wait")
"wait":
lines_to_skip += 2
if lines_to_skip < dialog_text.get_line_count():
dialog_text.lines_skipped = lines_to_skip
$anims.play("show_text")
else:
$anims.play("disappear")

277
scenes/misc/Dialog_box.tscn Normal file
View File

@@ -0,0 +1,277 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=1]
[ext_resource path="res://scenes/misc/Dialog_box.gd" type="Script" id=2]
[ext_resource path="res://textures/misc/dialog_box.png" type="Texture2D" id=3]
[ext_resource path="res://textures/misc/next_dialog_arrow.png" type="Texture2D" id=4]
[sub_resource type="Animation" id=1]
resource_name = "appear"
length = 0.1
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("dialog_text:visible_characters")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ 0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath(".:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ true ]
}
tracks/3/type = "method"
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "dialog_started" ],
"method": "emit_signal"
} ]
}
tracks/4/type = "value"
tracks/4/path = NodePath(".:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PackedFloat32Array( 0.00472333, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 585 ), Vector2( 0, 427 ) ]
}
tracks/5/type = "method"
tracks/5/path = NodePath("dialog_text")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PackedFloat32Array( 0.1 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "resized" ],
"method": "emit_signal"
} ]
}
[sub_resource type="Animation" id=2]
resource_name = "disappear"
length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0.1 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "method"
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"values": [ {
"args": [ "dialog_ended" ],
"method": "emit_signal"
} ]
}
tracks/3/type = "value"
tracks/3/path = NodePath(".:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PackedFloat32Array( 0, 0.1 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 427 ), Vector2( 0, 582 ) ]
}
[sub_resource type="Animation" id=3]
length = 2.0
tracks/0/type = "value"
tracks/0/path = NodePath("dialog_text:visible_characters")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 2 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ 0, 150 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("next_dialog_arrow:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("next_dialog_arrow:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.5 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("dialog_text:visible_characters")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"update": 1,
"values": [ 150 ]
}
[node name="Dialog_box" type="TextureRect"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -173.0
offset_bottom = 1.00024
texture = ExtResource( 3 )
expand = true
stretch_mode = 6
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="dialog_text" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 54.0
offset_top = 45.0
offset_right = -58.0
offset_bottom = -38.0
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper molestie erat, id aliquam nulla iaculis a. Suspendisse consectetur vehicula consequat. Integer mollis libero sed sem convallis, vitae rutrum metus dapibus. Phasellus purus quam, euismod id diam ut, semper sagittis ipsum. Aenean vel mollis lectus, quis placerat eros. Donec elementum vestibulum augue dignissim vehicula. Mauris ultricies lacus id odio aliquet, eu iaculis urna sodales. "
autowrap = true
clip_text = true
percent_visible = 0.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="next_dialog_arrow" type="TextureRect" parent="."]
visible = false
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -121.545
offset_top = -52.964
offset_right = -66.5452
offset_bottom = -6.96399
texture = ExtResource( 4 )
expand = true
stretch_mode = 6
__meta__ = {
"_edit_use_anchors_": false
}
[node name="nametag" type="TextureRect" parent="."]
offset_left = 31.0
offset_top = 1.0
offset_right = 524.0
offset_bottom = 45.0
texture = ExtResource( 3 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label" type="Label" parent="nametag"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -227.5
offset_top = -21.0
offset_right = 227.5
offset_bottom = 22.0
theme_override_fonts/font = ExtResource( 1 )
theme_override_colors/font_color = Color( 0, 0, 0, 1 )
text = "Character Name"
align = 1
clip_text = true
[node name="anims" type="AnimationPlayer" parent="."]
anims/appear = SubResource( 1 )
anims/disappear = SubResource( 2 )
anims/show_text = SubResource( 3 )
anims/wait = SubResource( 4 )
next/appear = "show_text"
next/show_text = "wait"

25
scenes/misc/Exit.gd Normal file
View File

@@ -0,0 +1,25 @@
extends Area2D
class_name Exit
"""
Add this to any area2d and it will send the player to the indicated scene and spawnpoint
"""
@export var to_scene = "" # (String, FILE, "*.tscn")
@export var spawnpoint: String = ""
# Called when the node enters the scene tree for the first time.
func _ready():
body_entered.connect(_on_body_entered, CONNECT_DEFERRED)
func _on_body_entered(body):
if body is Player:
if to_scene == "":
push_error("Error changing scenes: to_scene has no assigned scene")
return false
Globals.spawnpoint = spawnpoint
Globals.current_level = to_scene
if get_tree().change_scene_to_file(to_scene) != OK:
push_error("Error changing scene")
pass

31
scenes/misc/Healthbar.gd Normal file
View File

@@ -0,0 +1,31 @@
extends HBoxContainer
"""
Connects to the player node and shows a health bar in the form of hearts
"""
var player : Player = null
var heart_scene = preload("res://scenes/misc/Heart.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
# Try to get the player node. If null wait till next frame, rinse, repeat.
while (player == null):
var player_group = get_tree().get_nodes_in_group("player")
if not player_group.is_empty():
player = player_group.pop_front()
else:
await get_tree().idle_frame
player.health_changed.connect(_on_health_changed)
_on_health_changed(player.hitpoints)
pass # Replace with function body.
# You should probably rewrite this.
func _on_health_changed(new_hp):
for child in get_children():
child.queue_free()
for i in new_hp:
var heart = heart_scene.instantiate()
add_child(heart)

View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/misc/Healthbar.gd" type="Script" id=1]
[node name="Healthbar" type="HBoxContainer"]
offset_left = 8.0
offset_top = 11.0
offset_right = 115.0
offset_bottom = 39.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

8
scenes/misc/Heart.tscn Normal file
View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://dbue8p0cttono"]
[ext_resource type="Texture2D" uid="uid://d0ixmmo0xq2ua" path="res://textures/misc/heart.png" id="1"]
[node name="heart" type="TextureRect"]
offset_right = 33.0
offset_bottom = 28.0
texture = ExtResource("1")

View File

@@ -0,0 +1,19 @@
extends Marker2D
"""
Add this to any node. spawn instances an Item.tscn node with the defined values
"""
var item_scene = preload("res://scenes/items/Item.tscn")
@export var item_type: String = "Generic Item"
@export var amount: int = 1
func spawn():
var item = item_scene.instantiate()
owner.get_parent().add_child(item)
item.global_position = global_position
item.item_type = item_type
item.amount = amount
pass

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/misc/ItemSpawner.gd" type="Script" id=1]
[node name="item_spawner" type="Marker2D"]
script = ExtResource( 1 )

View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends Node
\"\"\"
Add this to any level and it'll start playing the indicated song
as soon as the level loads
\"\"\"
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
@export var music_track = \"\" # (String, FILE, \"*.ogg\")
# Called when the node enters the scene tree for the first time.
func _ready():
if music_track != \"\":
Music.play(music_track)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
"
[node name="music_track" type="Node"]
script = SubResource( 1 )

40
scenes/misc/Quest.gd Normal file
View File

@@ -0,0 +1,40 @@
extends Node
"""
Instance this as a child of any Npc.tscn node and it turns into a
quest giver.
The character will also check if the player has a certain amount of a given item and if true
Remove said amount from the players inventory and give some amount of another item as a reward
This is only useful for fetch quests but you can also ask for '5 demon horns' or something to turn it
into a kill quest.
Otherwise you'll have to make a quest system a bit more complex.
"""
@export var quest_name: String = "Life as a Rappi Guy"
@export var required_item: String = "Generic Item"
@export var required_amount: int = 10
@export var reward_item: String = "Generic Reward"
@export var reward_amount: int = 1
@export var initial_text = "TLDR; bring me 10 thingies" # (String, MULTILINE)
@export var pending_text = "You forgot? I want 10 thingies" # (String, MULTILINE)
@export var delivered_text = "Thank you! Here's your reward.." # (String, MULTILINE)
func process() -> String:
var quest_status = Quest.get_status(quest_name)
match quest_status:
Quest.STATUS.NONEXISTENT:
Quest.accept_quest(quest_name)
return initial_text
Quest.STATUS.STARTED:
if Inventory.get_item(required_item) >= required_amount:
Inventory.remove_item(required_item, required_amount)
Quest.change_status(quest_name, Quest.STATUS.COMPLETE)
Inventory.add_item(reward_item, reward_amount)
return delivered_text
else:
return pending_text
_:
return ""

6
scenes/misc/Quest.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dwu2tlrkse1kh"]
[ext_resource type="Script" path="res://scenes/misc/Quest.gd" id="1"]
[node name="Quest" type="Node"]
script = ExtResource("1")

54
scenes/misc/Stats.gd Normal file
View File

@@ -0,0 +1,54 @@
extends PanelContainer
var enabled = false
func _ready():
Globals.save_game()
get_tree().set_auto_accept_quit(false)
hide()
func _input(event):
if event.is_action_pressed("pause"):
enabled = !enabled
visible = enabled
get_tree().paused = enabled
if enabled:
grab_focus()
_update_quest_listing()
_update_item_listing()
func _update_quest_listing():
var text = ""
text += "Started:\n"
for quest in Quest.list(Quest.STATUS.STARTED):
text += " %s\n" % quest
text += "Failed:\n"
for quest in Quest.list(Quest.STATUS.FAILED):
text += " %s\n" % quest
$VBoxContainer/HBoxContainer/Quests/Details.text = text
pass
func _update_item_listing():
var text = ""
var inventory = Inventory.list()
if inventory.is_empty():
text += "[Empty]"
for item in inventory:
text += "%s x %s\n" % [item, inventory[item]]
$VBoxContainer/HBoxContainer/Inventory/Details.text = text
pass
func _on_Exit_pressed():
quit_game()
pass # Replace with function body.
func _notification(what):
if what == NOTIFICATION_WM_CLOSE_REQUEST:
quit_game()
func quit_game():
Globals.save_game()
get_tree().quit()

101
scenes/misc/Stats.tscn Normal file
View File

@@ -0,0 +1,101 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/misc/Stats.gd" type="Script" id=1]
[ext_resource path="res://fonts/dialog.tres" type="FontFile" id=2]
[ext_resource path="res://fonts/stats.tres" type="FontFile" id=3]
[ext_resource path="res://scenes/misc/stats.stylebox" type="StyleBox" id=4]
[node name="Stats" type="PanelContainer"]
process_mode = 3
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
focus_neighbor_top = NodePath("VBoxContainer/Exit")
focus_neighbor_bottom = NodePath("VBoxContainer/Exit")
focus_mode = 2
theme_override_styles/panel = ExtResource( 4 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_left = 20.0
offset_top = 20.0
offset_right = 1004.0
offset_bottom = 580.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Paused" type="Label" parent="VBoxContainer"]
offset_right = 984.0
offset_bottom = 43.0
theme_override_fonts/font = ExtResource( 2 )
text = "Paused"
align = 1
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
offset_top = 47.0
offset_right = 984.0
offset_bottom = 507.0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
[node name="Quests" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
offset_right = 490.0
offset_bottom = 460.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Title" type="Label" parent="VBoxContainer/HBoxContainer/Quests"]
offset_right = 490.0
offset_bottom = 43.0
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource( 2 )
text = "Quests"
align = 1
[node name="Details" type="Label" parent="VBoxContainer/HBoxContainer/Quests"]
offset_top = 47.0
offset_right = 490.0
offset_bottom = 460.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_fonts/font = ExtResource( 3 )
text = "Quest 1
Quest 2
Quest 3
Quest 4"
[node name="Inventory" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
offset_left = 494.0
offset_right = 984.0
offset_bottom = 460.0
size_flags_horizontal = 3
[node name="Title" type="Label" parent="VBoxContainer/HBoxContainer/Inventory"]
offset_right = 490.0
offset_bottom = 43.0
theme_override_fonts/font = ExtResource( 2 )
text = "Inventory"
align = 1
[node name="Details" type="Label" parent="VBoxContainer/HBoxContainer/Inventory"]
offset_top = 47.0
offset_right = 490.0
offset_bottom = 460.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_fonts/font = ExtResource( 3 )
text = "Item 1
"
[node name="Exit" type="Button" parent="VBoxContainer"]
offset_top = 511.0
offset_right = 984.0
offset_bottom = 560.0
theme_override_fonts/font = ExtResource( 2 )
text = "EXIT"
flat = true
[connection signal="pressed" from="VBoxContainer/Exit" to="." method="_on_Exit_pressed"]

48
scenes/misc/StatusText.gd Normal file
View File

@@ -0,0 +1,48 @@
extends Label
"""
Connects to the inventory and quest systems and will show a message on screen
for every change in either
"""
var messages = []
func _ready():
hide()
Quest.quest_changed.connect(_questlog_updated)
Inventory.item_changed.connect(_inventory_updated)
func _questlog_updated(quest_name, status):
var txt
match status:
Quest.STATUS.STARTED:
txt = "Quest aquired: %s." % quest_name
Quest.STATUS.COMPLETE:
txt = "Quest complete! %s." % quest_name
_queue_message(txt)
pass
func _inventory_updated(action, type, amount):
var txt
match action:
"added":
txt = "Obtained %s x %s" % [type, amount]
"removed":
txt = "Lost %s x %s" % [type, amount]
_queue_message(txt)
pass
func _queue_message(p_text):
messages.push_back(p_text)
if not $anims.is_playing():
_play_next()
pass
func _play_next():
if messages.is_empty():
return
else:
text = messages.pop_front()
$anims.queue("update")

View File

@@ -0,0 +1,76 @@
[gd_scene load_steps=5 format=3 uid="uid://iu0aegkhj8po"]
[ext_resource type="FontFile" path="res://fonts/stats.tres" id="1"]
[ext_resource type="Script" path="res://scenes/misc/StatusText.gd" id="2"]
[sub_resource type="Animation" id="1"]
resource_name = "update"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"_play_next"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jtjwp"]
_data = {
"update": SubResource("1")
}
[node name="Status_text" type="Label"]
modulate = Color(1, 1, 1, 0)
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = 90.609
offset_bottom = 121.609
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("1")
text = "Got x thingie"
script = ExtResource("2")
[node name="ColorRect" type="ColorRect" parent="."]
visible = false
show_behind_parent = true
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0, 0, 0, 0.784314)
[node name="anims" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_jtjwp")
}

View File

@@ -0,0 +1,27 @@
extends Node2D
func _ready():
Dialogs.dialog_started.connect(_on_dialog_started)
Dialogs.dialog_ended.connect(_on_dialog_ended)
func _on_dialog_started():
for child in get_children():
child.hide()
$interact.show()
func _on_dialog_ended():
for child in get_children():
child.show()
func _notification(what):
if what == NOTIFICATION_PAUSED:
for child in get_children():
child.hide()
$stats.show()
elif what == NOTIFICATION_UNPAUSED:
for child in get_children():
child.show()

71
scenes/misc/UI.tscn Normal file
View File

@@ -0,0 +1,71 @@
[gd_scene load_steps=8 format=3 uid="uid://deqgnj30xx13t"]
[ext_resource type="PackedScene" path="res://scenes/misc/Dialog_box.tscn" id="1"]
[ext_resource type="PackedScene" path="res://scenes/misc/Stats.tscn" id="2"]
[ext_resource type="PackedScene" uid="uid://iu0aegkhj8po" path="res://scenes/misc/StatusText.tscn" id="3"]
[ext_resource type="PackedScene" path="res://scenes/misc/Healthbar.tscn" id="4"]
[ext_resource type="Script" path="res://scenes/misc/TouchInterface.gd" id="7"]
[ext_resource type="Texture2D" uid="uid://bf8tm281iqk3u" path="res://textures/misc/arrow.png" id="10"]
[sub_resource type="RectangleShape2D" id="1"]
size = Vector2(60, 200)
[node name="UI" type="CanvasLayer"]
[node name="Dialog_box" parent="." instance=ExtResource("1")]
visible = false
anchors_preset = 12
offset_top = -128.0
offset_bottom = 46.0002
grow_horizontal = 2
grow_vertical = 0
expand_mode = 1
[node name="Stats" parent="." instance=ExtResource("2")]
anchors_preset = 15
[node name="Status_text" parent="." instance=ExtResource("3")]
visible = false
[node name="Healthbar" parent="." instance=ExtResource("4")]
visible = false
offset_right = 14.0
[node name="TouchInterface" type="Node2D" parent="."]
modulate = Color(1, 1, 1, 0.501961)
script = ExtResource("7")
[node name="right" type="TouchScreenButton" parent="TouchInterface"]
position = Vector2(176.899, 410.258)
texture_normal = ExtResource("10")
shape = SubResource("1")
passby_press = true
action = "move_right"
visibility_mode = 1
[node name="up" type="TouchScreenButton" parent="TouchInterface"]
position = Vector2(105.679, 427.331)
rotation = -1.5708
texture_normal = ExtResource("10")
shape = SubResource("1")
passby_press = true
action = "move_up"
visibility_mode = 1
[node name="left" type="TouchScreenButton" parent="TouchInterface"]
position = Vector2(123.46, 497.427)
rotation = -3.14159
texture_normal = ExtResource("10")
shape = SubResource("1")
passby_press = true
action = "move_left"
visibility_mode = 1
[node name="down" type="TouchScreenButton" parent="TouchInterface"]
position = Vector2(193.923, 480.742)
rotation = 1.5708
texture_normal = ExtResource("10")
shape = SubResource("1")
passby_press = true
action = "move_down"
visibility_mode = 1

BIN
scenes/misc/stats.stylebox Normal file

Binary file not shown.

17
scenes/props/Flower.tscn Normal file
View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://rxbg6txo6ra3"]
[ext_resource type="Texture2D" uid="uid://dfjvvu4bnvjtn" path="res://textures/props/flower.png" id="1"]
[sub_resource type="CapsuleShape2D" id="1"]
radius = 59.1005
height = 118.201
[node name="flower" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1")
offset = Vector2(-16.3217, -449.143)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource("1")

17
scenes/props/Grass.tscn Normal file
View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://b2dp0fncyk58i"]
[ext_resource type="Texture2D" uid="uid://bmrcwkl01eu6p" path="res://textures/props/grass.png" id="1"]
[sub_resource type="CircleShape2D" id="1"]
radius = 47.725
[node name="grass" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-2.4895, 2.17053)
texture = ExtResource("1")
offset = Vector2(36.3788, -295.101)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource("1")

51
scenes/props/House.tscn Normal file
View File

@@ -0,0 +1,51 @@
[gd_scene load_steps=7 format=3 uid="uid://b1584avscjr3a"]
[ext_resource type="Script" path="res://scenes/misc/Exit.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://crlqbtn4qydow" path="res://textures/props/house.png" id="2"]
[sub_resource type="GDScript" id="1"]
script/source = "extends StaticBody2D
@export var to_scene = \"\" # (String, FILE, \"*.tscn\")
@export var spawnpoint: String = \"\"
func _ready():
$to_inside.to_scene = to_scene
$to_inside.spawnpoint = spawnpoint
pass # Replace with function body.
"
[sub_resource type="CapsuleShape2D" id="2"]
radius = 95.0118
height = 1077.65
[sub_resource type="CapsuleShape2D" id="3"]
radius = 190.939
height = 457.882
[sub_resource type="RectangleShape2D" id="4"]
size = Vector2(234.622, 129.451)
[node name="house" type="StaticBody2D"]
script = SubResource("1")
[node name="house" type="Sprite2D" parent="."]
texture = ExtResource("2")
offset = Vector2(-216.037, -247.153)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-223.046, -54.2205)
rotation = 1.5708
shape = SubResource("2")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
position = Vector2(-190.854, -159.045)
rotation = 1.5708
shape = SubResource("3")
[node name="to_inside" type="Area2D" parent="."]
position = Vector2(7.79211, 0.0572205)
script = ExtResource("1")
[node name="CollisionShape2D" type="CollisionShape2D" parent="to_inside"]
shape = SubResource("4")

View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://textures/props/mushroom_big.png" type="Texture2D" id=1]
[sub_resource type="CapsuleShape2D" id=1]
radius = 70.8635
height = 111.039
[node name="mushroom_big" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource( 1 )
offset = Vector2( -20.473, -311.75 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( 1 )

View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://textures/props/mushroom_small.png" type="Texture2D" id=1]
[sub_resource type="CircleShape2D" id=1]
radius = 71.6791
[node name="mushroom_small" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource( 1 )
offset = Vector2( 0.914429, -61.8737 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 1.08072, -26.4776 )
rotation = 1.5708
shape = SubResource( 1 )

16
scenes/props/Table.tscn Normal file
View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://textures/props/table.png" type="Texture2D" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 435.46, 122.844 )
[node name="table" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource( 1 )
offset = Vector2( 0.914429, -61.8737 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 2.44107, -42.8021 )
shape = SubResource( 1 )

15
scenes/props/tree2.tscn Normal file
View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=3 uid="uid://dvmm1keyq3r5c"]
[ext_resource type="Texture2D" uid="uid://5d715y37mn8g" path="res://textures/tree2s.png" id="1_6wcui"]
[node name="Tree2" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-3, -119)
texture = ExtResource("1_6wcui")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
visible = false
z_index = 1
position = Vector2(-2, 10)
polygon = PackedVector2Array(-17, 6, -40, 3, -26, -10, -52, -10, -55, -19, -35, -34, 47, -33, 60, -19, 57, -12, 30, -11, 26, -6, 40, -3, 43, 2, 28, 7, 2, 0)

15
scenes/props/tree6.tscn Normal file
View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=3 uid="uid://cixovgrvqr2p2"]
[ext_resource type="Texture2D" uid="uid://dw8bvtj64furs" path="res://textures/tree6s.png" id="1_qlky8"]
[node name="Tree2" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-3, -119)
texture = ExtResource("1_qlky8")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
visible = false
z_index = 1
position = Vector2(-2, 10)
polygon = PackedVector2Array(1, 32, -37, 15, -39, 2, -71, 3, -44, -11, -33, -23, 19, -23, 30, -11, 59, -8, 68, 4, 58, 13, 24, 21, 6, 14)

View File

@@ -0,0 +1,78 @@
[gd_resource type="TileSet" load_steps=4 format=3 uid="uid://c2mhyv81hyxbt"]
[ext_resource type="Texture2D" uid="uid://da0xv8i2od1ho" path="res://scenes/tilesets/isotiles.png" id="1"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ng8xk"]
texture = ExtResource("1")
margins = Vector2i(28, 75)
separation = Vector2i(57, 42)
texture_region_size = Vector2i(135, 105)
1:0/0 = 0
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:0/0/physics_layer_0/angular_velocity = 0.0
0:0/next_alternative_id = 8
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/1 = 1
0:0/1/flip_h = true
0:0/1/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/1/physics_layer_0/angular_velocity = 0.0
0:0/2 = 2
0:0/2/flip_v = true
0:0/2/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/2/physics_layer_0/angular_velocity = 0.0
0:0/3 = 3
0:0/3/flip_h = true
0:0/3/flip_v = true
0:0/3/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/3/physics_layer_0/angular_velocity = 0.0
0:0/4 = 4
0:0/4/transpose = true
0:0/4/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/4/physics_layer_0/angular_velocity = 0.0
0:0/5 = 5
0:0/5/flip_h = true
0:0/5/transpose = true
0:0/5/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/5/physics_layer_0/angular_velocity = 0.0
0:0/6 = 6
0:0/6/flip_v = true
0:0/6/transpose = true
0:0/6/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/6/physics_layer_0/angular_velocity = 0.0
0:0/7 = 7
0:0/7/flip_h = true
0:0/7/flip_v = true
0:0/7/transpose = true
0:0/7/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/7/physics_layer_0/angular_velocity = 0.0
0:1/0 = 0
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:1/0/physics_layer_0/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ts0xg"]
texture = ExtResource("1")
margins = Vector2i(29, 20)
separation = Vector2i(58, 0)
texture_region_size = Vector2i(136, 67)
1:3/size_in_atlas = Vector2i(1, 2)
1:3/0 = 0
1:3/0/texture_origin = Vector2i(0, 27)
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:3/0/physics_layer_0/angular_velocity = 0.0
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-25.75, -6.5, -23.25, 13, -2.25, 18, 21.25, 11, 21.25, -7.5)
0:3/size_in_atlas = Vector2i(1, 2)
0:3/0 = 0
0:3/0/texture_origin = Vector2i(0, 30)
0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:3/0/physics_layer_0/angular_velocity = 0.0
0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -32, -67.5, 0, 0, 32, 67.5, 0)
[resource]
tile_shape = 1
tile_layout = 5
tile_size = Vector2i(135, 64)
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_ng8xk")
sources/2 = SubResource("TileSetAtlasSource_ts0xg")

View File

@@ -0,0 +1,53 @@
[gd_scene load_steps=2 format=3 uid="uid://cteq1mye638ah"]
[ext_resource type="Texture2D" uid="uid://da0xv8i2od1ho" path="res://scenes/tilesets/isotiles.png" id="1"]
[node name="TilesetEdit" type="Node2D"]
[node name="Base" type="Sprite2D" parent="."]
texture = ExtResource("1")
region_enabled = true
region_rect = Rect2(28, 75, 135, 105)
[node name="Base2" type="Sprite2D" parent="."]
position = Vector2(200, 0)
texture = ExtResource("1")
region_enabled = true
region_rect = Rect2(221, 75, 135, 105)
[node name="Wall" type="Sprite2D" parent="."]
position = Vector2(400, 0)
texture = ExtResource("1")
offset = Vector2(0, -32)
region_enabled = true
region_rect = Rect2(28, 220, 140, 140)
[node name="StaticBody2D" type="StaticBody2D" parent="Wall"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Wall/StaticBody2D"]
polygon = PackedVector2Array(-64, 0, 0, 32, 64, 0, 0, -32)
[node name="Column" type="Sprite2D" parent="."]
position = Vector2(600, 0)
texture = ExtResource("1")
offset = Vector2(0, -32)
region_enabled = true
region_rect = Rect2(259, 241, 55, 95)
[node name="StaticBody2D" type="StaticBody2D" parent="Column"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Column/StaticBody2D"]
position = Vector2(2, 0)
polygon = PackedVector2Array(-24, 2, -10, 12, 10, 12, 24, 2, 24, -12, 10, -22, -10, -22, -24, -12)
[node name="Door1" type="Sprite2D" parent="."]
position = Vector2(800, 0)
texture = ExtResource("1")
offset = Vector2(0, -25)
region_enabled = true
region_rect = Rect2(54, 426, 85, 110)
[node name="StaticBody2D" type="StaticBody2D" parent="Door1"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Door1/StaticBody2D"]
polygon = PackedVector2Array(-24, 24, 40, -8, 24, -16, -40, 16)

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://da0xv8i2od1ho"
path="res://.godot/imported/isotiles.png-daca96888dd7c1c25e1e16875060487d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/tilesets/isotiles.png"
dest_files=["res://.godot/imported/isotiles.png-daca96888dd7c1c25e1e16875060487d.ctex"]
[params]
compress/mode=1
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1