Folder structure + Backslash Item
This commit is contained in:
parent
8fbaf0c282
commit
d8fa672b90
30 changed files with 58 additions and 25 deletions
|
|
@ -8,7 +8,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="5_xr4t5"]
|
||||
[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="7_35wcg"]
|
||||
[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="8_sifiv"]
|
||||
[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/item_spawn.tscn" id="9_i1qmw"]
|
||||
[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/generic/item_spawn.tscn" id="9_i1qmw"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pfkkr"]
|
||||
shader = ExtResource("2_xx8ra")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dfva4dhflxglr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bglrm0bb4nla" path="res://items/arrow.gd" id="1_lxthq"]
|
||||
[ext_resource type="Script" uid="uid://bglrm0bb4nla" path="res://items/active_items/bow/arrow.gd" id="1_lxthq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_tl37p"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tfcgf"]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://ddn025xnjngko"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/bow.gd" id="1_xppub"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/arrow.tscn" id="2_0id2q"]
|
||||
[ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/active_items/bow/bow.gd" id="1_xppub"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/active_items/bow/arrow.tscn" id="2_0id2q"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_gllxn"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gllxn"]
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ewe36lqcjojk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbwsc2a2hd0ow" path="res://items/updash.gd" id="1_ghbl6"]
|
||||
[ext_resource type="Script" uid="uid://bbwsc2a2hd0ow" path="res://items/active_items/updash/updash.gd" id="1_ghbl6"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_ptc3l"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ghbl6"]
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://xj0of571aur1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b8em61mqgdi58" path="res://items/item_spawn.gd" id="1_ms6tn"]
|
||||
[ext_resource type="PackedScene" uid="uid://b00185vygcka1" path="res://items/heal_item.tscn" id="2_w6i8k"]
|
||||
[ext_resource type="Script" uid="uid://b8em61mqgdi58" path="res://items/generic/item_spawn.gd" id="1_ms6tn"]
|
||||
[ext_resource type="PackedScene" uid="uid://b00185vygcka1" path="res://items/immediate_items/heal_item/heal_item.tscn" id="2_w6i8k"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_5pwuf"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwctb2xqsbj" path="res://items/healthup.tscn" id="3_yi7ag"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddn025xnjngko" path="res://items/bow.tscn" id="4_v0ua0"]
|
||||
[ext_resource type="PackedScene" uid="uid://ewe36lqcjojk" path="res://items/updash.tscn" id="5_uitgx"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwctb2xqsbj" path="res://items/immediate_items/healthup/healthup.tscn" id="3_yi7ag"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddn025xnjngko" path="res://items/active_items/bow/bow.tscn" id="4_v0ua0"]
|
||||
[ext_resource type="PackedScene" uid="uid://ewe36lqcjojk" path="res://items/active_items/updash/updash.tscn" id="5_uitgx"]
|
||||
|
||||
[node name="ItemSpawn" type="Node2D"]
|
||||
script = ExtResource("1_ms6tn")
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b00185vygcka1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b43fudwi47qfd" path="res://items/heal_item.gd" id="1_3vbv8"]
|
||||
[ext_resource type="Script" uid="uid://b43fudwi47qfd" path="res://items/immediate_items/heal_item/heal_item.gd" id="1_3vbv8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_48lih"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_evqwq"]
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://gwctb2xqsbj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ce6fxbjarlvtk" path="res://items/healthup.gd" id="1_ivtxh"]
|
||||
[ext_resource type="Script" uid="uid://ce6fxbjarlvtk" path="res://items/immediate_items/healthup/healthup.gd" id="1_ivtxh"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_lolop"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="3_v056v"]
|
||||
|
||||
10
items/permanent_items/backslash.gd
Normal file
10
items/permanent_items/backslash.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Item
|
||||
|
||||
@export var sword : PackedScene
|
||||
|
||||
func collect() -> bool:
|
||||
var sword_instance = sword.instantiate()
|
||||
player.add_child(sword_instance)
|
||||
sword_instance.facing_mult = -1
|
||||
return true
|
||||
|
||||
1
items/permanent_items/backslash.gd.uid
Normal file
1
items/permanent_items/backslash.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://blg876atd71cg
|
||||
23
items/permanent_items/backslash.tscn
Normal file
23
items/permanent_items/backslash.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bbpf28ohayd8n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://blg876atd71cg" path="res://items/permanent_items/backslash.gd" id="1_s4bdx"]
|
||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="2_kiuxs"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3e3kuyeh6mr1" path="res://player/sword.tscn" id="2_u6vk4"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="3_vb0oa"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hvhjo"]
|
||||
|
||||
[node name="Backslash" type="Area2D"]
|
||||
scale = Vector2(1, -1)
|
||||
script = ExtResource("1_s4bdx")
|
||||
sword = ExtResource("2_u6vk4")
|
||||
|
||||
[node name="EarthAligner" parent="." instance=ExtResource("2_kiuxs")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(7, 7)
|
||||
shape = SubResource("CircleShape2D_hvhjo")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 1, 0, 1)
|
||||
texture = ExtResource("3_vb0oa")
|
||||
14
main.tscn
14
main.tscn
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://cxo6bq26huau7"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://cxo6bq26huau7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"]
|
||||
[ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="2_lquwl"]
|
||||
|
|
@ -7,17 +7,10 @@
|
|||
[ext_resource type="PackedScene" uid="uid://73g8y37skebh" path="res://item_ui/item_ui.tscn" id="6_4c57u"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjsrtswk4vgf2" path="res://healthbar/healthbar.tscn" id="6_7mycd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpdn2php3ydsv" path="res://death_screen/death_screen.tscn" id="7_5vw27"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbpf28ohayd8n" path="res://items/permanent_items/backslash.tscn" id="8_5vw27"]
|
||||
|
||||
[node name="main" type="Node2D"]
|
||||
|
||||
[node name="Layer0" type="Parallax2D" parent="."]
|
||||
|
||||
[node name="Layer1" type="Parallax2D" parent="."]
|
||||
|
||||
[node name="Layer2" type="Parallax2D" parent="."]
|
||||
|
||||
[node name="Layer3" type="Parallax2D" parent="."]
|
||||
|
||||
[node name="Earth" parent="." instance=ExtResource("3_lquwl")]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("2_lquwl")
|
||||
|
|
@ -54,6 +47,9 @@ player = NodePath("../../Player")
|
|||
[node name="DeathScreen" parent="CanvasLayer" instance=ExtResource("7_5vw27")]
|
||||
visible = false
|
||||
|
||||
[node name="Backslash" parent="." instance=ExtResource("8_5vw27")]
|
||||
position = Vector2(174, -3243)
|
||||
|
||||
[connection signal="active_item_changed" from="Player" to="CanvasLayer/ItemUI" method="_on_player_active_item_changed"]
|
||||
[connection signal="health_changed" from="Player" to="CanvasLayer/Healthbar" method="_on_player_health_changed"]
|
||||
[connection signal="max_hp_changed" from="Player" to="CanvasLayer/Healthbar" method="_on_player_max_hp_changed"]
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ var damage_knockup = 500
|
|||
# Attack Handling
|
||||
var atk_cooldown = 0.5
|
||||
var atk_timer = 0
|
||||
signal attack
|
||||
|
||||
# Active Item
|
||||
signal active_item_changed(newitem : Item)
|
||||
|
|
@ -83,7 +84,7 @@ func manage_attack(delta : float):
|
|||
atk_timer = max(0, atk_timer-delta)
|
||||
if handle_input:
|
||||
if(Input.is_action_just_pressed("attack") and atk_timer <= 0):
|
||||
sword.swing()
|
||||
attack.emit()
|
||||
atk_timer = atk_cooldown
|
||||
|
||||
func manage_active(_delta : float):
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ frame_progress = 0.433977
|
|||
[node name="EarthAligner" parent="." instance=ExtResource("3_i3pqv")]
|
||||
|
||||
[node name="Sword" parent="." instance=ExtResource("4_yw30f")]
|
||||
position = Vector2(0, -1.9999999)
|
||||
position = Vector2(0, -2)
|
||||
|
||||
[node name="ActiveItemCooldown" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@ var slash_duration = 0.1
|
|||
var slash_timer = 0
|
||||
var damage = 20
|
||||
var facing = -1
|
||||
var facing_mult = 1
|
||||
|
||||
func _ready() -> void:
|
||||
anim_sprite = $AnimatedSprite2D
|
||||
get_parent().attack.connect(swing)
|
||||
|
||||
func swing() -> void:
|
||||
facing = -get_parent().facing
|
||||
scale.x = facing
|
||||
facing = - get_parent().facing * facing_mult
|
||||
scale.x = abs(scale.x) * facing
|
||||
anim_sprite.visible = true
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
slash_timer = slash_duration
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue