-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFloatCantrip.cs
119 lines (88 loc) · 2.61 KB
/
FloatCantrip.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
117
118
119
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace monowizard
{
internal class FloatCantrip : Cantrip
{
Texture2D cloudTexture;
int spellframe;
Player player;
Rectangle hitbox = new Rectangle(0, 0, 60, 60);
Rectangle drawbox = new Rectangle(0, 0, 100, 100);
Rectangle cropbox = new Rectangle(0, 0, 128, 128);
public bool isfiring;
public int casts = 0;
public FloatCantrip(Player player)
{
this.player = player;
id = 1;
pushonhit = 4;
manacost = 0;
symbcroprect = new Rectangle(0, 128, 128, 128);
cantripnum = 3;
}
public override void cast()
{
if (casts == 0)
{
cloudTexture = player.cloudtexture;
casts++;
casts++;
casts++;
}
if (isfiring)
{
isfiring = false;
}
else
{
isfiring = true;
}
}
public override void update()
{
if (isfiring )
{
if(player.mana > 0){
player.changeMana(-0.01f);
player.elevation = player.hitbox.Y;
player.yvel = 0;
spellframe++;
hitbox.Y = player.hitbox.Y + 30;
hitbox.X = player.hitbox.X - 5;
if (spellframe % 10 == 1)
{
cropbox.X += 128;
if (cropbox.X > 300)
{
cropbox.X = 0;
}
}
else if (spellframe == 600)
{
spellframe = 0;
cropbox.X = 0;
}
}
else
{
isfiring = false;
}
}
}
public override void predraw(SpriteBatch _spriteBatch)
{
if (isfiring)
{
drawbox.X = (int)hitbox.X - player.centerWorldX + player.centerX;
drawbox.Y = (int)hitbox.Y - player.centerWorldY + player.centerY;
_spriteBatch.Draw(cloudTexture, drawbox, cropbox, Color.White);
}
}
}
}