Skip to content

Commit 5a78284

Browse files
now Static functions
1 parent 5c99494 commit 5a78284

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Vectors.yyp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/Vector2/Vector2.gml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Vector2(_x, _y) constructor {
1313
x = _x;
1414
y = _y;
1515

16-
set = function() {
16+
static set = function() {
1717
var vector = argument[0];
1818

1919
if (argument_count > 1) {
@@ -26,12 +26,12 @@ function Vector2(_x, _y) constructor {
2626
y = vector.y;
2727
}
2828

29-
negative = function() {
29+
static negative = function() {
3030
x = -x;
3131
y = -y;
3232
}
3333

34-
add = function() {
34+
static add = function() {
3535
var vector = argument[0];
3636

3737
if (argument_count > 1) {
@@ -44,7 +44,7 @@ function Vector2(_x, _y) constructor {
4444
y += vector.y;
4545
}
4646

47-
multi = function() {
47+
static multi = function() {
4848
var vector = argument[0];
4949

5050
if (argument_count > 1) {
@@ -57,20 +57,20 @@ function Vector2(_x, _y) constructor {
5757
y *= vector.y;
5858
}
5959

60-
zero = function() {
60+
static zero = function() {
6161
x = 0;
6262
y = 0;
6363
}
6464

65-
to_string = function(delimiter = ":") {
65+
static to_string = function(delimiter = ":") {
6666
return string(x) + delimiter + string(y);
6767
}
6868

69-
_length = function() {
69+
static _length = function() {
7070
return sqr(x * x + y * y);
7171
}
7272

73-
_min = function() {
73+
static _min = function() {
7474
var vector = argument[0];
7575

7676
if (argument_count > 1) {
@@ -82,7 +82,7 @@ function Vector2(_x, _y) constructor {
8282
return new Vector2(min(x, vector.x), min(y, vector.y));
8383
}
8484

85-
_max = function() {
85+
static _max = function() {
8686
var vector = argument[0];
8787

8888
if (argument_count > 1) {
@@ -94,7 +94,7 @@ function Vector2(_x, _y) constructor {
9494
return new Vector2(max(x, vector.x), max(y, vector.y));
9595
}
9696

97-
_clamp = function() {
97+
static _clamp = function() {
9898
var vector_min = argument[0];
9999
var vector_max = argument[1];
100100

@@ -110,7 +110,7 @@ function Vector2(_x, _y) constructor {
110110
return new Vector2(clamp(x, vector_min.x, vector_max.x), clamp(y, vector_min.y, vector_max.y));
111111
}
112112

113-
_lerp = function() {
113+
static _lerp = function() {
114114
var vector = argument[0];
115115
var amount = "0.5";
116116

@@ -129,7 +129,7 @@ function Vector2(_x, _y) constructor {
129129
}
130130

131131
#region Dir
132-
__dir_base = function(dir, value, vector) {
132+
static __dir_base = function(dir, value, vector) {
133133
switch (dir) {
134134
case vector2_dir.down:
135135
vector.y = -value;
@@ -154,17 +154,17 @@ function Vector2(_x, _y) constructor {
154154
}
155155
}
156156

157-
dir_set = function(dir, value) {
157+
static dir_set = function(dir, value) {
158158
__dir_base(dir, value, self);
159159
}
160160

161-
dir_add = function(dir, value) {
161+
static dir_add = function(dir, value) {
162162
var vector = new Vector2(0, 0);
163163
__dir_base(dir, value, vector);
164164
self.add(vector);
165165
}
166166

167-
dir_multi = function(dir, value) {
167+
static dir_multi = function(dir, value) {
168168
var vector = new Vector2(x, y);
169169
__dir_base(dir, value, vector);
170170
vector.min(new Vector2(1, 1));

0 commit comments

Comments
 (0)