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
|
||||
],
|
||||
"pos": [
|
||||
0,
|
||||
0
|
||||
-144,
|
||||
-256
|
||||
],
|
||||
"parallax": 10000000000000000,
|
||||
"angle": 0,
|
||||
"scale": [
|
||||
1,
|
||||
|
|
|
@ -7,20 +7,19 @@ this.physupdate = function() {
|
|||
this.angle = this.velocity.y / 6000;
|
||||
};
|
||||
|
||||
var flap = true;
|
||||
|
||||
this.inputs = {};
|
||||
this.inputs.space = function()
|
||||
this.flap = function()
|
||||
{
|
||||
this.velocity = [this.velocity.x,0];
|
||||
this.pulse([0,400]);
|
||||
this.cry("wing.qoa");
|
||||
}
|
||||
|
||||
this.inputs = {};
|
||||
this.inputs.space = function() { this.flap(); }
|
||||
|
||||
this.collide = function(hit)
|
||||
{
|
||||
if (hit.obj.ur === 'pipe' || hit.obj.ur === 'ground') {
|
||||
flap = false;
|
||||
this.circle2d.enabled = false;
|
||||
this.velocity = [0,0];
|
||||
player[0].uncontrol(this);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Window.width = 288;
|
||||
Window.height = 512;
|
||||
Game.width = 288;
|
||||
Game.height = 512;
|
||||
|
|
|
@ -5,10 +5,3 @@ this.gui = function()
|
|||
GUI.text(`SCORE\n${game.score}`, [50,300],2);
|
||||
GUI.text("Tap to restart", [50,100],2);
|
||||
}
|
||||
|
||||
this.inputs = {};
|
||||
this.inputs.space = function()
|
||||
{
|
||||
game.inputs.space();
|
||||
this.kill();
|
||||
}
|
55
game.js
55
game.js
|
@ -1,25 +1,27 @@
|
|||
physics.gravity.strength = 1500;
|
||||
physics.gravity.mask = [true];
|
||||
|
||||
var bird = world.spawn(ur.bird);
|
||||
bird.pos = [0,0];
|
||||
|
||||
world.spawn(ur.watcher);
|
||||
world.spawn(ur.gui);
|
||||
this.spawn("watcher.js");
|
||||
this.spawn("gui.js");
|
||||
world.spawn(ur.background);
|
||||
|
||||
var game = {};
|
||||
var ready;
|
||||
var end;
|
||||
this.score = 0;
|
||||
|
||||
var savefile = json.decode(io.slurp("@save.json"));
|
||||
if (savefile) game.save = savefile;
|
||||
if (savefile) this.save = savefile;
|
||||
else
|
||||
game.save = {high:0};
|
||||
this.save = {high:0};
|
||||
|
||||
game.prepare = function()
|
||||
this.prepare = function()
|
||||
{
|
||||
game.score = 0;
|
||||
game.time = 3;
|
||||
ready = world.spawn(ur.getready);
|
||||
ready.pos = [-ready.width()/2, -ready.height()/2];
|
||||
this.score = 0;
|
||||
this.time = 3;
|
||||
ready = this.spawn("getready.js");
|
||||
player[0].control(ready);
|
||||
bird.hide();
|
||||
bird.pos = [0,-50];
|
||||
|
@ -27,34 +29,35 @@ game.prepare = function()
|
|||
bird.warp_layer = [false];
|
||||
}
|
||||
|
||||
game.start = function()
|
||||
this.start = function()
|
||||
{
|
||||
ready.kill();
|
||||
bird.warp_layer = [true];
|
||||
player[0].control(bird);
|
||||
bird.show();
|
||||
bird.inputs.space.call(bird);
|
||||
bird.flap();
|
||||
bird.pulse([100,0]);
|
||||
bird.circle2d.enabled = true;
|
||||
}
|
||||
|
||||
game.gameover = function()
|
||||
this.gameover = function()
|
||||
{
|
||||
if (game.score > game.save.high) {
|
||||
game.save.high = game.score;
|
||||
io.slurpwrite("@save.json", json.encode(game.save));
|
||||
if (this.score > this.save.high) {
|
||||
this.save.high = this.score;
|
||||
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 = {};
|
||||
game.inputs.space = function()
|
||||
this.inputs = {};
|
||||
this.inputs.space = function()
|
||||
{
|
||||
game.prepare();
|
||||
player[0].uncontrol(game);
|
||||
end.kill();
|
||||
this.prepare();
|
||||
player[0].uncontrol(this);
|
||||
}
|
||||
|
||||
game.prepare();
|
||||
|
||||
return {game};
|
||||
this.prepare();
|
||||
|
|
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": {
|
||||
"thickness": 0,
|
||||
"sensor": true,
|
||||
"cpoints": [
|
||||
"points": [
|
||||
[
|
||||
-0.11655732989311218,
|
||||
-31.846646707504988
|
||||
|
@ -15,4 +15,4 @@
|
|||
],
|
||||
"comp": "edge2d"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,17 +12,11 @@ var pipe_pair = function(x)
|
|||
}
|
||||
|
||||
var gndx = -1000;
|
||||
var bgx = -1000;
|
||||
var lastpipe = Game.camera.right() + 50;
|
||||
var lastpipe = Game.camera.right() - 100;
|
||||
|
||||
this.start = function()
|
||||
{
|
||||
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()
|
||||
|
@ -33,14 +27,8 @@ this.update = function()
|
|||
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) {
|
||||
lastpipe += 200;
|
||||
pipe_pair(lastpipe);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue