@silkweaver/build 1.3.1 → 1.3.2
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 +9 -2
- package/dist/object_format.js +7 -23
- package/dist/templates.js +1 -0
- package/package.json +1 -1
- package/templates/physics_ball/.engine/engine.mjs +17480 -0
- package/templates/physics_ball/.engine/version.json +4 -0
- package/templates/physics_ball/objects/obj_ball.ts +24 -0
- package/templates/physics_ball/objects/obj_paddle.ts +24 -0
- package/templates/physics_ball/objects/obj_tracker.ts +7 -0
- package/templates/physics_ball/objects/obj_wall.ts +8 -0
- package/templates/physics_ball/project.json +53 -0
- package/templates/physics_ball/rooms/room_main/room.json +77 -0
- package/templates/physics_ball/sprites/spr_ball/0.png +0 -0
- package/templates/physics_ball/sprites/spr_ball/meta.json +22 -0
- package/templates/physics_ball/sprites/spr_paddle/0.png +0 -0
- package/templates/physics_ball/sprites/spr_paddle/meta.json +17 -0
- package/templates/physics_ball/sprites/spr_tracker/0.png +0 -0
- package/templates/physics_ball/sprites/spr_tracker/meta.json +22 -0
- package/templates/physics_ball/sprites/spr_wall/0.png +0 -0
- package/templates/physics_ball/sprites/spr_wall/meta.json +22 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class obj_ball extends gm_object {
|
|
2
|
+
static sprite = 'spr_ball';
|
|
3
|
+
static physics = true;
|
|
4
|
+
static physics_shape = 'circle';
|
|
5
|
+
static physics_density = 0.2;
|
|
6
|
+
static physics_restitution = 0.9;
|
|
7
|
+
static physics_friction = 0;
|
|
8
|
+
bouce = 30;
|
|
9
|
+
stride = 0.2;
|
|
10
|
+
on_step(): void {
|
|
11
|
+
// collide and bounce
|
|
12
|
+
let paddle = instance_nearest(this.x, this.y, obj_paddle);
|
|
13
|
+
|
|
14
|
+
if (this.place_meeting(this.x, this.y + this.phy_speed_y, obj_paddle)) {
|
|
15
|
+
global.score += 1;
|
|
16
|
+
this.phy_speed_y = -this.bouce;
|
|
17
|
+
this.phy_speed_x = (paddle.x - this.x) * -this.stride;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (this.y > 1000) {
|
|
21
|
+
game_restart();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class obj_paddle extends gm_object {
|
|
2
|
+
static sprite = 'spr_paddle';
|
|
3
|
+
static physics = true;
|
|
4
|
+
static physics_shape = 'box';
|
|
5
|
+
static physics_density = 0;
|
|
6
|
+
static physics_restitution = 0;
|
|
7
|
+
static physics_friction = 0;
|
|
8
|
+
on_create(): void {
|
|
9
|
+
this.last_mouse_x = mouse_x;
|
|
10
|
+
this.x = mouse_x;
|
|
11
|
+
this.mouse_delta = 0.0;
|
|
12
|
+
this.hover = this.y;
|
|
13
|
+
}
|
|
14
|
+
on_step(): void {
|
|
15
|
+
// delta
|
|
16
|
+
this.mouse_delta = mouse_x - this.last_mouse_x;
|
|
17
|
+
|
|
18
|
+
// motion
|
|
19
|
+
this.phy_set_position(this.x + this.mouse_delta, this.y);
|
|
20
|
+
|
|
21
|
+
// complete
|
|
22
|
+
this.last_mouse_x = mouse_x;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "physics_ball",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"engineVersion": "1.3.1",
|
|
5
|
+
"settings": {
|
|
6
|
+
"roomSpeed": 165,
|
|
7
|
+
"windowWidth": 640,
|
|
8
|
+
"windowHeight": 480,
|
|
9
|
+
"startRoom": "room_main",
|
|
10
|
+
"displayColor": "#1a1a2e"
|
|
11
|
+
},
|
|
12
|
+
"resources": {
|
|
13
|
+
"sprites": {
|
|
14
|
+
"spr_paddle": {
|
|
15
|
+
"name": "spr_paddle"
|
|
16
|
+
},
|
|
17
|
+
"spr_ball": {
|
|
18
|
+
"name": "spr_ball"
|
|
19
|
+
},
|
|
20
|
+
"spr_wall": {
|
|
21
|
+
"name": "spr_wall"
|
|
22
|
+
},
|
|
23
|
+
"spr_tracker": {
|
|
24
|
+
"name": "spr_tracker"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"sounds": {},
|
|
28
|
+
"backgrounds": {},
|
|
29
|
+
"paths": {},
|
|
30
|
+
"scripts": {},
|
|
31
|
+
"fonts": {},
|
|
32
|
+
"timelines": {},
|
|
33
|
+
"objects": {
|
|
34
|
+
"obj_paddle": {
|
|
35
|
+
"name": "obj_paddle"
|
|
36
|
+
},
|
|
37
|
+
"obj_ball": {
|
|
38
|
+
"name": "obj_ball"
|
|
39
|
+
},
|
|
40
|
+
"obj_wall": {
|
|
41
|
+
"name": "obj_wall"
|
|
42
|
+
},
|
|
43
|
+
"obj_tracker": {
|
|
44
|
+
"name": "obj_tracker"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"rooms": {
|
|
48
|
+
"room_main": {
|
|
49
|
+
"name": "room_main"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"width": 640,
|
|
3
|
+
"height": 480,
|
|
4
|
+
"room_speed": 60,
|
|
5
|
+
"persistent": false,
|
|
6
|
+
"creation_code": "",
|
|
7
|
+
"instances": [
|
|
8
|
+
{
|
|
9
|
+
"id": 1,
|
|
10
|
+
"object_name": "obj_paddle",
|
|
11
|
+
"x": 320,
|
|
12
|
+
"y": 416,
|
|
13
|
+
"scale_x": 1,
|
|
14
|
+
"scale_y": 1,
|
|
15
|
+
"rotation": 0,
|
|
16
|
+
"creation_code": ""
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": 2,
|
|
20
|
+
"object_name": "obj_ball",
|
|
21
|
+
"x": 320,
|
|
22
|
+
"y": 96,
|
|
23
|
+
"scale_x": 1,
|
|
24
|
+
"scale_y": 1,
|
|
25
|
+
"rotation": 0,
|
|
26
|
+
"creation_code": ""
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": 24,
|
|
30
|
+
"object_name": "obj_wall",
|
|
31
|
+
"x": 0,
|
|
32
|
+
"y": 0,
|
|
33
|
+
"scale_x": 1,
|
|
34
|
+
"scale_y": 15,
|
|
35
|
+
"rotation": 0,
|
|
36
|
+
"creation_code": ""
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": 42,
|
|
40
|
+
"object_name": "obj_wall",
|
|
41
|
+
"x": 32,
|
|
42
|
+
"y": 0,
|
|
43
|
+
"scale_x": 18,
|
|
44
|
+
"scale_y": 1,
|
|
45
|
+
"rotation": 0,
|
|
46
|
+
"creation_code": ""
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": 62,
|
|
50
|
+
"object_name": "obj_wall",
|
|
51
|
+
"x": 608,
|
|
52
|
+
"y": 0,
|
|
53
|
+
"scale_x": 1,
|
|
54
|
+
"scale_y": 15,
|
|
55
|
+
"rotation": 0,
|
|
56
|
+
"creation_code": ""
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": 63,
|
|
60
|
+
"object_name": "obj_tracker",
|
|
61
|
+
"x": 48,
|
|
62
|
+
"y": 48,
|
|
63
|
+
"scale_x": 1,
|
|
64
|
+
"scale_y": 1,
|
|
65
|
+
"rotation": 0,
|
|
66
|
+
"creation_code": ""
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"backgrounds": [],
|
|
70
|
+
"views": [],
|
|
71
|
+
"tiles": [],
|
|
72
|
+
"bg_color": "#1a1a2e",
|
|
73
|
+
"bg_show_color": true,
|
|
74
|
+
"physics_world": true,
|
|
75
|
+
"physics_gravity_x": 0,
|
|
76
|
+
"physics_gravity_y": 5
|
|
77
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"origin_x": 16,
|
|
3
|
+
"origin_y": 16,
|
|
4
|
+
"width": 32,
|
|
5
|
+
"height": 32,
|
|
6
|
+
"anim_speed": 15,
|
|
7
|
+
"mask_type": "ellipse",
|
|
8
|
+
"mask_x": 0,
|
|
9
|
+
"mask_y": 0,
|
|
10
|
+
"mask_w": 32,
|
|
11
|
+
"mask_h": 32,
|
|
12
|
+
"scale_mode": "stretch",
|
|
13
|
+
"slice_left": 0,
|
|
14
|
+
"slice_top": 0,
|
|
15
|
+
"slice_right": 0,
|
|
16
|
+
"slice_bottom": 0,
|
|
17
|
+
"frames": [
|
|
18
|
+
{
|
|
19
|
+
"name": "0.png"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"origin_x": 0,
|
|
3
|
+
"origin_y": 0,
|
|
4
|
+
"width": 32,
|
|
5
|
+
"height": 32,
|
|
6
|
+
"anim_speed": 15,
|
|
7
|
+
"mask_type": "rectangle",
|
|
8
|
+
"mask_x": 0,
|
|
9
|
+
"mask_y": 0,
|
|
10
|
+
"mask_w": 32,
|
|
11
|
+
"mask_h": 32,
|
|
12
|
+
"scale_mode": "stretch",
|
|
13
|
+
"slice_left": 0,
|
|
14
|
+
"slice_top": 0,
|
|
15
|
+
"slice_right": 0,
|
|
16
|
+
"slice_bottom": 0,
|
|
17
|
+
"frames": [
|
|
18
|
+
{
|
|
19
|
+
"name": "0.png"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"origin_x": 0,
|
|
3
|
+
"origin_y": 0,
|
|
4
|
+
"width": 32,
|
|
5
|
+
"height": 32,
|
|
6
|
+
"anim_speed": 15,
|
|
7
|
+
"mask_type": "rectangle",
|
|
8
|
+
"mask_x": 0,
|
|
9
|
+
"mask_y": 0,
|
|
10
|
+
"mask_w": 32,
|
|
11
|
+
"mask_h": 32,
|
|
12
|
+
"scale_mode": "tile",
|
|
13
|
+
"slice_left": 1,
|
|
14
|
+
"slice_top": 1,
|
|
15
|
+
"slice_right": 1,
|
|
16
|
+
"slice_bottom": 1,
|
|
17
|
+
"frames": [
|
|
18
|
+
{
|
|
19
|
+
"name": "0.png"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|