diff --git a/data/itemRegs/magics.yaml b/data/itemRegs/magics.yaml index 4170a9b..092267b 100644 --- a/data/itemRegs/magics.yaml +++ b/data/itemRegs/magics.yaml @@ -15,4 +15,8 @@ - id: curse scene_path: res://prefab/magics/curse.tscn icon_path: res://sprites/projectile/x3.png + max_stack_value: 1 +- id: magic_missile + scene_path: res://prefab/magics/magicMissile.tscn + icon_path: res://sprites/projectile/magicMissile.png max_stack_value: 1 \ No newline at end of file diff --git a/locals/Item.csv b/locals/Item.csv index 442baac..c4d7511 100644 --- a/locals/Item.csv +++ b/locals/Item.csv @@ -14,4 +14,6 @@ item_iron_axe_desc,铁斧子,Iron axe,鉄の斧です item_curse,死灵诅咒法术,The curse of the Dead,死霊呪いの術 item_curse_desc,杀死敌人后在生成死灵敌人。,Spawn Undead enemies after killing them.,敵を殺すと死霊敵が発生します。 item_beginner_staff,初学者法杖,Beginner's staff,初心者用の杖です -item_beginner_staff_desc,送给初来乍到的冒险家。,For new adventurers.,初心者の冒険家に贈ります。 \ No newline at end of file +item_beginner_staff_desc,送给初来乍到的冒险家。,For new adventurers.,初心者の冒険家に贈ります。 +item_magic_missile,魔法飞弹,Magic missile,魔法のミサイルです +item_magic_missile_desc,魔法飞弹,Magic missile,魔法のミサイルです \ No newline at end of file diff --git a/prefab/magics/magicMissile.tscn b/prefab/magics/magicMissile.tscn new file mode 100644 index 0000000..1e9402c --- /dev/null +++ b/prefab/magics/magicMissile.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=5 format=3 uid="uid://bt3ck8twqowke"] + +[ext_resource type="Script" path="res://scripts/spell/SpellPickAble.cs" id="1_xxv2a"] +[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="2_p1csa"] +[ext_resource type="Texture2D" uid="uid://ca3paw31aubkd" path="res://sprites/projectile/magicMissile.png" id="3_ckdw6"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3lbq"] +size = Vector2(20, 14) + +[node name="MagicMissile" type="RigidBody2D"] +collision_layer = 8 +collision_mask = 34 +angular_damp = -1.0 +script = ExtResource("1_xxv2a") +_projectilePath = "res://prefab/projectile/magicMissile.tscn" +UniqueIcon = ExtResource("3_ckdw6") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_i3lbq") + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("2_p1csa") +bus = &"SoundEffect" + +[node name="Marker2D" type="Marker2D" parent="."] + +[node name="TipLabel" type="Label" parent="."] +offset_left = -19.0 +offset_top = 23.0 +offset_right = 21.0 +offset_bottom = 48.0 + +[node name="CurseOfTheUndead" type="Sprite2D" parent="."] + +[node name="MagicMissile" type="Sprite2D" parent="."] +texture = ExtResource("3_ckdw6") diff --git a/prefab/projectile/magicMissile.tscn b/prefab/projectile/magicMissile.tscn new file mode 100644 index 0000000..8430a51 --- /dev/null +++ b/prefab/projectile/magicMissile.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=4 format=3 uid="uid://dmt5gpklx8efc"] + +[ext_resource type="Script" path="res://scripts/projectile/Projectile.cs" id="1_cp6hg"] +[ext_resource type="Texture2D" uid="uid://ca3paw31aubkd" path="res://sprites/projectile/magicMissile.png" id="2_6mikr"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_vfvxd"] +size = Vector2(20, 14) + +[node name="MagicMissile" type="CharacterBody2D"] +collision_layer = 0 +collision_mask = 0 +script = ExtResource("1_cp6hg") +_life = 5000 +_durability = 1.0 +_maxDamage = 7 +_minDamage = 3 +_damageType = 2 +Speed = 500.0 +_targetDiesDestroyProjectile = true +_repelStrength = 2.5 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(1, 0) +shape = SubResource("RectangleShape2D_vfvxd") + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +bus = &"SoundEffect" +area_mask = 16 + +[node name="MagicMissile" type="Sprite2D" parent="."] +position = Vector2(1, 0) +texture = ExtResource("2_6mikr") diff --git a/prefab/roomTemplates/tutorials/spellEditor.tscn b/prefab/roomTemplates/tutorials/spellEditor.tscn index 75b9d54..ce8c422 100644 --- a/prefab/roomTemplates/tutorials/spellEditor.tscn +++ b/prefab/roomTemplates/tutorials/spellEditor.tscn @@ -102,15 +102,15 @@ position = Vector2(715, 162) [node name="AutoSpawn" type="Node2D" parent="."] -[node name="necromancy" type="Marker2D" parent="AutoSpawn"] +[node name="beginner_staff" type="Marker2D" parent="AutoSpawn"] position = Vector2(134, 248) script = ExtResource("4_6ihp7") -_itemIdList = PackedStringArray("necromancy") +_itemIdList = PackedStringArray("beginner_staff") -[node name="beginner_staff" type="Marker2D" parent="AutoSpawn"] +[node name="magic_missile" type="Marker2D" parent="AutoSpawn"] position = Vector2(100, 250) script = ExtResource("4_6ihp7") -_itemIdList = PackedStringArray("beginner_staff") +_itemIdList = PackedStringArray("magic_missile") [node name="RoomArea" type="Area2D" parent="."] diff --git a/project.godot b/project.godot index ecdbda5..e169e2c 100644 --- a/project.godot +++ b/project.godot @@ -174,3 +174,7 @@ locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", " [physics] 2d/default_gravity=480.0 + +[rendering] + +textures/canvas_textures/default_texture_filter=0 diff --git a/scripts/spell/SpellPickAble.cs b/scripts/spell/SpellPickAble.cs index 9f4a4e2..6ed103b 100644 --- a/scripts/spell/SpellPickAble.cs +++ b/scripts/spell/SpellPickAble.cs @@ -15,45 +15,44 @@ namespace ColdMint.scripts.spell; /// public partial class SpellPickAble : PickAbleTemplate, ISpell { - [Export] - private string? _projectilePath; + [Export] + private string? _projectilePath; - private PackedScene? _projectileScene; + private PackedScene? _projectileScene; - public override int ItemType - { - get => Config.ItemType.Spell; - } + public override int ItemType + { + get => Config.ItemType.Spell; + } - public PackedScene? GetProjectile() - { - return _projectileScene; - } - - - - public override void LoadResource() - { - base.LoadResource(); - if (_projectileScene == null && !string.IsNullOrEmpty(_projectilePath)) - { - _projectileScene = ResourceLoader.Load(_projectilePath); - } - } + public PackedScene? GetProjectile() + { + return _projectileScene; + } - public virtual void ModifyWeapon(ProjectileWeapon projectileWeapon) - { + public override void LoadResource() + { + base.LoadResource(); + if (_projectileScene == null && !string.IsNullOrEmpty(_projectilePath)) + { + _projectileScene = ResourceLoader.Load(_projectilePath); + } + } - } - public virtual void RestoreWeapon(ProjectileWeapon projectileWeapon) - { + public virtual void ModifyWeapon(ProjectileWeapon projectileWeapon) + { - } + } - public virtual void ModifyProjectile(int index, Projectile projectile, ref Vector2 velocity) - { + public virtual void RestoreWeapon(ProjectileWeapon projectileWeapon) + { - } -} \ No newline at end of file + } + + public virtual void ModifyProjectile(int index, Projectile projectile, ref Vector2 velocity) + { + + } +} diff --git a/sprites/projectile/magicMissile.png b/sprites/projectile/magicMissile.png new file mode 100644 index 0000000..6509f9a Binary files /dev/null and b/sprites/projectile/magicMissile.png differ diff --git a/sprites/projectile/magicMissile.png.import b/sprites/projectile/magicMissile.png.import new file mode 100644 index 0000000..d451006 --- /dev/null +++ b/sprites/projectile/magicMissile.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ca3paw31aubkd" +path="res://.godot/imported/magicMissile.png-a6b88b2d7f9bc9f9dc254641cbadee40.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/projectile/magicMissile.png" +dest_files=["res://.godot/imported/magicMissile.png-a6b88b2d7f9bc9f9dc254641cbadee40.ctex"] + +[params] + +compress/mode=0 +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