-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIceKnife.cs
116 lines (100 loc) · 2.63 KB
/
IceKnife.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using Godot;
using System;
using MysticRunescape;
public class IceKnife : Spell
{
public string ResourcePath = "res://miscs/IceKnife.tscn";
private AnimationPlayer player;
[Export]
public bool ableToMove;
public IceKnife()
{
InterfaceTexturePath = "res://miscs/IceKnife/I5050-7.png";
InterfaceTexture = ResourceLoader.Load(InterfaceTexturePath) as Texture;
}
public override void _Ready()
{
player = GetNode<AnimationPlayer>("AnimationPlayer");
player.Play("cast");
GetNode<AudioStreamPlayer>("iceshard").Play();
}
public override void _PhysicsProcess(float delta)
{
if (ableToMove)
{
if (!player.IsPlaying())
{
player.Play("idle");
}
if (faceDirection)
{
Position -= (Transform.x * delta * Speed);
}
else
{
Position += (Transform.x * delta * Speed);
}
LifeSpan -= delta;
if (LifeSpan < 0)
{
QueueFree();
}
}
}
public override void SetUp(bool facedirection)
{
GetNode<Sprite>("Sprite").FlipH = facedirection;
faceDirection = facedirection;
}
public override void CastSpell()
{
}
public override void LoadResourcePath()
{
}
public void _on_Area2D_body_entered(object body)
{
if (body is SlimeEnemy)
{
SlimeEnemy slime = body as SlimeEnemy;
slime.TakeDamage(DamageAmount);
player.Play("finish");
}
if (body is elderslime)
{
elderslime slime2 = body as elderslime;
slime2.TakeDamage(DamageAmount);
player.Play("finish");
}
if (!faceDirection)
{
player.Play("finish");
}
else
{
if (body is TileMap)
{
player.Play("finish");
}
else if (body is Door)
{
player.Play("finish");
}
else if (body is Door2)
{
player.Play("finish");
}
else if (body is Platform1)
{
player.Play("finish");
}
else
{
if (LifeSpan < 0)
{
player.Play("finish");
}
}
}
}
}