Add Magic missile.

加入魔法飞弹。
This commit is contained in:
Cold-Mint 2024-10-12 10:57:58 +08:00
parent 16c1a8185c
commit 35cb1296c7
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99
9 changed files with 148 additions and 37 deletions

View File

@ -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

View File

@ -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.,初心者の冒険家に贈ります。
item_beginner_staff_desc,送给初来乍到的冒险家。,For new adventurers.,初心者の冒険家に贈ります。
item_magic_missile,魔法飞弹,Magic missile,魔法のミサイルです
item_magic_missile_desc,魔法飞弹,Magic missile,魔法のミサイルです
1 id zh en ja
14 item_curse 死灵诅咒法术 The curse of the Dead 死霊呪いの術
15 item_curse_desc 杀死敌人后在生成死灵敌人。 Spawn Undead enemies after killing them. 敵を殺すと死霊敵が発生します。
16 item_beginner_staff 初学者法杖 Beginner's staff 初心者用の杖です
17 item_beginner_staff_desc 送给初来乍到的冒险家。 For new adventurers. 初心者の冒険家に贈ります。
18 item_magic_missile 魔法飞弹 Magic missile 魔法のミサイルです
19 item_magic_missile_desc 魔法飞弹 Magic missile 魔法のミサイルです

View File

@ -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")

View File

@ -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")

View File

@ -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="."]

View File

@ -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

View File

@ -15,45 +15,44 @@ namespace ColdMint.scripts.spell;
/// </remarks>
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<PackedScene>(_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<PackedScene>(_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)
{
}
}
}
public virtual void ModifyProjectile(int index, Projectile projectile, ref Vector2 velocity)
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@ -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