forked from FOSS/BangleApps
Speed updates
parent
7d8d1a8f6f
commit
3b14b2d5ba
|
@ -206,7 +206,7 @@
|
||||||
{ "id": "trex",
|
{ "id": "trex",
|
||||||
"name": "T-Rex",
|
"name": "T-Rex",
|
||||||
"icon": "trex.png",
|
"icon": "trex.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "T-Rex game in the style of Chrome's offline game",
|
"description": "T-Rex game in the style of Chrome's offline game",
|
||||||
"tags": "game",
|
"tags": "game",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
{ "id": "astroid",
|
{ "id": "astroid",
|
||||||
"name": "Asteroids!",
|
"name": "Asteroids!",
|
||||||
"icon": "asteroids.png",
|
"icon": "asteroids.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "Retro asteroids game",
|
"description": "Retro asteroids game",
|
||||||
"tags": "game",
|
"tags": "game",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
|
@ -780,7 +780,7 @@
|
||||||
{ "id": "flappy",
|
{ "id": "flappy",
|
||||||
"name": "Flappy Bird",
|
"name": "Flappy Bird",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.03",
|
"version":"0.04",
|
||||||
"description": "A Flappy Bird game clone",
|
"description": "A Flappy Bird game clone",
|
||||||
"tags": "game",
|
"tags": "game",
|
||||||
"allow_emulator":true,
|
"allow_emulator":true,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
0.02: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast
|
|
@ -59,6 +59,7 @@ function gameStart() {
|
||||||
|
|
||||||
|
|
||||||
function onFrame() {
|
function onFrame() {
|
||||||
|
"ram"
|
||||||
var t = getTime();
|
var t = getTime();
|
||||||
var d = (lastFrame===undefined)?0:(t-lastFrame)*20;
|
var d = (lastFrame===undefined)?0:(t-lastFrame)*20;
|
||||||
lastFrame = t;
|
lastFrame = t;
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
0.02: Tweaks to make flappy bird run with less RAM available
|
0.02: Tweaks to make flappy bird run with less RAM available
|
||||||
0.03: A few tweaks to improve rendering speed
|
0.03: A few tweaks to improve rendering speed
|
||||||
|
0.04: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast
|
||||||
|
|
|
@ -32,10 +32,11 @@ function gameStop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
|
"ram"
|
||||||
var H = g.getHeight()-24;
|
var H = g.getHeight()-24;
|
||||||
g.setColor("#71c6cf");
|
g.setColor("#71c6cf");
|
||||||
g.fillRect(0,0,g.getWidth(),H-1);
|
g.fillRect(0,0,g.getWidth(),H-1);
|
||||||
floorpos++;
|
floorpos++;
|
||||||
for (var x=-(floorpos&15);x<g.getWidth();x+=16)
|
for (var x=-(floorpos&15);x<g.getWidth();x+=16)
|
||||||
g.drawImage(FLOORIMG,x,H);
|
g.drawImage(FLOORIMG,x,H);
|
||||||
|
|
||||||
|
@ -78,13 +79,13 @@ function draw() {
|
||||||
g.setColor("#538917"); // right
|
g.setColor("#538917"); // right
|
||||||
g.fillRect(b.x2-3, 0, b.x2-1, btop-1);
|
g.fillRect(b.x2-3, 0, b.x2-1, btop-1);
|
||||||
g.fillRect(b.x2-3, bbot, b.x2-1, H-1);
|
g.fillRect(b.x2-3, bbot, b.x2-1, H-1);
|
||||||
g.setColor("#808080"); // outlines
|
g.setColor("#808080"); // outlines
|
||||||
g.drawRect(b.x1, btop-5, b.x2, btop); // top
|
g.drawRect(b.x1, btop-5, b.x2, btop); // top
|
||||||
g.drawLine(b.x1+1, 0, b.x1+1, btop-6);
|
g.drawLine(b.x1+1, 0, b.x1+1, btop-6);
|
||||||
g.drawLine(b.x2-2, 0, b.x2-2, btop-6);
|
g.drawLine(b.x2-2, 0, b.x2-2, btop-6);
|
||||||
g.drawRect(b.x1, bbot, b.x2, bbot+5); // bottom
|
g.drawRect(b.x1, bbot, b.x2, bbot+5); // bottom
|
||||||
g.drawLine(b.x1+1, bbot+6, b.x1+1, H-1);
|
g.drawLine(b.x1+1, bbot+6, b.x1+1, H-1);
|
||||||
g.drawLine(b.x2-1, bbot+6, b.x2-1, H-1);
|
g.drawLine(b.x2-1, bbot+6, b.x2-1, H-1);
|
||||||
if (b.x1<6 && (birdy-3<btop || birdy+3>bbot))
|
if (b.x1<6 && (birdy-3<btop || birdy+3>bbot))
|
||||||
gameStop();
|
gameStop();
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
0.02: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast
|
|
@ -165,6 +165,7 @@ function gameStop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFrame() {
|
function onFrame() {
|
||||||
|
"ram"
|
||||||
g.clear();
|
g.clear();
|
||||||
if (rex.alive) {
|
if (rex.alive) {
|
||||||
frame++;
|
frame++;
|
||||||
|
|
Loading…
Reference in New Issue