Initial commit
This commit is contained in:
34
Abilities/Sword/Sword.cs
Normal file
34
Abilities/Sword/Sword.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Sword : MeleeBase
|
||||
{
|
||||
[Export] public float SweepArcDegrees { get; set; } = 90f;
|
||||
[Export] public float Lifetime { get; set; } = 0.25f;
|
||||
|
||||
float _elapsedTime = 0f;
|
||||
float _startRotation, _endRotation;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_startRotation = Rotation + Mathf.DegToRad(-SweepArcDegrees * 0.5f);
|
||||
_endRotation = Rotation + Mathf.DegToRad(SweepArcDegrees * 0.5f);
|
||||
|
||||
Rotation = _startRotation;
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_elapsedTime += (float)delta;
|
||||
|
||||
var t = _elapsedTime / Lifetime;
|
||||
|
||||
Rotation = Mathf.Lerp(_startRotation, _endRotation, t);
|
||||
|
||||
if (_elapsedTime >= Lifetime)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Abilities/Sword/Sword.cs.uid
Normal file
1
Abilities/Sword/Sword.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dgcyfw7bpt67q
|
||||
BIN
Abilities/Sword/Sword.png
Normal file
BIN
Abilities/Sword/Sword.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 932 B |
40
Abilities/Sword/Sword.png.import
Normal file
40
Abilities/Sword/Sword.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8iyfaq0a52a2"
|
||||
path="res://.godot/imported/Sword.png-99830bfad10ffac3bbbde6d72e00388c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Abilities/Sword/Sword.png"
|
||||
dest_files=["res://.godot/imported/Sword.png-99830bfad10ffac3bbbde6d72e00388c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
16
Abilities/Sword/Sword.tscn
Normal file
16
Abilities/Sword/Sword.tscn
Normal file
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bqiniro3w8jom"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://8iyfaq0a52a2" path="res://Abilities/Sword/Sword.png" id="1_0u6wf"]
|
||||
[ext_resource type="Script" uid="uid://dgcyfw7bpt67q" path="res://Abilities/Sword/Sword.cs" id="1_aoixy"]
|
||||
|
||||
[node name="Sword" type="Area2D"]
|
||||
script = ExtResource("1_aoixy")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
position = Vector2(9, -4.7683716e-07)
|
||||
rotation = 2.3561945
|
||||
texture = ExtResource("1_0u6wf")
|
||||
|
||||
[node name="Collision" type="CollisionPolygon2D" parent="."]
|
||||
position = Vector2(0, -7.5)
|
||||
polygon = PackedVector2Array(21, 7.5, 18, 10.5, 6, 10.5, 6, 4.5, 18, 4.5)
|
||||
Reference in New Issue
Block a user