convert to new prosperon version
This commit is contained in:
parent
9f49fc4cb8
commit
3a723b8b69
|
@ -1 +0,0 @@
|
||||||
{"_list":["watcher","gui","endgui","getready","scorewall","bird","pipe","startgui","background","ground","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur","prosperon/ur"],"watcher":{"name":"watcher","text":"watcher.jso"},"gui":{"name":"gui","text":"gui.jso"},"endgui":{"name":"endgui","text":"endgui.jso"},"getready":{"name":"getready","text":"getready.jso","data":"getready.json"},"scorewall":{"name":"scorewall","text":"scorewall.jso","data":"scorewall.json"},"bird":{"name":"bird","text":"bird/bird.jso","data":"bird/bird.json"},"pipe":{"name":"pipe","text":"pipe.jso","data":"pipe.json"},"startgui":{"name":"startgui","text":"startgui.jso"},"background":{"name":"background","data":"background/background.json"},"ground":{"name":"ground","data":"ground.json"},"prosperon/ur":{"name":"prosperon/ur","data":"audio/.prosperon/ur.json"}}
|
|
|
@ -1 +0,0 @@
|
||||||
{"_list":["watcher","gui","bird","scorewall","pipe","startgui","ground","background"],"watcher":{"name":"watcher","text":"watcher.jso"},"gui":{"name":"gui","text":"gui.jso"},"bird":{"name":"bird","text":"bird.jso","data":"bird.json"},"scorewall":{"name":"scorewall","text":"scorewall.jso","data":"scorewall.json"},"pipe":{"name":"pipe","text":"pipe.jso","data":"pipe.json"},"startgui":{"name":"startgui","text":"startgui.jso"},"ground":{"name":"ground","data":"ground.json"},"background":{"name":"background","data":"background.json"}}
|
|
4
background/background.jso
Normal file
4
background/background.jso
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
this.physupdate = function()
|
||||||
|
{
|
||||||
|
this.pos = Game.camera.pos;
|
||||||
|
}
|
|
@ -10,10 +10,9 @@
|
||||||
1
|
1
|
||||||
],
|
],
|
||||||
"pos": [
|
"pos": [
|
||||||
0,
|
-144,
|
||||||
0
|
-256
|
||||||
],
|
],
|
||||||
"parallax": 10000000000000000,
|
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"scale": [
|
"scale": [
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -7,20 +7,19 @@ this.physupdate = function() {
|
||||||
this.angle = this.velocity.y / 6000;
|
this.angle = this.velocity.y / 6000;
|
||||||
};
|
};
|
||||||
|
|
||||||
var flap = true;
|
this.flap = function()
|
||||||
|
|
||||||
this.inputs = {};
|
|
||||||
this.inputs.space = function()
|
|
||||||
{
|
{
|
||||||
this.velocity = [this.velocity.x,0];
|
this.velocity = [this.velocity.x,0];
|
||||||
this.pulse([0,400]);
|
this.pulse([0,400]);
|
||||||
this.cry("wing.qoa");
|
this.cry("wing.qoa");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.inputs = {};
|
||||||
|
this.inputs.space = function() { this.flap(); }
|
||||||
|
|
||||||
this.collide = function(hit)
|
this.collide = function(hit)
|
||||||
{
|
{
|
||||||
if (hit.obj.ur === 'pipe' || hit.obj.ur === 'ground') {
|
if (hit.obj.ur === 'pipe' || hit.obj.ur === 'ground') {
|
||||||
flap = false;
|
|
||||||
this.circle2d.enabled = false;
|
this.circle2d.enabled = false;
|
||||||
this.velocity = [0,0];
|
this.velocity = [0,0];
|
||||||
player[0].uncontrol(this);
|
player[0].uncontrol(this);
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Window.width = 288;
|
Game.width = 288;
|
||||||
Window.height = 512;
|
Game.height = 512;
|
||||||
|
|
|
@ -5,10 +5,3 @@ this.gui = function()
|
||||||
GUI.text(`SCORE\n${game.score}`, [50,300],2);
|
GUI.text(`SCORE\n${game.score}`, [50,300],2);
|
||||||
GUI.text("Tap to restart", [50,100],2);
|
GUI.text("Tap to restart", [50,100],2);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inputs = {};
|
|
||||||
this.inputs.space = function()
|
|
||||||
{
|
|
||||||
game.inputs.space();
|
|
||||||
this.kill();
|
|
||||||
}
|
|
53
game.js
53
game.js
|
@ -1,25 +1,27 @@
|
||||||
physics.gravity.strength = 1500;
|
physics.gravity.strength = 1500;
|
||||||
physics.gravity.mask = [true];
|
physics.gravity.mask = [true];
|
||||||
|
|
||||||
var bird = world.spawn(ur.bird);
|
var bird = world.spawn(ur.bird);
|
||||||
bird.pos = [0,0];
|
bird.pos = [0,0];
|
||||||
|
|
||||||
world.spawn(ur.watcher);
|
this.spawn("watcher.js");
|
||||||
world.spawn(ur.gui);
|
this.spawn("gui.js");
|
||||||
|
world.spawn(ur.background);
|
||||||
|
|
||||||
var game = {};
|
|
||||||
var ready;
|
var ready;
|
||||||
|
var end;
|
||||||
|
this.score = 0;
|
||||||
|
|
||||||
var savefile = json.decode(io.slurp("@save.json"));
|
var savefile = json.decode(io.slurp("@save.json"));
|
||||||
if (savefile) game.save = savefile;
|
if (savefile) this.save = savefile;
|
||||||
else
|
else
|
||||||
game.save = {high:0};
|
this.save = {high:0};
|
||||||
|
|
||||||
game.prepare = function()
|
this.prepare = function()
|
||||||
{
|
{
|
||||||
game.score = 0;
|
this.score = 0;
|
||||||
game.time = 3;
|
this.time = 3;
|
||||||
ready = world.spawn(ur.getready);
|
ready = this.spawn("getready.js");
|
||||||
ready.pos = [-ready.width()/2, -ready.height()/2];
|
|
||||||
player[0].control(ready);
|
player[0].control(ready);
|
||||||
bird.hide();
|
bird.hide();
|
||||||
bird.pos = [0,-50];
|
bird.pos = [0,-50];
|
||||||
|
@ -27,34 +29,35 @@ game.prepare = function()
|
||||||
bird.warp_layer = [false];
|
bird.warp_layer = [false];
|
||||||
}
|
}
|
||||||
|
|
||||||
game.start = function()
|
this.start = function()
|
||||||
{
|
{
|
||||||
ready.kill();
|
|
||||||
bird.warp_layer = [true];
|
bird.warp_layer = [true];
|
||||||
player[0].control(bird);
|
player[0].control(bird);
|
||||||
bird.show();
|
bird.show();
|
||||||
bird.inputs.space.call(bird);
|
bird.flap();
|
||||||
bird.pulse([100,0]);
|
bird.pulse([100,0]);
|
||||||
bird.circle2d.enabled = true;
|
bird.circle2d.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.gameover = function()
|
this.gameover = function()
|
||||||
{
|
{
|
||||||
if (game.score > game.save.high) {
|
if (this.score > this.save.high) {
|
||||||
game.save.high = game.score;
|
this.save.high = this.score;
|
||||||
io.slurpwrite("@save.json", json.encode(game.save));
|
io.slurpwrite("@save.json", json.encode(this.save));
|
||||||
}
|
}
|
||||||
|
|
||||||
player[0].control(world.spawn(ur.endgui));
|
end = this.spawn("endgui.js");
|
||||||
|
this.delay(function() {
|
||||||
|
player[0].control(this);
|
||||||
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
game.inputs = {};
|
this.inputs = {};
|
||||||
game.inputs.space = function()
|
this.inputs.space = function()
|
||||||
{
|
{
|
||||||
game.prepare();
|
end.kill();
|
||||||
player[0].uncontrol(game);
|
this.prepare();
|
||||||
|
player[0].uncontrol(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
game.prepare();
|
this.prepare();
|
||||||
|
|
||||||
return {game};
|
|
||||||
|
|
10
getready.js
Normal file
10
getready.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
this.gui = function()
|
||||||
|
{
|
||||||
|
GUI.image("sprites/message.png", [50,100]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.inputs = {};
|
||||||
|
this.inputs.space = function() {
|
||||||
|
game.start();
|
||||||
|
this.kill();
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
this.inputs = {};
|
|
||||||
this.inputs.space = function() {
|
|
||||||
game.start();
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"sprite": {
|
|
||||||
"path": "sprites/message.png",
|
|
||||||
"enabled": true,
|
|
||||||
"color": [
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"pos": [
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"parallax": 1,
|
|
||||||
"angle": 0,
|
|
||||||
"scale": [
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"drawmode": 0,
|
|
||||||
"comp": "sprite"
|
|
||||||
}
|
|
||||||
}
|
|
4
gui.js
Normal file
4
gui.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
this.gui = function()
|
||||||
|
{
|
||||||
|
GUI.text(String(game.score).padStart(4,"0"), [5,480], 2, Color.blue);
|
||||||
|
}
|
4
gui.jso
4
gui.jso
|
@ -1,4 +0,0 @@
|
||||||
this.gui = function()
|
|
||||||
{
|
|
||||||
GUI.text(String(game.score).padStart(4,"0"), [5,480], 2);
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@
|
||||||
"edge2d": {
|
"edge2d": {
|
||||||
"thickness": 0,
|
"thickness": 0,
|
||||||
"sensor": true,
|
"sensor": true,
|
||||||
"cpoints": [
|
"points": [
|
||||||
[
|
[
|
||||||
-0.11655732989311218,
|
-0.11655732989311218,
|
||||||
-31.846646707504988
|
-31.846646707504988
|
||||||
|
|
|
@ -12,17 +12,11 @@ var pipe_pair = function(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
var gndx = -1000;
|
var gndx = -1000;
|
||||||
var bgx = -1000;
|
var lastpipe = Game.camera.right() - 100;
|
||||||
var lastpipe = Game.camera.right() + 50;
|
|
||||||
|
|
||||||
this.start = function()
|
this.start = function()
|
||||||
{
|
{
|
||||||
pipe_pair(lastpipe);
|
pipe_pair(lastpipe);
|
||||||
var bg = world.spawn(ur.background);
|
|
||||||
bg.pos = [bgx,-bg.height()/2];
|
|
||||||
bgx += bg.width()-1;
|
|
||||||
bg = world.spawn(ur.background);
|
|
||||||
bg.pos = [bgx,-bg.height()/2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update = function()
|
this.update = function()
|
||||||
|
@ -33,12 +27,6 @@ this.update = function()
|
||||||
gndx += g.width()-3;
|
gndx += g.width()-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (bgx < Game.camera.right()) {
|
|
||||||
var bg = world.spawn(ur.background);
|
|
||||||
bg.pos = [bgx, -bg.height()/2];
|
|
||||||
bgx += bg.width()-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Game.camera.pos.x > lastpipe-200) {
|
if (Game.camera.pos.x > lastpipe-200) {
|
||||||
lastpipe += 200;
|
lastpipe += 200;
|
||||||
pipe_pair(lastpipe);
|
pipe_pair(lastpipe);
|
Loading…
Reference in a new issue