@silkweaver/build 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": "1.3.2",
3
+ "vendoredAt": "2026-06-20T15:53:49.776Z"
4
+ }
@@ -1,6 +1,4 @@
1
1
  export class obj_platform extends gm_object {
2
- on_create(): void {
3
- }
4
2
 
5
3
  // block width
6
4
  // block height
@@ -4,10 +4,10 @@ export class obj_player extends gm_object {
4
4
  weight = 1;
5
5
 
6
6
  on_create(): void {
7
- this.grounded = false;
8
- this.vertical_acc = 0.0;
9
- this.vertical_vel = 0.0;
10
- this.horizontal_vel = 0.0;
7
+ inst.grounded = false;
8
+ inst.vertical_acc = 0.0;
9
+ inst.vertical_vel = 0.0;
10
+ inst.horizontal_vel = 0.0;
11
11
  }
12
12
 
13
13
  on_step(): void {
@@ -31,9 +31,9 @@ export class obj_player extends gm_object {
31
31
  }
32
32
 
33
33
  // movenemt
34
- this.horizontal_vel = dir * this.spd;
35
- if (!this.place_meeting(this.x + this.horizontal_vel, this.y, _col)) {
36
- this.x += this.horizontal_vel;
34
+ inst.horizontal_vel = dir * inst.spd;
35
+ if (!sw.place_meeting(sw.x + inst.horizontal_vel, sw.y, _col)) {
36
+ sw.x += inst.horizontal_vel;
37
37
  }
38
38
 
39
39
  // ------------------------------
@@ -41,33 +41,43 @@ export class obj_player extends gm_object {
41
41
  // ------------------------------
42
42
 
43
43
  // grounding
44
- if (this.place_meeting(this.x, this.y + 1, _col)) {
45
- this.grounded = true;
46
- this.vertical_vel = 0;
47
- this.vertical_acc = 0;
44
+ if (sw.place_meeting(sw.x, sw.y + 1, _col)) {
45
+ inst.grounded = true;
46
+ inst.vertical_vel = 0;
47
+ inst.vertical_acc = 0;
48
48
  } else {
49
- this.grounded = false;
49
+ inst.grounded = false;
50
50
  }
51
51
 
52
- // vertical acceleration (gravity pulls down while airborne)
53
- if (!this.grounded) {
54
- this.vertical_acc = -this.weight;
52
+ // gravity
53
+ if (!inst.grounded) {
54
+ inst.vertical_acc = -inst.weight;
55
55
  }
56
56
 
57
57
  // jump
58
- if (key_jump && this.grounded) {
59
- this.vertical_acc = this.jump_force;
58
+ if (key_jump && inst.grounded) {
59
+ inst.vertical_acc = inst.jump_force;
60
60
  }
61
61
 
62
62
  // apply acceleration, then move — snapping flush against anything in the way
63
- this.vertical_vel += this.vertical_acc;
64
- if (this.place_meeting(this.x, this.y - this.vertical_vel, _col)) {
65
- while (!this.place_meeting(this.x, this.y - sign(this.vertical_vel), _col)) {
66
- this.y -= sign(this.vertical_vel);
63
+ inst.vertical_vel += inst.vertical_acc;
64
+ if (sw.place_meeting(sw.x, sw.y - inst.vertical_vel, _col)) {
65
+ while (!sw.place_meeting(sw.x, sw.y - sign(inst.vertical_vel), _col)) {
66
+ sw.y -= sign(inst.vertical_vel);
67
67
  }
68
- this.vertical_vel = 0;
68
+ inst.vertical_vel = 0;
69
+ }
70
+ sw.y -= inst.vertical_vel;
71
+
72
+ // ------------------------------
73
+ // sprite flip
74
+ // ------------------------------
75
+
76
+ if (dir == 1) {
77
+ sw.image_xscale = 1;
78
+ } else if (dir == -1) {
79
+ sw.image_xscale = -1;
69
80
  }
70
- this.y -= this.vertical_vel;
71
81
  }
72
82
  static sprite = 'spr_player'
73
83
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "Platformer",
3
3
  "version": "1.0.0",
4
- "engineVersion": "1.0.0",
4
+ "engineVersion": "1.3.2",
5
5
  "settings": {
6
6
  "roomSpeed": 60,
7
7
  "windowWidth": 640,
@@ -41,4 +41,4 @@
41
41
  }
42
42
  }
43
43
  }
44
- }
44
+ }