Skip to content

Commit 2820cb3

Browse files
Update Vector2.gml
1 parent e5c5cfe commit 2820cb3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/Vector2/Vector2.gml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ function Vector2(_x, _y) constructor {
2323
}
2424

2525
x = vector.x;
26-
y = vector.y;
26+
y = vector.;
27+
28+
return self;
2729
}
2830

2931
static negative = function() {
3032
x = -x;
3133
y = -y;
34+
return self;
3235
}
3336

3437
static add = function() {
@@ -42,6 +45,7 @@ function Vector2(_x, _y) constructor {
4245

4346
x += vector.x;
4447
y += vector.y;
48+
return self;
4549
}
4650

4751
static multi = function() {
@@ -55,11 +59,13 @@ function Vector2(_x, _y) constructor {
5559

5660
x *= vector.x;
5761
y *= vector.y;
62+
return self;
5863
}
5964

6065
static zero = function() {
6166
x = 0;
6267
y = 0;
68+
return self;
6369
}
6470

6571
static to_string = function(delimiter = ":") {
@@ -156,19 +162,22 @@ function Vector2(_x, _y) constructor {
156162

157163
static dir_set = function(dir, value) {
158164
__dir_base(dir, value, self);
165+
return self;
159166
}
160167

161168
static dir_add = function(dir, value) {
162169
var vector = new Vector2(0, 0);
163170
__dir_base(dir, value, vector);
164171
self.add(vector);
172+
return self;
165173
}
166174

167175
static dir_multi = function(dir, value) {
168176
var vector = new Vector2(x, y);
169177
__dir_base(dir, value, vector);
170178
vector.min(new Vector2(1, 1));
171179
self.multi(vector);
180+
return self;
172181
}
173182
#endregion
174183
}

0 commit comments

Comments
 (0)