Skip to content

Commit 5ae62b3

Browse files
committed
entity flip x/y
1 parent 2abfc7d commit 5ae62b3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Client/objects/oEntityManager/Step_0.gml

+7
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ for(i = 0; i < l; i++) {
122122
inst.x = entity.x
123123
inst.y = entity.y
124124

125+
if (entity[$ "fx"]) {
126+
inst.image_xscale *= -1
127+
}
128+
if (entity[$ "fy"]) {
129+
inst.image_yscale *= -1
130+
}
131+
125132
inst.state = state
126133

127134
// set the speed

TypescriptServer/src/concepts/entity.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export type SerializedEntity = {
3333
a: number,
3434
spd?: Point,
3535
st: number, // state
36+
fx?: boolean, // flip
37+
fy?: boolean,
3638

3739
p?: { // custom variables
3840
[name: string]: any
@@ -344,7 +346,7 @@ class Entity extends EventEmitter {
344346
}
345347

346348
public serialize():SerializedEntity {
347-
return {
349+
let struct:SerializedEntity = {
348350
id: this.id,
349351
t: this.type,
350352
obj: this.object_name,
@@ -357,6 +359,14 @@ class Entity extends EventEmitter {
357359
p: this.props, // uses a getter for props
358360
st: this.state
359361
}
362+
363+
if (this.flip.x)
364+
struct.fx = true;
365+
if (this.flip.y)
366+
struct.fy = true;
367+
368+
369+
return struct;
360370
}
361371

362372
public bundle() {

0 commit comments

Comments
 (0)