This commit is contained in:
John Alanbrook 2023-05-02 01:57:47 +00:00
parent e281a041bb
commit b3f3b9e2dd
7 changed files with 95 additions and 63 deletions

3
ball.png.asset Normal file
View file

@ -0,0 +1,3 @@
{
"sprite":false
}

8
brick.png.asset Normal file
View file

@ -0,0 +1,8 @@
{
"sprite":true,
"mips":false,
"gamma":false,
"frames":6,
"fps":24,
"loop":false
}

View file

@ -19,18 +19,10 @@ var Rainbow = {
blue: [53,51,255] blue: [53,51,255]
}; };
var Resources = [];
Resources["brick.png"] = {
frames:6,
fps:24,
loop:false
};
gameobject.clone("brick", { gameobject.clone("brick", {
collider: polygon2d.clone(), collider: polygon2d.clone(),
char: char2d.clone({ char: char2d.clone({
flash:"brick.png" flash:Resources.load("brick.png"),
}), }),
start() { start() {
@ -40,6 +32,8 @@ gameobject.clone("brick", {
this.flash(); this.flash();
this.timer.time = Math.random_range(2,10); this.timer.time = Math.random_range(2,10);
}, Math.random_range(2,10)); }, Math.random_range(2,10));
this.char.color = Rainbow.red;
}, },
flash() { flash() {
@ -51,7 +45,20 @@ gameobject.clone("brick", {
}, },
}); });
gameobject.clone("paddle", { var act_x = Action.add_new("move");
act_x.inputs.push("axis_ljoy");
var paddle = gameobject.clone("paddle", {
collider: polygon2d.clone(), collider: polygon2d.clone(),
img: sprite.clone(), img: sprite.clone(),
speed: 10,
gamepad_ljoy_axis(v) {
v[1] = 0;
this.pos = this.pos.add(v.scale(this.speed));
},
setup() {
Player.players[0].control(this);
},
}); });

View file

@ -1 +1 @@
Yugine v. 0.0.1-bfa523d, sys dbg. Yugine v. 0.0.1-43a543e, sys dbg.

View file

@ -1,3 +1,5 @@
Debug.draw_phys(true); Debug.draw_phys(true);
sim_start(); sim_start();
Level.loadlevel("lvl1.lvl"); World.loadfile("lvl1.lvl");
World.spawn(gameobjects['ball']);

View file

@ -4,58 +4,66 @@
"edge2d": { "edge2d": {
"degrees": 1 "degrees": 1
}, },
"_pos": [ "pos": [
6.123234262925839e-17, 6.123234262925839e-17,
0 0
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
-362.99999999999994, -363,
51.00000000000004 51
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
2.9999999999999987, 3,
52.00000000000001 52
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
336, 336,
52.00000000000001 52
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
-196.99999999999997, -197,
138.00000000000006 138
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
175, 175,
133 133
], ],
"_angle": 0 "angle": 0
}, },
{ {
"from": "brick", "from": "brick",
"_pos": [ "pos": [
-18.00000000000003, -18,
222 222
], ],
"_angle": 0 "angle": 0
},
{
"from": "paddle",
"pos": [
2.264005184173584,
-241.11599731445312
],
"angle": 0
} }
] ]

View file

@ -46,34 +46,6 @@
"_scale": 2.919193983078003, "_scale": 2.919193983078003,
"from": "gameobject" "from": "gameobject"
}, },
"brick": {
"collider": {
"points": [
[
-47.97179412841797,
3.9855456352233887
]
],
"mirrory": true,
"mirrorx": true
},
"char": {
"anims": {
"flash": {
"path": "brick.png",
"frames": 6,
"fps": 24,
"loop": false
}
},
"_pos": [
-0.5,
-0.5
]
},
"_scale": 2.9100000858306885,
"from": "gameobject"
},
"paddle": { "paddle": {
"collider": { "collider": {
"points": [ "points": [
@ -110,5 +82,37 @@
"mirrory": true, "mirrory": true,
"mirrorx": true "mirrorx": true
} }
},
"brick": {
"collider": {
"points": [
[
-37,
15
]
],
"mirrory": true,
"mirrorx": true
},
"char": {
"anims": {
"flash": {
"path": "brick.png",
"sprite": true,
"mips": false,
"gamma": false,
"frames": 6,
"fps": 24,
"loop": false
}
},
"_path": "brick.png"
},
"pos": [
43,
-165
],
"angle": 0,
"from": "gameobject"
} }
} }