Skip to content

Commit

Permalink
update littlejs
Browse files Browse the repository at this point in the history
small changes to work with latest version and improved build setup
  • Loading branch information
KilledByAPixel committed Jul 8, 2023
1 parent f706072 commit 07e5651
Show file tree
Hide file tree
Showing 10 changed files with 8,813 additions and 8,424 deletions.
20 changes: 0 additions & 20 deletions LittleJS/README.md

This file was deleted.

13 changes: 5 additions & 8 deletions LittleJS/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ rmdir /s /q %BUILD_FOLDER%

rem copy engine release build
mkdir %BUILD_FOLDER%
cd %BUILD_FOLDER%
type ..\engine\engine.all.release.js >> %BUILD_FILENAME%
pushd %BUILD_FOLDER%
type ..\littlejs.release.js >> %BUILD_FILENAME%
echo. >> %BUILD_FILENAME%

rem add your game's files to include here
Expand All @@ -33,9 +33,8 @@ if %ERRORLEVEL% NEQ 0 (
)
del %BUILD_FILENAME%.temp

rem more minification with uglify or terser (they both do about the same)
rem more minification with uglify
call npx uglifyjs -o %BUILD_FILENAME% --compress --mangle -- %BUILD_FILENAME%
rem call terser -o %BUILD_FILENAME% --compress --mangle -- %BUILD_FILENAME%
if %ERRORLEVEL% NEQ 0 (
pause
exit /b %ERRORLEVEL%
Expand All @@ -51,7 +50,7 @@ if %ERRORLEVEL% NEQ 0 (

rem build the html, you can add html header and footers here
rem type ..\header.html >> index.html
echo ^<body^>^<meta charset=utf-8^>^<script^> >> index.html
echo ^<body^>^<script^> >> index.html
type roadroller_%BUILD_FILENAME% >> index.html
echo ^</script^> >> index.html

Expand All @@ -62,6 +61,4 @@ if %ERRORLEVEL% NEQ 0 (
exit /b %ERRORLEVEL%
)

cd ..

rem pause to see result
popd rem BUILD_FOLDER
10 changes: 0 additions & 10 deletions LittleJS/buildSetup.bat

This file was deleted.

4 changes: 2 additions & 2 deletions LittleJS/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ function gameUpdatePost() // called after LittleJS objects are updated
///////////////////////////////////////////////////////////////////////////////
function gameRender() // called before LittleJS objects are rendered
{
// draw the background
drawRectScreenSpace(canvasFixedSize.scale(.5), canvasFixedSize, new Color(.13, .15, .2));
// draw the background without using webgl
drawRectScreenSpace(canvasFixedSize.scale(.5), canvasFixedSize, new Color(.13, .15, .2), 0, 0);
}

///////////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 3 additions & 4 deletions LittleJS/gameObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Paddle extends EngineObject
super(pos, size, tileIndex, tileSize);

// set up collision
this.setCollision(1, 1);
this.setCollision();
this.mass = 0;
}

Expand Down Expand Up @@ -63,7 +63,7 @@ class Block extends EngineObject
super(pos, size, tileIndex, tileSize, 0, color);

// set up collision
this.setCollision(1, 1);
this.setCollision();
this.mass = 0;

// draw smaller then physical size
Expand Down Expand Up @@ -110,9 +110,8 @@ class Ball extends EngineObject
super(pos, size, tileIndex, tileSize);

// set up collision
this.setCollision(1, 1);
this.setCollision();
this.elasticity = 1;
this.damping = 1;

// set start speed
this.velocity = vec2(0, -.2);
Expand Down
8 changes: 4 additions & 4 deletions LittleJS/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html><head><meta charset=utf-8>
<html><head>
<title>LittleJS js13k Breakout Demo</title>
</head><body>

<script src=engine/engine.all.js?9></script>
<script src=game.js?9></script>
<script src=gameObjects.js?9></script>
<script src=littlejs.js?1></script>
<script src=game.js?1></script>
<script src=gameObjects.js?1></script>
Binary file modified LittleJS/js13kBreakout.zip
Binary file not shown.
Loading

0 comments on commit 07e5651

Please sign in to comment.