@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.
- package/dist/build.js +7 -4
- package/dist/object_format.d.ts +7 -6
- package/dist/object_format.js +11 -10
- package/package.json +1 -1
- package/templates/empty/.engine/engine.mjs +17557 -0
- package/templates/empty/.engine/version.json +4 -0
- package/templates/empty/project.json +2 -2
- package/templates/physics_ball/.engine/engine.mjs +277 -200
- package/templates/physics_ball/.engine/version.json +2 -2
- package/templates/physics_ball/objects/obj_ball.ts +5 -5
- package/templates/physics_ball/objects/obj_paddle.ts +8 -7
- package/templates/physics_ball/objects/obj_tracker.ts +1 -1
- package/templates/physics_ball/project.json +1 -1
- package/templates/platformer/.engine/engine.mjs +17557 -0
- package/templates/platformer/.engine/version.json +4 -0
- package/templates/platformer/objects/obj_platform.ts +0 -2
- package/templates/platformer/objects/obj_player.ts +33 -23
- package/templates/platformer/project.json +2 -2
- package/templates/topdown/.engine/engine.mjs +17557 -0
- package/templates/topdown/.engine/version.json +4 -0
- package/templates/topdown/objects/obj_player.ts +35 -37
- package/templates/topdown/project.json +2 -2
|
@@ -9,15 +9,15 @@ export class obj_ball extends gm_object {
|
|
|
9
9
|
stride = 0.2;
|
|
10
10
|
on_step(): void {
|
|
11
11
|
// collide and bounce
|
|
12
|
-
let paddle = instance_nearest(
|
|
12
|
+
let paddle = instance_nearest(sw.x, sw.y, obj_paddle);
|
|
13
13
|
|
|
14
|
-
if (
|
|
14
|
+
if (sw.place_meeting(sw.x, sw.y + sw.phy_speed_y, obj_paddle)) {
|
|
15
15
|
global.score += 1;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
sw.phy_speed_y = -inst.bouce;
|
|
17
|
+
sw.phy_speed_x = (paddle.x - sw.x) * -inst.stride;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (
|
|
20
|
+
if (sw.y > 1000) {
|
|
21
21
|
game_restart();
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -5,20 +5,21 @@ export class obj_paddle extends gm_object {
|
|
|
5
5
|
static physics_density = 0;
|
|
6
6
|
static physics_restitution = 0;
|
|
7
7
|
static physics_friction = 0;
|
|
8
|
+
|
|
8
9
|
on_create(): void {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.hover = this.y;
|
|
10
|
+
inst.mouse_delta = 0.0;
|
|
11
|
+
inst.last_mouse_x = mouse_x;
|
|
12
|
+
sw.x = mouse_x;
|
|
13
13
|
}
|
|
14
|
+
|
|
14
15
|
on_step(): void {
|
|
15
16
|
// delta
|
|
16
|
-
|
|
17
|
+
inst.mouse_delta = mouse_x - inst.last_mouse_x;
|
|
17
18
|
|
|
18
19
|
// motion
|
|
19
|
-
|
|
20
|
+
sw.phy_set_position(sw.x + inst.mouse_delta, sw.y);
|
|
20
21
|
|
|
21
22
|
// complete
|
|
22
|
-
|
|
23
|
+
inst.last_mouse_x = mouse_x;
|
|
23
24
|
}
|
|
24
25
|
}
|