1
0
Fork 0

Speed updates

master
Gordon Williams 2020-05-05 13:42:27 +01:00
parent 7d8d1a8f6f
commit 3b14b2d5ba
7 changed files with 16 additions and 10 deletions

View File

@ -206,7 +206,7 @@
{ "id": "trex",
"name": "T-Rex",
"icon": "trex.png",
"version":"0.01",
"version":"0.02",
"description": "T-Rex game in the style of Chrome's offline game",
"tags": "game",
"allow_emulator":true,
@ -218,7 +218,7 @@
{ "id": "astroid",
"name": "Asteroids!",
"icon": "asteroids.png",
"version":"0.01",
"version":"0.02",
"description": "Retro asteroids game",
"tags": "game",
"allow_emulator":true,
@ -780,7 +780,7 @@
{ "id": "flappy",
"name": "Flappy Bird",
"icon": "app.png",
"version":"0.03",
"version":"0.04",
"description": "A Flappy Bird game clone",
"tags": "game",
"allow_emulator":true,

1
apps/astroid/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.02: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast

View File

@ -59,6 +59,7 @@ function gameStart() {
function onFrame() {
"ram"
var t = getTime();
var d = (lastFrame===undefined)?0:(t-lastFrame)*20;
lastFrame = t;

View File

@ -1,2 +1,3 @@
0.02: Tweaks to make flappy bird run with less RAM available
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

View File

@ -32,10 +32,11 @@ function gameStop() {
}
function draw() {
"ram"
var H = g.getHeight()-24;
g.setColor("#71c6cf");
g.fillRect(0,0,g.getWidth(),H-1);
floorpos++;
floorpos++;
for (var x=-(floorpos&15);x<g.getWidth();x+=16)
g.drawImage(FLOORIMG,x,H);
@ -78,13 +79,13 @@ function draw() {
g.setColor("#538917"); // right
g.fillRect(b.x2-3, 0, b.x2-1, btop-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.drawLine(b.x1+1, 0, b.x1+1, btop-6);
g.drawLine(b.x2-2, 0, b.x2-2, btop-6);
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.x2-1, bbot+6, b.x2-1, H-1);
g.drawLine(b.x1+1, 0, b.x1+1, btop-6);
g.drawLine(b.x2-2, 0, b.x2-2, btop-6);
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.x2-1, bbot+6, b.x2-1, H-1);
if (b.x1<6 && (birdy-3<btop || birdy+3>bbot))
gameStop();
});

1
apps/trex/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.02: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast

View File

@ -165,6 +165,7 @@ function gameStop() {
}
function onFrame() {
"ram"
g.clear();
if (rex.alive) {
frame++;