├── .gitignore ├── .hgignore ├── .project ├── AUTHORS ├── CHANGELOG ├── LICENSE ├── README.md ├── doc ├── ICADE_QuickStart.pdf ├── _make_doc.bat ├── _run_server.bat ├── _tabfix.bat ├── arcade-js_tutorial.odt ├── arcade-js_tutorial.pdf ├── iPhone4_landscape.png ├── iPhone4_portrait.png ├── iphone3_landscape.png ├── iphone3_portrait.png ├── jsdocs │ ├── arcade.js │ │ └── jsdoc │ │ │ ├── files.html │ │ │ ├── index.html │ │ │ └── symbols │ │ │ ├── ArcadeCanvas.html │ │ │ ├── ArcadeJS.html │ │ │ ├── AudioJS.html │ │ │ ├── CanvasObject.html │ │ │ ├── HtmlOverlay.html │ │ │ ├── Movable.html │ │ │ ├── TouchButton.html │ │ │ ├── TouchStick.html │ │ │ ├── _global_.html │ │ │ └── src │ │ │ ├── src_arcade.js_arcade-controls.js.html │ │ │ └── src_arcade.js_arcade.js.html │ ├── demos │ │ └── jsdoc │ │ │ ├── files.html │ │ │ ├── index.html │ │ │ └── symbols │ │ │ ├── Rocket.html │ │ │ ├── _global_.html │ │ │ └── src │ │ │ ├── src_demos_asteroids_jsAsteroids.js.html │ │ │ └── src_demos_rip-off_jsRipOff.js.html │ └── lina.js │ │ └── jsdoc │ │ ├── files.html │ │ ├── index.html │ │ └── symbols │ │ ├── BiTran2.html │ │ ├── Circle2.html │ │ ├── LinaJS.html │ │ ├── Matrix3.html │ │ ├── Point2.html │ │ ├── Polygon2.html │ │ ├── Vec2.html │ │ ├── _global_.html │ │ └── src │ │ └── src_lina.js_lina.js.html ├── lina-js_tutorial.odt ├── lina-js_tutorial.pdf ├── rip-off_spec.odt └── rip-off_spec.pdf ├── res ├── apple-touch-icon1.png └── apple-touch-icon2.png └── src ├── arcade.js ├── MIT-License.txt ├── arcade-controls.js ├── arcade.js └── test │ ├── test-arcade.js │ └── test.html ├── demos ├── asteroids │ ├── damage.mp3 │ ├── damage.oga │ ├── damage.wav │ ├── fire.mp3 │ ├── fire.oga │ ├── fire.wav │ ├── index.html │ ├── jsAsteroids-debug.html │ ├── jsAsteroids-icade.html │ ├── jsAsteroids-mobile.html │ ├── jsAsteroids.html │ ├── jsAsteroids.js │ ├── screenshot-1.png │ ├── screenshot-2.png │ ├── screenshot-3.png │ ├── screenshot-icade.jpg │ ├── shot.mp3 │ ├── shot.ogg │ ├── shot.wav │ └── source.html ├── billiards │ ├── applause.wav │ ├── click.wav │ ├── jsBilliards-mobile.html │ ├── jsBilliards.html │ ├── jsBilliards.js │ ├── screenshot-1.png │ └── source.html ├── collisions │ ├── game.html │ ├── game.js │ ├── screenshot-1.png │ └── source.html ├── index.html ├── quirks │ ├── apple-touch-icon.png │ ├── iphone.css │ ├── jsQuirks-mobile.html │ ├── jsQuirks.html │ ├── jsQuirks.js │ ├── screenshot-1.png │ ├── source.html │ ├── thrust.mp3 │ └── thrust.wav ├── rip-off │ ├── damage.mp3 │ ├── damage.oga │ ├── fire.mp3 │ ├── fire.oga │ ├── index.html │ ├── jsRipOff-2.html │ ├── jsRipOff-icade.html │ ├── jsRipOff-mobile.html │ ├── jsRipOff-tablet-2player.html │ ├── jsRipOff-test.html │ ├── jsRipOff.html │ ├── jsRipOff.js │ ├── screenshot-1.png │ └── source.html └── test │ ├── _test_audio.html │ ├── _test_resize.html │ ├── benchmark_1.html │ ├── test.mp3 │ ├── test.oga │ ├── test.ogg │ └── test.wav ├── depends ├── demos.css ├── demos.js ├── jquery.js ├── jquery.min.js ├── jquery.mousewheel.js ├── prettify.css ├── prettify.js ├── processing.js ├── qunit.css └── qunit.js └── lina.js ├── MIT-License.txt ├── lina.js └── test ├── test-lina.js └── test.html /.gitignore: -------------------------------------------------------------------------------- 1 | .pydevproject -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | glob:res/ 2 | glob:*.bak 3 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jsRipOff 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | 19 | todo_ArcadeJS.txt 20 | 1 21 | C:/Privat/Martin/My Dropbox/todo_ArcadeJS.txt 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Martin Wendt -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | # 0.0.2 / (unreleased) 2 | 3 | * Changed license to MIT only (was MIT + GPL) 4 | * Add methods `game.isKeyClicked()` and `button.isClicked()` with support for 5 | limited click rates and permanent fire (unlike the existing `isDown` methods). 6 | * Add iCade support (https://en.wikipedia.org/wiki/ICade) 7 | 8 | 9 | # 0.0.1 / 2010-07-17 10 | 11 | * Started 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Martin Wendt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arcade.js [](http://sapegin.github.io/powered-by-you/) 2 | 3 | > Arcade.js is a 2d game engine based on JavaScript and HTML5 Canvas. 4 | > Written 2010 by Martin Wendt, Licensed MIT. 5 | 6 | ArcadeJS is a 2d game engine, written in pure JavaScript. 7 | It requires HTML5, namely support for `` and `` elements. 8 | This package was developed during a summer hollyday 2010 and finished during 9 | winter 2010. 10 | The goal of this fun project was to learn about HTML5 and implement a clone of 11 | the Rip-Off game. As a consequence I borrowed a lot (especially from processing.js), 12 | reinvented some wheels, and stuck with rather simple vector graphics for the 13 | demo games. 14 | 15 | **Note:** this project is not actively maintained. 16 | 17 | The repository was [migrated from Google Code](https://code.google.com/p/arcade-js/) 2015-03-15, 18 | because [Google Code Project Hosting was turned down](http://google-opensource.blogspot.de/2015/03/farewell-to-google-code.html). 19 | 20 | The project consists of 21 | 22 | - lina.js 23 | An independent, object oriented library for points, vectors, and homogeneous 24 | transformations in 2D space. 25 | A polygon class helps with collision detection and hit testing. 26 | 27 | - arcade.js 28 | A 2D game engine that provides a render loop and support for multiple 29 | moving objects. 30 | Also sound, keyboard, mouse and touch events are supported. 31 | 32 | - arcade-controls.js 33 | Some controls (button, joystick) for mouse and touch screens. 34 | 35 | - Playable demos 36 | 37 | 38 | # Lina.js 39 | 40 | An independent, object oriented library for points, vectors, and homogeneous 41 | transformations in 2D space. 42 | A polygon class helps with collision detection and hit testing. 43 | 44 | - [Read the tutorial](https://rawgit.com/mar10/arcade-js/master/doc/lina-js_tutorial.pdf) 45 | - [Read the API docs](https://rawgit.com/mar10/arcade-js/master/doc/jsdocs/lina.js/jsdoc/index.html) 46 | - [Run tests](https://rawgit.com/mar10/arcade-js/master/src/lina.js/test/test.html) 47 | 48 | 49 | # Arcade.js 50 | 51 | A 2D game engine that provides a render loop and support for multiple moving objects. 52 | 53 | - [Read the tutorial](https://rawgit.com/mar10/arcade-js/master/doc/arcade-js_tutorial.pdf) 54 | - [Read the API docs](https://rawgit.com/mar10/arcade-js/master/doc/jsdocs/arcade.js/jsdoc/index.html). 55 | 56 | 57 | # Demos 58 | 59 | ## Rip-Off 60 | 61 | A port of the Rip-Off arcade game written by Tim Skelly / Cinematronix in 1980. 62 | Rip-Off, was the first arcade game with two-player cooperative play. The *bandits* 63 | use some early 'artifical intelligence' / flocking behavior. 64 | 65 | - [Read about the algorithm](https://rawgit.com/mar10/arcade-js/master/doc/rip-off_spec.pdf) 66 | - [Play single player, dual player, dual player split screen, or iCade version](https://rawgit.com/mar10/arcade-js/master/src/demos/rip-off/index.html) 67 | 68 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/rip-off/index.html) 69 | 70 | 71 | ## Asteroids 72 | 73 | A remake of the famous arcade game (~420 lines of code). 74 | 75 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/asteroids/index.html) 76 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/asteroids/index.html) 77 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/asteroids/index.html) 78 | 79 | 80 | ## Billiards 81 | 82 | A simple JavaScript implementation of carambolage using arcade.js. 83 | 84 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/billiards/jsBilliards.html) 85 | 86 | 87 | ## Quirks 88 | 89 | A simple render loop with two reflecting points. 90 | 91 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/quirks/jsQuirks.html) 92 | 93 | [Desktop](https://rawgit.com/mar10/arcade-js/master/src/demos/quirks/jsQuirks.html) 94 | — [Mobile](https://rawgit.com/mar10/arcade-js/master/src/demos/quirks/jsQuirks-mobile.html) 95 | 96 | 97 | ## Collisions 98 | 99 | This sample shows how to implement moving objects, circle-circle and circle-polygon 100 | collisions. 101 | 102 | [](https://rawgit.com/mar10/arcade-js/master/src/demos/collisions/game.html) 103 | -------------------------------------------------------------------------------- /doc/ICADE_QuickStart.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/ICADE_QuickStart.pdf -------------------------------------------------------------------------------- /doc/_make_doc.bat: -------------------------------------------------------------------------------- 1 | set JSDOC=C:\apps\jsdoc-toolkit-2.4.0 2 | 3 | rem java -jar %JSDOC%\jsrun.jar %JSDOC%\app\run.js -v -a -t=%JSDOC%\templates\jsdoc -d=jsdoc ..\src\lina.js\ ..\src\arcade.js\ ..\src\rip-off\ 4 | 5 | java -jar %JSDOC%\jsrun.jar %JSDOC%\app\run.js -v -a -t=%JSDOC%\templates\jsdoc -d=..\..\arcade-js-docs\lina.js\jsdoc ..\src\lina.js\ 6 | java -jar %JSDOC%\jsrun.jar %JSDOC%\app\run.js -v -a -t=%JSDOC%\templates\jsdoc -d=..\..\arcade-js-docs\arcade.js\jsdoc ..\src\arcade.js\ 7 | java -jar %JSDOC%\jsrun.jar %JSDOC%\app\run.js -v -a -t=%JSDOC%\templates\jsdoc -d=..\..\arcade-js-docs\demos\jsdoc ..\src\demos\asteroids\ ..\src\demos\rip-off\ ..\src\demos\billards\ 8 | 9 | pause -------------------------------------------------------------------------------- /doc/_run_server.bat: -------------------------------------------------------------------------------- 1 | wsgidav --host=0.0.0.0 --port=80 --root=C:\Prj\eclipse-ws\arcade-js\src 2 | pause 3 | -------------------------------------------------------------------------------- /doc/_tabfix.bat: -------------------------------------------------------------------------------- 1 | cd ..\src 2 | tabfix -tx --no-backup arcade.js\arcade.js 3 | tabfix -tx --no-backup arcade.js\arcade-controls.js 4 | tabfix -tx --no-backup lina.js\lina.js 5 | cd ..\src\demos 6 | tabfix -tx --no-backup -r -m*.js -m*.html -m*.css 7 | cd ..\..\doc 8 | pause -------------------------------------------------------------------------------- /doc/arcade-js_tutorial.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/arcade-js_tutorial.odt -------------------------------------------------------------------------------- /doc/arcade-js_tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/arcade-js_tutorial.pdf -------------------------------------------------------------------------------- /doc/iPhone4_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/iPhone4_landscape.png -------------------------------------------------------------------------------- /doc/iPhone4_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/iPhone4_portrait.png -------------------------------------------------------------------------------- /doc/iphone3_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/iphone3_landscape.png -------------------------------------------------------------------------------- /doc/iphone3_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/iphone3_portrait.png -------------------------------------------------------------------------------- /doc/jsdocs/arcade.js/jsdoc/files.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - File Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | ArcadeCanvas 190 | 191 | ArcadeJS 192 | 193 | AudioJS 194 | 195 | CanvasObject 196 | 197 | HtmlOverlay 198 | 199 | Movable 200 | 201 | TouchButton 202 | 203 | TouchStick 204 | 205 | 206 | 207 | 208 | 209 | 210 | File Index 211 | 212 | 213 | 214 | arcade.js 215 | arcade.js 216 | Copyright (c) 2010-2011, Martin Wendt (http://wwWendt.de) 217 | 218 | Dual licensed under the MIT or GPL Version 2 licenses. 219 | http://code.google.com/p/arcade-js/wiki/LicenseInfo 220 | 221 | A current version and some documentation is available at 222 | http://arcade-js.googlecode.com/ 223 | A 2D game engine that provides a render loop and support for 224 | multiple moving objects. 225 | 226 | 227 | Author: 228 | Martin Wendt 229 | 230 | 231 | Version: 232 | 0.0.1 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | arcade-controls.js 242 | arcade-controls.js 243 | Copyright (c) 2010-2011, Martin Wendt (http://wwWendt.de) 244 | 245 | Dual licensed under the MIT or GPL Version 2 licenses. 246 | http://code.google.com/p/arcade-js/wiki/LicenseInfo 247 | 248 | A current version and some documentation is available at 249 | http://arcade-js.googlecode.com/ 250 | Controls and tools for ArcadeJS on mobile devices. 251 | 252 | 253 | Author: 254 | Martin Wendt 255 | 256 | 257 | Version: 258 | 0.0.1 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:26 GMT+0200 (MESZ) 271 | 272 | 273 | -------------------------------------------------------------------------------- /doc/jsdocs/arcade.js/jsdoc/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | ArcadeCanvas 190 | 191 | ArcadeJS 192 | 193 | AudioJS 194 | 195 | CanvasObject 196 | 197 | HtmlOverlay 198 | 199 | Movable 200 | 201 | TouchButton 202 | 203 | TouchStick 204 | 205 | 206 | 207 | 208 | 209 | 210 | Class Index 211 | 212 | 213 | 214 | _global_ 215 | 216 | 217 | 218 | 219 | 220 | ArcadeCanvas 221 | 222 | 223 | 224 | 225 | 226 | ArcadeJS 227 | 228 | 229 | 230 | 231 | 232 | AudioJS 233 | 234 | 235 | 236 | 237 | 238 | CanvasObject 239 | 240 | 241 | 242 | 243 | 244 | HtmlOverlay 245 | 246 | 247 | 248 | 249 | 250 | Movable 251 | 252 | 253 | 254 | 255 | 256 | TouchButton 257 | 258 | 259 | 260 | 261 | 262 | TouchStick 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:26 GMT+0200 (MESZ) 272 | 273 | 274 | -------------------------------------------------------------------------------- /doc/jsdocs/arcade.js/jsdoc/symbols/HtmlOverlay.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - HtmlOverlay 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Class Index 187 | | File Index 188 | 189 | Classes 190 | 191 | 192 | _global_ 193 | 194 | ArcadeCanvas 195 | 196 | ArcadeJS 197 | 198 | AudioJS 199 | 200 | CanvasObject 201 | 202 | HtmlOverlay 203 | 204 | Movable 205 | 206 | TouchButton 207 | 208 | TouchStick 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | Class HtmlOverlay 220 | 221 | 222 | 223 | 224 | 225 | Extends 226 | Class. 227 | 228 | 229 | 230 | 231 | 232 | Defined in: arcade-controls.js. 233 | 234 | 235 | 236 | 237 | 238 | 239 | Class Summary 240 | 241 | 242 | Constructor Attributes 243 | Constructor Name and Description 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | HtmlOverlay() 252 | 253 | HTML overlay, attached to canvas. 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | Method Summary 269 | 270 | 271 | Method Attributes 272 | Method Name and Description 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | close() 281 | 282 | Hide and remove this box (triggers onClose callback). 283 | 284 | 285 | 286 | 287 | 288 | 289 | init(opts) 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | isDown() 299 | 300 | Return true if button is down (but mouse key / finger is also still down). 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | Class Detail 318 | 319 | 320 | 321 | HtmlOverlay() 322 | 323 | 324 | 325 | HTML overlay, attached to canvas. 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | Method Detail 350 | 351 | 352 | 353 | 354 | 355 | 356 | close() 357 | 358 | 359 | 360 | Hide and remove this box (triggers onClose callback). 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | init(opts) 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | Parameters: 395 | 396 | 397 | opts 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | isDown() 418 | 419 | 420 | 421 | Return true if button is down (but mouse key / finger is also still down). 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:26 GMT+0200 (MESZ) 451 | 452 | 453 | 454 | -------------------------------------------------------------------------------- /doc/jsdocs/arcade.js/jsdoc/symbols/_global_.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - _global_ 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Class Index 187 | | File Index 188 | 189 | Classes 190 | 191 | 192 | _global_ 193 | 194 | ArcadeCanvas 195 | 196 | ArcadeJS 197 | 198 | AudioJS 199 | 200 | CanvasObject 201 | 202 | HtmlOverlay 203 | 204 | Movable 205 | 206 | TouchButton 207 | 208 | TouchStick 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | Built-In Namespace _global_ 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | Method Summary 244 | 245 | 246 | Method Attributes 247 | Method Name and Description 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | _getTouchWithId(touchList, id) 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | Method Detail 280 | 281 | 282 | 283 | 284 | 285 | 286 | _getTouchWithId(touchList, id) 287 | 288 | 289 | 290 | 291 | 292 | 293 | Defined in: arcade-controls.js. 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | Parameters: 303 | 304 | 305 | touchList 306 | 307 | 308 | 309 | 310 | 311 | id 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:26 GMT+0200 (MESZ) 340 | 341 | 342 | 343 | -------------------------------------------------------------------------------- /doc/jsdocs/demos/jsdoc/files.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - File Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | Rocket 190 | 191 | 192 | 193 | 194 | 195 | 196 | File Index 197 | 198 | 199 | 200 | ..\src\demos\asteroids\jsAsteroids.js 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | ..\src\demos\rip-off\jsRipOff.js 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:30 GMT+0200 (MESZ) 228 | 229 | 230 | -------------------------------------------------------------------------------- /doc/jsdocs/demos/jsdoc/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | Rocket 190 | 191 | 192 | 193 | 194 | 195 | 196 | Class Index 197 | 198 | 199 | 200 | _global_ 201 | 202 | 203 | 204 | 205 | 206 | Rocket 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:30 GMT+0200 (MESZ) 216 | 217 | 218 | -------------------------------------------------------------------------------- /doc/jsdocs/demos/jsdoc/symbols/Rocket.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - Rocket 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Class Index 187 | | File Index 188 | 189 | Classes 190 | 191 | 192 | _global_ 193 | 194 | Rocket 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | Class Rocket 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | Defined in: jsAsteroids.js. 217 | 218 | 219 | 220 | 221 | 222 | 223 | Class Summary 224 | 225 | 226 | Constructor Attributes 227 | Constructor Name and Description 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | Rocket() 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | Class Detail 257 | 258 | 259 | 260 | Rocket() 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:30 GMT+0200 (MESZ) 299 | 300 | 301 | 302 | -------------------------------------------------------------------------------- /doc/jsdocs/demos/jsdoc/symbols/_global_.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - _global_ 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Class Index 187 | | File Index 188 | 189 | Classes 190 | 191 | 192 | _global_ 193 | 194 | Rocket 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | Built-In Namespace _global_ 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | Field Summary 227 | 228 | 229 | Field Attributes 230 | Field Name and Description 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | Asteroid 240 | 241 | **************************************************************************** 242 | Class Asteroid 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | AsteroidsGame 251 | 252 | **************************************************************************** 253 | Class AsteroidsGame 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | pgTank1 262 | 263 | **************************************************************************** 264 | jsRipOff.js 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | RipOffGame 273 | 274 | Rip-off game object 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | Field Detail 297 | 298 | 299 | 300 | 301 | 302 | 303 | Asteroid 304 | 305 | 306 | 307 | **************************************************************************** 308 | Class Asteroid 309 | 310 | 311 | Defined in: jsAsteroids.js. 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | AsteroidsGame 330 | 331 | 332 | 333 | **************************************************************************** 334 | Class AsteroidsGame 335 | 336 | 337 | Defined in: jsAsteroids.js. 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | pgTank1 356 | 357 | 358 | 359 | **************************************************************************** 360 | jsRipOff.js 361 | 362 | 363 | Defined in: jsRipOff.js. 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | RipOffGame 382 | 383 | 384 | 385 | Rip-off game object 386 | 387 | 388 | Defined in: jsRipOff.js. 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:30 GMT+0200 (MESZ) 418 | 419 | 420 | 421 | -------------------------------------------------------------------------------- /doc/jsdocs/lina.js/jsdoc/files.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - File Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | BiTran2 190 | 191 | Circle2 192 | 193 | LinaJS 194 | 195 | Matrix3 196 | 197 | Point2 198 | 199 | Polygon2 200 | 201 | Vec2 202 | 203 | 204 | 205 | 206 | 207 | 208 | File Index 209 | 210 | 211 | 212 | lina.js 213 | lina.js 214 | 215 | Copyright (c) 2010-2011, Martin Wendt (http://wwWendt.de) 216 | 217 | Dual licensed under the MIT or GPL Version 2 licenses. 218 | http://code.google.com/p/arcade-js/wiki/LicenseInfo 219 | 220 | A current version and some documentation is available at 221 | http://arcade-js.googlecode.com/ 222 | An independent object oriented library for points, vectors, 223 | and homogeneous transformations in 2D space. 224 | A polygon class helps with collision detection and hit testing. 225 | 226 | 227 | Author: 228 | Martin Wendt 229 | 230 | 231 | Version: 232 | 0.0.1 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:15 GMT+0200 (MESZ) 245 | 246 | 247 | -------------------------------------------------------------------------------- /doc/jsdocs/lina.js/jsdoc/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | JsDoc Reference - Index 8 | 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Class Index 182 | | File Index 183 | 184 | Classes 185 | 186 | 187 | _global_ 188 | 189 | BiTran2 190 | 191 | Circle2 192 | 193 | LinaJS 194 | 195 | Matrix3 196 | 197 | Point2 198 | 199 | Polygon2 200 | 201 | Vec2 202 | 203 | 204 | 205 | 206 | 207 | 208 | Class Index 209 | 210 | 211 | 212 | _global_ 213 | 214 | 215 | 216 | 217 | 218 | BiTran2 219 | 220 | 221 | 222 | 223 | 224 | Circle2 225 | 226 | 227 | 228 | 229 | 230 | LinaJS 231 | Namespace for global constants and functions. 232 | 233 | 234 | 235 | 236 | Matrix3 237 | 238 | 239 | 240 | 241 | 242 | Point2 243 | 244 | 245 | 246 | 247 | 248 | Polygon2 249 | 250 | 251 | 252 | 253 | 254 | Vec2 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:15 GMT+0200 (MESZ) 264 | 265 | 266 | -------------------------------------------------------------------------------- /doc/jsdocs/lina.js/jsdoc/symbols/_global_.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | JsDoc Reference - _global_ 9 | 10 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Class Index 187 | | File Index 188 | 189 | Classes 190 | 191 | 192 | _global_ 193 | 194 | BiTran2 195 | 196 | Circle2 197 | 198 | LinaJS 199 | 200 | Matrix3 201 | 202 | Point2 203 | 204 | Polygon2 205 | 206 | Vec2 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | Built-In Namespace _global_ 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:14 GMT+0200 (MESZ) 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /doc/lina-js_tutorial.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/lina-js_tutorial.odt -------------------------------------------------------------------------------- /doc/lina-js_tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/lina-js_tutorial.pdf -------------------------------------------------------------------------------- /doc/rip-off_spec.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/rip-off_spec.odt -------------------------------------------------------------------------------- /doc/rip-off_spec.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/doc/rip-off_spec.pdf -------------------------------------------------------------------------------- /res/apple-touch-icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/res/apple-touch-icon1.png -------------------------------------------------------------------------------- /res/apple-touch-icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/res/apple-touch-icon2.png -------------------------------------------------------------------------------- /src/arcade.js/MIT-License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Martin Wendt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/arcade.js/arcade.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/arcade.js/arcade.js -------------------------------------------------------------------------------- /src/arcade.js/test/test-arcade.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | /******************************************************************************* 3 | * Tool functions 4 | */ 5 | function makeBenchWrapper(testName, callback) { 6 | return function() { 7 | var start = +new Date; 8 | // callback.apply(this, arguments); 9 | callback.call(); 10 | var elap = +new Date - start; 11 | ok(true, testName + " took " + elap + " milliseconds"); 12 | } 13 | } 14 | 15 | 16 | function benchmark(testName, callback) { 17 | // Execute callback immediately and log timing as test result. 18 | // This function should be called inside a test() function. 19 | makeBenchWrapper(testName, callback).call(); 20 | } 21 | 22 | 23 | function timedTest(testName, callback) { 24 | // Same as test(testName, callback), but adds a timing assertion. 25 | test(testName, makeBenchWrapper(testName, callback)); 26 | } 27 | 28 | 29 | function simulateClick(selector) { 30 | var e = document.createEvent("MouseEvents"); 31 | e.initEvent("click", true, true); 32 | $(selector).each(function(){ 33 | this.dispatchEvent(e); 34 | }); 35 | }; 36 | 37 | /******************************************************************************* 38 | * QUnit setup 39 | */ 40 | QUnit.log = function(result, message) { 41 | if (window.console && window.console.log) { 42 | window.console.log(result +' :: '+ message); 43 | } 44 | } 45 | 46 | function logMsg(){ 47 | if (window.console && window.console.log) { 48 | window.console.log.apply(this, arguments); 49 | } 50 | } 51 | 52 | 53 | /******************************************************************************* 54 | * Module Load 55 | */ 56 | module("Vector math"); 57 | 58 | test("basic", function() { 59 | expect(2); 60 | 61 | var game = new ArcadeJS(); 62 | ok(game.fps == 15, "Construct ArcadeJS"); 63 | }); 64 | 65 | 66 | /******************************************************************************/ 67 | }); 68 | -------------------------------------------------------------------------------- /src/arcade.js/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ArcadeJS unit tests 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/demos/asteroids/damage.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/damage.mp3 -------------------------------------------------------------------------------- /src/demos/asteroids/damage.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/damage.oga -------------------------------------------------------------------------------- /src/demos/asteroids/damage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/damage.wav -------------------------------------------------------------------------------- /src/demos/asteroids/fire.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/fire.mp3 -------------------------------------------------------------------------------- /src/demos/asteroids/fire.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/fire.oga -------------------------------------------------------------------------------- /src/demos/asteroids/fire.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/fire.wav -------------------------------------------------------------------------------- /src/demos/asteroids/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/index.html -------------------------------------------------------------------------------- /src/demos/asteroids/jsAsteroids-debug.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsAsteroids 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 26 | 27 | 28 | jsAsteroids 29 | 30 | 31 | A JavaScript implementation of the Asteroids game using 32 | arcade.js 33 | (view the source to learn more). 34 | 35 | 36 | Use [left], [right], and [up] to move the ship. 37 | [space] to fire. 38 | 39 | 40 | 41 | 42 | This game requires HTML 5 support. 43 | 44 | 45 | Show debug info 46 | Log to canvas 47 | Maximum frame rate 48 | Time correction 49 | 50 | Render loop 51 | Freeze 52 | Stop 53 | Single step 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/demos/asteroids/jsAsteroids-icade.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsAsteroids - iCade version 6 | 7 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 66 | 67 | 68 | 69 | This game requires HTML 5 support. 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/demos/asteroids/jsAsteroids-mobile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsAsteroids - Mobile version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 48 | 49 | 61 | 62 | 63 | 64 | This game requires HTML 5 support. 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/demos/asteroids/jsAsteroids.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsAsteroids 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | jsAsteroids 24 | help 25 | - about arcade.js 26 | - view source code 27 | 28 | This game requires HTML 5 support. 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/demos/asteroids/jsAsteroids.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * jsAsteroids.js 3 | * Copyright (c) 2010, Martin Wendt (http://wwWendt.de) 4 | * 5 | * Released under the MIT license 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 8 | * A current version and some documentation is available at 9 | * https://github.com/mar10/arcade-js/ 10 | */ 11 | 12 | /******************************************************************************* 13 | * Class AsteroidsGame 14 | */ 15 | 16 | var AsteroidsGame = ArcadeJS.extend({ 17 | init: function(canvas, customOpts) { 18 | // Init ArcadeJS 19 | var opts = $.extend({ 20 | name: "jsAsteroids", 21 | fps: 30, 22 | keyboardControls: true, 23 | icadeControls: false, 24 | mobileControls: false, 25 | gameOverMsg: "Game Over.", 26 | // lineWidth: 1.5, 27 | debug: { 28 | showFps: true 29 | } 30 | }, customOpts); 31 | 32 | this._super(canvas, opts); 33 | 34 | // --- Status data ----------------------------------------------------- 35 | this.liveCount = 3; 36 | this.level = 1; 37 | this.score = 0; 38 | this.maxBullets = 4; 39 | this.shotDelay = 100; // ms 40 | this.permanentShotDelay = 500; // ms 41 | // this.shotDuration = 2000; // ms 42 | this.gracePeriod = 3; // seconds 43 | 44 | // --- Cache sounds ---------------------------------------------------- 45 | this.gunSound = new AudioJS(["fire.mp3", "fire.oga", "fire.wav"]); 46 | this.explosionSound = new AudioJS(["damage.mp3", "damage.oga"]); 47 | if( opts.icadeControls ) { 48 | this.icade = new IcadeController({game: this}); 49 | } else { 50 | this.icade = null; 51 | } 52 | if( opts.mobileControls ) { 53 | this.stick = this.addObject(new TouchStick({ 54 | // id: "stick", 55 | r1: 10, 56 | r2: 30, 57 | r3: 60, 58 | onResize: function(width, height){ 59 | this.pos.x = 60; 60 | this.pos.y = height - 60; 61 | } 62 | })); 63 | this.button = this.addObject(new TouchButton({ 64 | // id: "button", 65 | r: 20, 66 | r3: 40, 67 | onResize: function(width, height){ 68 | this.pos.x = width - 40; 69 | this.pos.y = height - 40; 70 | } 71 | })); 72 | } else { 73 | this.button = this.stick = null; 74 | } 75 | 76 | // Set the scene 77 | var obj; 78 | // Player rocket 79 | this.rocket = this.addObject(new Rocket()) 80 | // this._restartGame(true); 81 | this._gameOver(); 82 | // --- Start render loop ----------------------------------------------- 83 | this.startLoop() 84 | }, 85 | _gameOver: function(){ 86 | this.setActivity("over"); 87 | var self = this, 88 | popUp = new HtmlOverlay({ 89 | game: this, 90 | html: this.opts.gameOverMsg, 91 | css: { 92 | backgroundColor: "transparent", 93 | color: "white" 94 | }, 95 | onClick: function(e){ 96 | self._restartGame(true); 97 | popUp.close(); 98 | // window.location.reload(); 99 | } 100 | }); 101 | $(document).on("icadeclick", function(e, data){ 102 | if( data.btnId === "btnTW" && self.isActivity("over")) { 103 | $("div.arcadePopup").click(); 104 | } 105 | }); 106 | }, 107 | _restartGame: function(resetLevel){ 108 | this.setActivity("prepare"); 109 | if( resetLevel ) { 110 | this.level = 1; 111 | this.score = 0; 112 | } else { 113 | this.level += 1; 114 | this.score += 1000; 115 | } 116 | this.visitObjects(function(obj){ 117 | obj.die(); 118 | }, "asteroid bullet"); 119 | this.rocket.velocity.setNull(); 120 | this.rocket.pos = new Point2(0.5 * this.canvas.width, 0.5 * this.canvas.height); 121 | var speed = 15 * (1.0 + (this.level - 1) * 0.3); 122 | var pt0 = new Point2(0, 0); 123 | for(var i=0; i 0; 145 | if(!hasAsteroids && !this.isActivity("over") ){ 146 | this._restartGame(); 147 | return; 148 | } 149 | 150 | // --- Evaluate controllers --- 151 | var fire, thrust, turn, 152 | rocket = this.rocket; 153 | 154 | // Handle key controls 155 | if( this.opts.keyboardControls ) { 156 | if(this.isKeyDown(37)){ // Left 157 | turn = -5; 158 | } else if(this.isKeyDown(39)) { // Right 159 | turn = 5; 160 | } 161 | if(this.isKeyDown(38)){ // Up 162 | thrust = 3; 163 | } 164 | // [space] fires. Fast-clicking allows 5 shots per second. 165 | // Permanent fire (keep spacebar pushed) onl< 1 shots per sec 166 | fire = this.isKeyClicked(32, this.shotDelay, this.permanentShotDelay); 167 | // [backspace] starts hyperspace 168 | if( this.isKeyClicked(8) ) { rocket.hyperspace(); } 169 | } 170 | 171 | // --- Mobile mode: use virtual touch button and joystick 172 | if( this.opts.mobileControls ){ 173 | var dx = this.stick.getX(); 174 | 175 | if( Math.abs(dx) > 0.2 ) { 176 | turn = 3 * dx; 177 | } 178 | if( this.stick.getY() < -0.8 ) { // Up 179 | thrust = 3; 180 | } 181 | fire = fire || this.button.isClicked(this.shotDelay, this.permanentShotDelay); 182 | } 183 | 184 | // iCade Controller 185 | if( this.opts.icadeControls ) { 186 | if( this.icade.isDown("left") ){ 187 | turn = -3; 188 | } else if( this.icade.isDown("right") ){ 189 | turn = 3; 190 | } 191 | // bottom left black button: thrust 192 | if( this.icade.isDown("btnBLB") ) { 193 | thrust = 3; 194 | } 195 | // bottom right black button: fire 196 | fire = fire || this.icade.isClicked("btnBRB", this.shotDelay, this.permanentShotDelay); 197 | // bottom red button starts hyperspace 198 | if( this.icade.isClicked("btnBR") ) { rocket.hyperspace(); } 199 | } 200 | 201 | if( turn ){ 202 | rocket.orientation += turn * LinaJS.DEG_TO_RAD; 203 | } 204 | if( thrust ) { 205 | var vAccel = LinaJS.polarToVec(this.rocket.orientation - 90*LinaJS.DEG_TO_RAD, 3); 206 | rocket.velocity.add(vAccel).limit(300); 207 | rocket.isThrust = true; 208 | } 209 | if( fire ) { 210 | if( this.getObjectsByType("bullet").length < this.maxBullets ) { 211 | rocket.fire(); 212 | } 213 | } 214 | }, 215 | preDraw: function(ctx){ 216 | ctx.save(); 217 | // Display score 218 | ctx.font = "12px sans-serif"; 219 | ctx.fillScreenText("Score: " + this.score, 10, 15); 220 | if(this.isActivity("over")){ 221 | // ctx.font = "30px sans-serif"; 222 | // ctx.strokeScreenText("Game over (hit [F5])", 0, 0); 223 | }else if(this.isActivity("prepare")){ 224 | // Doesn't work in chrome 225 | // http://code.google.com/p/chromium/issues/detail?id=44017 226 | ctx.font = "30px sans-serif"; 227 | ctx.strokeScreenText("Level " + this.level, 0, 0); 228 | } 229 | ctx.font = "10px sans-serif"; 230 | ctx.fillScreenText("Copyright (c) 2011 Martin Wendt - Made with ArcadeJS", 0, -1); 231 | // Draw lives 232 | var live = new Polygon2([0, 5, 233 | -3, -5, 234 | 3, -5]); 235 | ctx.translate(10, 40); 236 | for(var i=0; i 0){ 348 | this.setActivity("grace"); 349 | this.later(this.game.gracePeriod, function(){ 350 | this.setActivity("idle"); 351 | }); 352 | }else if(this.game.getActivity() != "over"){ 353 | this.game._gameOver(); 354 | } 355 | } 356 | }, 357 | render: function(ctx) { 358 | ctx.strokeStyle = "white"; 359 | ctx.strokePolygon2(this.pg); 360 | // Draw reflector shield in grace mode 361 | if(this.isActivity("grace")){ 362 | var circle = new Circle2({x:0, y:0}, 13); //this.getBoundingCircle(); 363 | circle.r += LinaJS.random(-2, +2); 364 | ctx.strokeStyle = "#88f"; 365 | ctx.strokeCircle2(circle); 366 | } 367 | // Draw thrust fire 368 | if(this.isThrust){ // Up 369 | ctx.strokeStyle = "#f80"; 370 | ctx.translate(LinaJS.random(-1, +1), LinaJS.random(-1, +1)); 371 | ctx.strokePolygon2(this.pgThrust); 372 | this.isThrust = false; 373 | } 374 | }, 375 | fire: function() { 376 | if(this.isActivity("grace") || this.game.isActivity("over")){ 377 | return; 378 | } 379 | this.lastShotTime = this.game.time; 380 | var aim = LinaJS.polarToVec(this.orientation - 0.5 * Math.PI, 300); 381 | this.game.addObject(new Bullet({ 382 | pos: this.pos, 383 | velocity: aim 384 | })); 385 | this.game.gunSound.play(); 386 | }, 387 | hyperspace: function() { 388 | if(this.isActivity("grace") || this.game.isActivity("over")){ 389 | return; 390 | } 391 | // this.setActivity("grace"); 392 | this.velocity.setNull(); 393 | this.pos = new Point2(LinaJS.random(this.game.canvas.width), 394 | LinaJS.random(this.game.canvas.height)); 395 | // this.later(this.game.gracePeriod, function(){ 396 | // this.setActivity("idle"); 397 | // }); 398 | }, 399 | // --- end of class 400 | __lastentry: undefined 401 | }); 402 | 403 | /******************************************************************************* 404 | * Class Asteroid 405 | */ 406 | var Asteroid = Movable.extend({ 407 | init: function(opts) { 408 | opts = $.extend({ 409 | clipModeX: "wrap", 410 | clipModeY: "wrap", 411 | // size: 3 412 | }, opts); 413 | this._super("asteroid", opts); 414 | // Copy selected options as object attributes 415 | ArcadeJS.extendAttributes(this, opts, "size"); 416 | //this.scale = 2 * this.size; 417 | this.pg = new Polygon2([4, 0, 418 | 2.5, 1.5, 419 | 1.5, 3.5, 420 | -1.5, 2.5, 421 | -4, 0, 422 | -1.5, -3.5, 423 | 2, -3.5 424 | ]); 425 | this.pg.transform(LinaJS.scale33(2*this.size, -2*this.size)); 426 | }, 427 | getBoundingCircle: function() { 428 | return new Circle2({x:this.pos.x, y:this.pos.y}, 2*this.size * 4); 429 | }, 430 | render: function(ctx) { 431 | ctx.strokeStyle = "white"; 432 | ctx.strokePolygon2(this.pg); 433 | }, 434 | hitBy: function(obj) { 435 | this.game.explosionSound.play(); 436 | if(this.size==3){ 437 | this.game._makeAsteroid(2, this.pos, this.velocity); 438 | this.game._makeAsteroid(2, this.pos, this.velocity); 439 | this.game.score += 20; 440 | }else if(this.size==2){ 441 | this.game._makeAsteroid(1, this.pos, this.velocity); 442 | this.game._makeAsteroid(1, this.pos, this.velocity); 443 | this.game.score += 50; 444 | }else{ 445 | this.game.score += 100; 446 | } 447 | this.die(); 448 | }, 449 | // --- end of class 450 | __lastentry: undefined 451 | }); 452 | -------------------------------------------------------------------------------- /src/demos/asteroids/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/screenshot-1.png -------------------------------------------------------------------------------- /src/demos/asteroids/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/screenshot-2.png -------------------------------------------------------------------------------- /src/demos/asteroids/screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/screenshot-3.png -------------------------------------------------------------------------------- /src/demos/asteroids/screenshot-icade.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/screenshot-icade.jpg -------------------------------------------------------------------------------- /src/demos/asteroids/shot.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/shot.mp3 -------------------------------------------------------------------------------- /src/demos/asteroids/shot.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/shot.ogg -------------------------------------------------------------------------------- /src/demos/asteroids/shot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/asteroids/shot.wav -------------------------------------------------------------------------------- /src/demos/asteroids/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/demos/billiards/applause.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/billiards/applause.wav -------------------------------------------------------------------------------- /src/demos/billiards/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/billiards/click.wav -------------------------------------------------------------------------------- /src/demos/billiards/jsBilliards-mobile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsBilliards - Mobile version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 45 | 46 | 59 | 60 | 61 | 62 | This game requires HTML 5 support. 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/demos/billiards/jsBilliards.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsBilliards 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 27 | 28 | 29 | jsBillards 30 | 31 | 32 | A JavaScript implementation of carambolage using 33 | arcade.js 34 | (view the source to learn more). 35 | 36 | 37 | Click and drag the red ball to touch both white balls. 38 | 39 | 40 | 41 | This game requires HTML 5 support. 42 | 43 | 44 | 45 | - frames 46 | - points 47 | 48 | 49 | Show debug info 50 | Log to canvas 51 | Maximum frame rate 52 | Time correction 53 | 54 | Render loop 55 | Freeze 56 | Stop 57 | Single step 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/demos/billiards/jsBilliards.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/billiards/jsBilliards.js -------------------------------------------------------------------------------- /src/demos/billiards/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/billiards/screenshot-1.png -------------------------------------------------------------------------------- /src/demos/billiards/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/demos/collisions/game.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ArcadeJS demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 30 | 31 | 32 | jsAsteroids 33 | 34 | 35 | A demo for arcade.js 36 | (view the source to learn more). 37 | 38 | 39 | This sample shows how to implement moving objects, circle-circle and 40 | circle-polygon collisions. 41 | 42 | 43 | 44 | 45 | This game requires HTML 5 support. 46 | 47 | 48 | 49 | - frames 50 | Keys: - 51 | 52 | 53 | 54 | Start/Stop 55 | Single step 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/demos/collisions/game.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jsQuirks.js 3 | * 4 | */ 5 | 6 | 7 | var DemoGame = ArcadeJS.extend({ 8 | init: function(canvas, customOpts) { 9 | // Init ArcadeJS 10 | var opts = $.extend({ 11 | // name: "jsQuirks", 12 | // fps: 30 13 | }, customOpts); 14 | this._super(canvas, opts); 15 | 16 | // Create an objects and add them to the game 17 | // Inner polygon (CCW) 18 | var pg = new Polygon2([300, 200, 19 | 200, 100, 20 | 100, 180, 21 | 210, 300]); 22 | this.addObject(new WallObject({pg: pg})); 23 | // Outer polygon (CW) 24 | pg = new Polygon2([600, 200, 25 | 200, 10, 26 | 10, 180, 27 | 210, 470]).revert(); 28 | this.addObject(new WallObject({pg: pg})); 29 | // Ball 30 | this.addObject(new Ball( 31 | {pos: new Point2(150, 100), 32 | r:10, 33 | velocity: {dx:300, dy:0}, 34 | color: "red" 35 | })); 36 | this.addObject(new Ball( 37 | {pos: new Point2(500, 10), 38 | r:10, 39 | velocity: {dx:0, dy:150}, 40 | color: "green" 41 | })); 42 | this.addObject(new Ball( 43 | {pos: new Point2(150, 150), 44 | r:10, 45 | velocity: {dx:90, dy:90}, 46 | color: "blue" 47 | })); 48 | // Start render loop 49 | this.startLoop() 50 | }, 51 | postDraw: function(ctx){ 52 | $("#frames").html("Frame #" + this.frameCount + ", FpS: " + this.realFps + " (want: " + this.fps + ")"); 53 | // var balls = this.getObjectsByType("ball"); 54 | // var e = 0; 55 | // for(var i=0; i %o, d=%s, t=%s, c=%s", this.game.mousePos, res.pt, res.d, res.t, res.isCorner); 166 | }, 167 | // onMouseDown: function() { 168 | // return this.r; 169 | // }, 170 | // --- end of class 171 | lastentry: undefined 172 | }); 173 | -------------------------------------------------------------------------------- /src/demos/collisions/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/collisions/screenshot-1.png -------------------------------------------------------------------------------- /src/demos/collisions/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/demos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | arcade.js - Demos 5 | 6 | 7 | arcade.js - Demos 8 | 9 | A few demo applications built with arcade.js. 10 | 11 | 12 | 13 | Column 1 Heading 14 | Column 2 Heading 15 | 16 | 17 | 18 | 19 | 20 | 21 | Play jsAsteroids 22 | 23 | 24 | 25 | 26 | 27 | Asteroids 28 | 29 | Play jsAsteroids. 30 | 31 | Rip-off 32 | 33 | Play jsRipOff.. 34 | 35 | quirks 36 | 37 | Simple bouncing lines. 38 | 39 | Try it. 40 | 41 | i-quirks 42 | 43 | iPhone version of quirks, that features a joystick and button. 44 | 45 | Try it. 46 | 47 | Billiards 48 | 49 | Features drag'n'drop and collision detection. 50 | 51 | Try it. 52 | 53 | or run the version for smart phones. 54 | 55 | Collisions 56 | 57 | .... 58 | 59 | Try it. 60 | 61 | Tests 62 | 63 | .... 64 | 65 | LinaJS test suite. 66 | 67 | Benchmark. 68 | 69 | Audio test. 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/demos/quirks/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/quirks/apple-touch-icon.png -------------------------------------------------------------------------------- /src/demos/quirks/iphone.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ddd; 3 | color: #222; 4 | font-family: Helvetica; 5 | font-size: 14px; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | #header h1 { 11 | margin: 0; 12 | padding: 0; 13 | } 14 | 15 | #header h1 a { 16 | background-color:#ccc; 17 | border-bottom: 1px solid #666; 18 | color: #222; 19 | display: block; 20 | font-size: 20px; 21 | font-weight: bold; 22 | padding: 10px 0; 23 | text-align: center; 24 | text-decoration: none; 25 | } 26 | 27 | #menu ul { 28 | list-style: none; 29 | margin: 10px; 30 | padding: 0; 31 | } 32 | 33 | #menu ul li a{ 34 | background-color:#FFF; 35 | border: 1px solid #999; 36 | color: #222; 37 | display: block; 38 | font-size: 17px; 39 | font-weight: bold; 40 | margin-bottom: -1px; 41 | padding: 12px 10px; 42 | text-decoration: none; 43 | } 44 | 45 | /*Rounded corners on Firefox and Safari*/ 46 | .box { 47 | -webkit-border-radius: 5px; 48 | -moz-border-radius: 5px; 49 | padding: 5px; 50 | text-align: center; 51 | background: #ddd; 52 | border: 1px solid #aaa; 53 | } 54 | 55 | body.portrait { 56 | } 57 | 58 | body.landscape { 59 | } 60 | 61 | XXXbody.portait div.arcade-js { 62 | /* width: device-width; /* 320px or 480px on an iPhone */ 63 | /* max-width: 320px;*/ 64 | width: 416px; 65 | height: device-height; 66 | max-height: 356px; /* Free viewport size, when URL bar is visible: 356px.*/ 67 | } 68 | XXXbody.landscape div.arcade-js { 69 | width: device-width; /* 320px or 480 on an iPhone */ 70 | max-width: 480px; 71 | height: device-height; 72 | max-height: 208px; /* Free viewport size, when URL bar is visible: 208px. */ 73 | } 74 | XXXbody.landscape canvas.arcade-js { 75 | /*width: 480px;*/ 76 | width: device-width; /* 320px or 480 on an iPhone */ 77 | height: 208px; 78 | } 79 | 80 | div.arcade-js { 81 | border: 1px dotted red; 82 | padding: 0; 83 | width: device-width; /* 320px or 480px on an iPhone */ 84 | height: device-height; 85 | /* 86 | max-width: 320px; 87 | width: 95%; 88 | position: absolute; 89 | top: 50px; 90 | left: 10px; 91 | bottom: 10px; 92 | right: 10px; 93 | */ 94 | text-align: center; 95 | } 96 | 97 | /* http://developer.apple.com/safari/library/documentation/internetweb/conceptual/iPhoneWebAppHIG/MetricsLayout/MetricsLayout.html */ 98 | canvas.arcade-js { 99 | -webkit-border-radius: 5px; 100 | -moz-border-radius: 5px; 101 | padding: 0; 102 | margin: 0; 103 | /* width: device-width; /* 320px or 480 on an iPhone */ 104 | /* width: 320px;*/ 105 | /* height: 416px;*/ 106 | width: 100%; 107 | height: 100%; 108 | } 109 | -------------------------------------------------------------------------------- /src/demos/quirks/jsQuirks-mobile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsQuirks - Mobile version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 103 | 104 | 117 | 118 | 119 | 120 | This game requires HTML 5 support. 121 | 122 | 123 | -------------------------------------------------------------------------------- /src/demos/quirks/jsQuirks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsQuirks 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | jsQuirks 28 | 29 | 30 | A demo for arcade.js 31 | (view the source to learn more). 32 | 33 | 34 | This sample a simple render loop with two reflecting points. 35 | 36 | 37 | 38 | 39 | This game requires HTML 5 support. 40 | 41 | 42 | 43 | - frames 44 | 45 | 46 | Show debug info 47 | Log to canvas 48 | Maximum frame rate 49 | Time correction 50 | 51 | Render loop 52 | Freeze 53 | Stop 54 | Single step 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/demos/quirks/jsQuirks.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jsQuirks.js 3 | * 4 | */ 5 | 6 | 7 | var QuirksGame = ArcadeJS.extend({ 8 | init: function(canvas, customOpts) { 9 | // Init ArcadeJS 10 | var opts = $.extend({ 11 | name: "jsQuirks", 12 | fps: 30 13 | }, customOpts); 14 | this._super(canvas, opts); 15 | 16 | // Create an object and add it to the game 17 | this.quirk = this.addObject(new Quirk()); 18 | 19 | // Start render loop 20 | this.startLoop() 21 | }, 22 | // --- end of class 23 | lastentry: undefined 24 | }); 25 | 26 | /*----------------------------------------------------------------------------*/ 27 | 28 | var Quirk = Movable.extend({ 29 | init: function(opts) { 30 | // Inititalize this game object 31 | this._super("quirk"); 32 | this.maxLines = 50; 33 | this.color = "#80ff80"; 34 | // Initialize the first of max. 50 lines and velocity 35 | this.lines = []; 36 | // Velocities in WC per second 37 | var vMin = 100, vMax = 300; 38 | this.pos1 = new Point2(LinaJS.randomInt(100, 200), LinaJS.randomInt(100, 200)); 39 | this.velocity1 = new Vec2(LinaJS.randomInt(vMin, vMax), LinaJS.randomInt(vMin, vMax)); 40 | this.pos2 = new Point2(LinaJS.randomInt(100, 200), LinaJS.randomInt(100, 200)); 41 | this.velocity2 = new Vec2(LinaJS.randomInt(vMin, vMax), LinaJS.randomInt(vMin, vMax)); 42 | // window.console.log("v1: %s", this.velocity1); 43 | // window.console.log("v2: %s", this.velocity2); 44 | }, 45 | step: function() { 46 | // Add another line (discard oldest, if max. is reached) 47 | // Note that we use pos.copy() so every line has its own Point2 instance 48 | while( this.lines.length > this.maxLines ){ 49 | this.lines.shift(); 50 | } 51 | this.lines.push({pos1: this.pos1.copy(), pos2: this.pos2.copy()}); 52 | // Calculate new position for first point. The velocity is defined in 53 | // WC units per second, so we scale by current step duration. 54 | var v1 = this.velocity1.copy().scale(this.game.frameDuration), 55 | v2 = this.velocity2.copy().scale(this.game.frameDuration); 56 | this.pos1.translate(v1); 57 | // Invert velocity vector, when bouncing at the canvas borders 58 | if((this.pos1.x < 0 && this.velocity1.dx < 0) 59 | || (this.pos1.x >= this.game.canvas.width && this.velocity1.dx > 0)) { 60 | this.velocity1.dx *= -1; 61 | } 62 | if((this.pos1.y < 0 && this.velocity1.dy < 0) 63 | || (this.pos1.y >= this.game.canvas.height && this.velocity1.dy > 0)) { 64 | this.velocity1.dy *= -1; 65 | } 66 | // Calculate new position and velocity for second point 67 | this.pos2.translate(v2); 68 | if((this.pos2.x < 0 && this.velocity2.dx < 0) 69 | || (this.pos2.x >= this.game.canvas.width && this.velocity2.dx > 0)) { 70 | this.velocity2.dx *= -1; 71 | } 72 | if((this.pos2.y < 0 && this.velocity2.dy < 0) 73 | || (this.pos2.y >= this.game.canvas.height && this.velocity2.dy > 0)) { 74 | this.velocity2.dy *= -1; 75 | } 76 | }, 77 | render: function(ctx) { 78 | // Draw the list of lines to the canvas 79 | ctx.strokeStyle = this.color; 80 | // this.game.debug("render: " + this.color); 81 | for(var i=0, l=this.lines.length; i 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/demos/quirks/thrust.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/quirks/thrust.mp3 -------------------------------------------------------------------------------- /src/demos/quirks/thrust.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/quirks/thrust.wav -------------------------------------------------------------------------------- /src/demos/rip-off/damage.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/rip-off/damage.mp3 -------------------------------------------------------------------------------- /src/demos/rip-off/damage.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/rip-off/damage.oga -------------------------------------------------------------------------------- /src/demos/rip-off/fire.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/rip-off/fire.mp3 -------------------------------------------------------------------------------- /src/demos/rip-off/fire.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/rip-off/fire.oga -------------------------------------------------------------------------------- /src/demos/rip-off/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsRipOff - arcade.js 5 | 6 | 7 | 8 | 9 | jsRipOff 10 | 11 | 12 | Overview 13 | jsRipOff is a clone of the Rip-off game written by Tim Skelly for 14 | Cinematronics in 1980. 15 | It was created as a demo for the open source game 16 | engine arcade.js. 17 | 18 | 19 | This game requires HTML5 support, namely <canvas> and <audio>. 20 | Therefore it will not run on Internet Explorer <= 8. 21 | It was tested however with Firefox 3.6, Chrome 8, Safari, and seems to run. Only 22 | sound is a bit flakey. 23 | 24 | The flocking behavior of the bandits is roughly mimicked, but not yet 25 | complete. 26 | 27 | 28 | Usage 29 | The goal of this game is to protect eight canisters in the center of the 30 | screen from being ripped-off by waves of enemies. 31 | Enemies can be destroyed by firing at or colliding with them. 32 | The players have infinite lives, but there is a small time penalty every 33 | time the player is hit. 34 | Player 1 35 | Use [Up], [Left], and [Right] keys to move 36 | the player's tank. Press [Space] to fire. 37 | Player 2 (or alternatively in single player mode) 38 | Use Mouse and left-click to move to cursor. Use right-click to aim and fire. 39 | 40 | 41 | The game is over, when the last canister was dragged off the screen by the 42 | enemies. 43 | 44 | 45 | Play jsRipOff 46 | 47 | Single player game 48 | Two player game 49 | Debug version 50 | 51 | Play jsRipOff on touch screens 52 | 53 | iPad / Tablet version (two player split screen) 54 | iCade version 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsRipOff - Two Players 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | jsRipOff - Two player game 24 | help 25 | - about arcade.js 26 | - view source code 27 | 28 | 29 | This game requires HTML 5 support. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff-icade.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsRipOff - iCade version 6 | 7 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 66 | 67 | 68 | 69 | This game requires HTML 5 support. 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff-mobile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsRipOff - Mobile version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 48 | 49 | 61 | 62 | 63 | 64 | This game requires HTML 5 support. 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff-tablet-2player.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsRipOff - 2-player split screen tablet version 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 26 | 208 | 209 | 221 | 222 | 223 | 224 | This game requires HTML 5 support. 225 | 226 | 227 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsRipOff 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 26 | 27 | 28 | jsRipOff - Debug version 29 | 30 | 31 | A JavaScript implementation of the Rip-off game using 32 | arcade.js 33 | (view the source to learn more). 34 | 35 | 36 | Use [left], [right], and [up] to move the ship. 37 | [space] to fire. 38 | 39 | 40 | 41 | 42 | This game requires HTML 5 support. 43 | 44 | 45 | Show debug info 46 | Log to canvas 47 | Maximum frame rate 48 | Time correction 49 | 50 | Render loop 51 | Freeze 52 | Stop 53 | Single step 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/demos/rip-off/jsRipOff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jsRipOff 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | jsRipOff - Single player game 24 | help 25 | - about arcade.js 26 | - view source code 27 | 28 | This game requires HTML 5 support. 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/demos/rip-off/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/rip-off/screenshot-1.png -------------------------------------------------------------------------------- /src/demos/rip-off/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/demos/test/_test_audio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test audio 6 | 7 | 8 | 9 | 10 | 61 | 62 | 63 | Audio with source elements (mp3, oga, wav) and 'type' attribute: 64 | 65 | 66 | 67 | 68 | Audio not supported 69 | 70 | Audio with source elements (mp3, oga, wav): 71 | 72 | 73 | 74 | 75 | Audio not supported 76 | 77 | Audio with src attribute (mp3): 78 | 79 | Audio not supported 80 | 81 | Audio with src attribute (oga): 82 | 83 | Audio not supported 84 | 85 | Audio with src attribute (wav): 86 | 87 | Audio not supported 88 | 89 | 90 | 91 | 92 | AudioJS(mp3).play() 93 | AudioJS(ogg).play() 94 | AudioJS(wav).play() 95 | AudioJS(mp3,ogg,wav).play() 96 | 97 | <Audio src=mp3>.play() 98 | <Audio src=ogg>.play() 99 | <Audio src=wav>.play() 100 | 101 | Results 6.1.2011: 102 | 103 | Firefox 3.6 / Windows7 using WsgiDAV server 104 | ogg + wav OK, 105 | mp3 NOT working 106 | 107 | Chrome 8 / Windows7 using file access 108 | OK (all formats) 109 | 110 | Safari 5.0.1 / Windows7 / local or WsgiDAV server 111 | NOTHING works! <audio> tag not supported! (Quicktime is not installed!?) 112 | 113 | Safari Mobile / iPhone 4 / iOS 4.2 / WsgiDAV server 114 | Only mp3 works, but with a delay. 115 | NOTE: multi-source did not work, when test.oga was first! 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /src/demos/test/_test_resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jsQuirks - Mobile 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 150 | 151 | 171 | 172 | 173 | 174 | 188 | This game requires HTML 5 support. 189 | 190 | 191 | -------------------------------------------------------------------------------- /src/demos/test/benchmark_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ArcadeJS - Benchmark (Rip-Off, 640x480) 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 85 | 86 | 100 | 101 | 102 | 103 | This game requires HTML 5 support. 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | Date 117 | Firefox 118 | IE 119 | Safari 120 | Chrome 121 | iPad 2 122 | Samsung Galaxy S2 123 | Remarks 124 | 125 | 126 | 2011-05-05 127 | 53fps (FF v4.0.1) 128 | 60fps (IE v9.0.8112) 129 | 70fps (Safari v5.0.5) 130 | 97fps (Chrome v11.0.696) 131 | ? fps 132 | 63fps 133 | Athlon 5000, DualCore 2,6@GHz, 3GB RAM, 32bit-Vista 134 | 135 | 136 | 2016-12-26 137 | 150fps (v50.0.1) 138 | 243fps (IE v11.576) 139 | 120fps (Safari v10.0.1 on MBP i5@2.3GHz) 140 | 250fps (Chrome v55.0.2883.87) 141 | 156fps (iPad Air A1474) 142 | ?fps 143 | Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz, 3300 MHz, 2 Core(s), 4GB RA, 32bit Win10 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/demos/test/test.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/test/test.mp3 -------------------------------------------------------------------------------- /src/demos/test/test.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/test/test.oga -------------------------------------------------------------------------------- /src/demos/test/test.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/test/test.ogg -------------------------------------------------------------------------------- /src/demos/test/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/demos/test/test.wav -------------------------------------------------------------------------------- /src/depends/demos.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | margin: 15px; 4 | font-family: Helvetica, sans-serif; 5 | background-color: #ddd; 6 | color: #222; 7 | } 8 | h1 9 | { 10 | font-size: 1.2em; 11 | } 12 | h2 13 | { 14 | font-size: 1em; 15 | } 16 | 17 | a, 18 | a:visited 19 | { 20 | color: navy; 21 | text-decoration: none; 22 | /* font-size: small;*/ 23 | } 24 | a:hover 25 | { 26 | text-decoration: underline; 27 | } 28 | 29 | p 30 | { 31 | margin: 0; 32 | margin-bottom: 8px; 33 | } 34 | p.description, 35 | p.sample-links 36 | { 37 | /* border: thin solid gray; */ 38 | background-color: #d0d0f0; 39 | padding: 5px; 40 | font-size: small; 41 | } 42 | p.sample-links a, 43 | p.sample-links a:visited 44 | { 45 | color: navy; 46 | text-decoration: none; 47 | margin-left: 15px; 48 | padding: 1px 3px; 49 | /* border: 1pt solid white;*/ 50 | } 51 | 52 | p.sample-links a:hover 53 | { 54 | text-decoration: underline; 55 | } 56 | 57 | pre{ 58 | background:#eee; 59 | border:1px solid #999; 60 | padding:.5em; 61 | margin:.5em; 62 | font-size:.9em; 63 | } 64 | 65 | /******************************************************************************* 66 | * 67 | */ 68 | body.game640 69 | { 70 | margin: 3px; 71 | font-size: smaller; 72 | } 73 | body.game640 h1 74 | { 75 | font-size: 1.1em; 76 | } 77 | 78 | canvas.demo 79 | { 80 | width: 640px; 81 | height: 480px; 82 | margin: 8px; 83 | } 84 | 85 | div.info 86 | { 87 | -webkit-border-radius: 5px; 88 | -moz-border-radius: 5px; 89 | background-color: #ffffa0; 90 | padding: 5px; 91 | margin: 8px; 92 | /* 93 | padding-left: 40px; 94 | background-image: url(iconInfo_32x32.png); 95 | background-repeat: no-repeat; 96 | */ 97 | } 98 | 99 | div.debugPane 100 | { 101 | -webkit-border-radius: 5px; 102 | -moz-border-radius: 5px; 103 | background-color: #a0a0a0; 104 | padding: 5px; 105 | margin: 8px; 106 | /* 107 | padding-left: 40px; 108 | background-image: url(iconInfo_32x32.png); 109 | background-repeat: no-repeat; 110 | */ 111 | } 112 | -------------------------------------------------------------------------------- /src/depends/demos.js: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | (c) 2010-2011 Martin Wendt 3 | *************************************************************************/ 4 | 5 | function viewSourceCode() 6 | { 7 | window.location = "view-source:" + window.location.href; 8 | 9 | } 10 | 11 | function initCodeSamples() { 12 | $('a.codeExample').each ( 13 | function( i ) { 14 | $( this ).after( '' ); 15 | } 16 | ) 17 | $( 'pre.codeExample' ).hide(); 18 | $('a.codeExample').toggle( 19 | function() { 20 | if( !this.old ){ 21 | this.old = $(this).html(); 22 | } 23 | $(this).html('Hide Code'); 24 | parseCode(this); 25 | }, 26 | function() { 27 | $(this).html(this.old); 28 | $(this.nextSibling).hide(); 29 | } 30 | ) 31 | function parseCode(o){ 32 | if(!o.nextSibling.hascode){ 33 | $.get (o.href, function(code){ 34 | // Doesn't work (only accepts simple/restricted html strings, not a full html page): 35 | // logMsg("code.html: %o", $(code).html()); 36 | 37 | // Remove blocks: 38 | code = code.replace(//gi, ""); 39 | 40 | /* 41 | code = code.replace(/&/mg,'&') 42 | .replace(//mg,'>') 44 | .replace(/\"/mg,'"') 45 | .replace(/\t/g,' ') 46 | .replace(/\r?\n/g,'') 47 | .replace(//g,''); 48 | .replace(/ /g,' '); 49 | */ 50 | // Reduce tabs from 8 to 4 characters 51 | code = code.replace(/\t/g, " "); 52 | $("code", o.nextSibling).text(code); 53 | o.nextSibling.hascode = true; 54 | // Format code samples 55 | try { 56 | prettyPrint(); 57 | } catch (e) { } 58 | }); 59 | } 60 | $(o.nextSibling).show(); 61 | } 62 | } 63 | 64 | /******************************************************************************* 65 | * Handle debug controls 66 | */ 67 | function initArcadeGameDebugControls(game) 68 | { 69 | // Handle debug controls 70 | $("#cbDebug") 71 | .attr("checked", false) 72 | .click(function(){ 73 | var flag = $(this).is(":checked"); 74 | game.opts.debug.showActivity = flag; 75 | game.opts.debug.showVelocity = flag; 76 | game.opts.debug.showBCircle = flag; 77 | game.opts.debug.showKeys = flag; 78 | game.opts.debug.showObjects = flag; 79 | game.opts.debug.showMouse = flag; 80 | }); 81 | $("#cbLogToCanvas") 82 | .attr("checked", false) 83 | .click(function(){ 84 | var flag = $(this).is(":checked"); 85 | game.opts.debug.logToCanvas = flag; 86 | }); 87 | $("#cbMaxFps") 88 | .attr("checked", false) 89 | .click(function(){ 90 | if($(this).is(":checked")){ 91 | game.fps = 1000; 92 | }else{ 93 | game.fps = game.opts.fps; 94 | } 95 | game.stopLoop(); 96 | game.startLoop(); 97 | game.freezeMode = false; 98 | $("#rbStepmode1").attr("checked", true); 99 | }); 100 | $("#cbTimeCorrection") 101 | .attr("checked", true) 102 | .click(function(){ 103 | game.timeCorrection = $(this).is(":checked"); 104 | }); 105 | $("#rbStepmode1") 106 | .attr("checked", true) 107 | .click(function(){ 108 | game.freezeMode = false; 109 | game.startLoop(); 110 | }); 111 | $("#rbStepmode2").click(function(){ 112 | game.freezeMode = true; 113 | game.startLoop(); 114 | }); 115 | $("#rbStepmode3").click(function(){ 116 | game.stopLoop(); 117 | }); 118 | $("#btnStep").click(function(){ 119 | game.stopRequest = true; 120 | $("#rbStepmode3").attr("checked", true); 121 | if( !game.isRunning() ){ 122 | game.startLoop(); 123 | } 124 | }); 125 | } 126 | -------------------------------------------------------------------------------- /src/depends/jquery.mousewheel.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * 7 | * Version: 3.0.3-pre 8 | * 9 | * Requires: 1.2.2+ 10 | */ 11 | 12 | (function($) { 13 | 14 | var types = ['DOMMouseScroll', 'mousewheel']; 15 | 16 | $.event.special.mousewheel = { 17 | setup: function() { 18 | if ( this.addEventListener ) 19 | for ( var i=types.length; i; ) 20 | this.addEventListener( types[--i], handler, false ); 21 | else 22 | this.onmousewheel = handler; 23 | }, 24 | 25 | teardown: function() { 26 | if ( this.removeEventListener ) 27 | for ( var i=types.length; i; ) 28 | this.removeEventListener( types[--i], handler, false ); 29 | else 30 | this.onmousewheel = null; 31 | } 32 | }; 33 | 34 | $.fn.extend({ 35 | mousewheel: function(fn) { 36 | return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 37 | }, 38 | 39 | unmousewheel: function(fn) { 40 | return this.unbind("mousewheel", fn); 41 | } 42 | }); 43 | 44 | 45 | function handler(event) { 46 | var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true; 47 | 48 | event = $.event.fix(event || window.event); 49 | event.type = "mousewheel"; 50 | 51 | if ( event.wheelDelta ) delta = event.wheelDelta/120; 52 | if ( event.detail ) delta = -event.detail/3; 53 | 54 | // Add event and delta to the front of the arguments 55 | args.unshift(event, delta); 56 | 57 | return $.event.handle.apply(this, args); 58 | } 59 | 60 | })(jQuery); -------------------------------------------------------------------------------- /src/depends/prettify.css: -------------------------------------------------------------------------------- 1 | /* Pretty printing styles. Used with prettify.js. */ 2 | 3 | .str { color: #080; } 4 | .kwd { color: #008; } 5 | .com { color: #800; } 6 | .typ { color: #606; } 7 | .lit { color: #066; } 8 | .pun { color: #660; } 9 | .pln { color: #000; } 10 | .tag { color: #008; } 11 | .atn { color: #606; } 12 | .atv { color: #080; } 13 | .dec { color: #606; } 14 | pre.prettyprint { 15 | padding: 2px; 16 | margin-left: 30px; 17 | margin-right: 10px; 18 | border: 1px dashed #888; 19 | background-color: #f0f0f0; 20 | } 21 | 22 | @media print { 23 | .str { color: #060; } 24 | .kwd { color: #006; font-weight: bold; } 25 | .com { color: #600; font-style: italic; } 26 | .typ { color: #404; font-weight: bold; } 27 | .lit { color: #044; } 28 | .pun { color: #440; } 29 | .pln { color: #000; } 30 | .tag { color: #006; font-weight: bold; } 31 | .atn { color: #404; } 32 | .atv { color: #060; } 33 | } 34 | -------------------------------------------------------------------------------- /src/depends/prettify.js: -------------------------------------------------------------------------------- 1 | // See http://code.google.com/p/google-code-prettify/ 2 | (function () { 3 | var F={};(function(){var b=["abstract bool break case catch char class const const_cast continue default delete deprecated dllexport dllimport do double dynamic_cast else enum explicit extern false float for friend goto if inline int long mutable naked namespace new noinline noreturn nothrow novtable operator private property protected public register reinterpret_cast return selectany short signed sizeof static static_cast struct switch template this thread throw true try typedef typeid typename union unsigned using declaration, directive uuid virtual void volatile while typeof", 4 | "as base by byte checked decimal delegate descending event finally fixed foreach from group implicit in interface internal into is lock null object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var","package synchronized boolean implements import throws instanceof transient extends final strictfp native super","debugger export function with NaN Infinity","require sub unless until use elsif BEGIN END","and assert def del elif except exec global lambda not or pass print raise yield False True None", 5 | "then end begin rescue ensure module when undef next redo retry alias defined","done fi"];for(var c=0;c",quot:'"',apos:"'",amp:"&"};u.prototype.decode=function(b,c){var a=c+1,d=b.charAt(c);if("&"===d){var f=b.indexOf(";",a);if(f>=0&&f="a"&&b<="z"||b>="A"&&b<="Z"}function z(b){return x(b)||b=="_"||b=="$"||b=="@"}function s(b){return"\t \r\n".indexOf(b)>=0}function w(b){return b>="0"&&b<="9"}function I(b){var c=0,a=b.length-1;while(c<=a&&s(b.charAt(c))){++c}while(a>c&&s(b.charAt(a))){--a}return b.substring(c,a+1)}function y(b,c){return b.length>=c.length&&c==b.substring(0,c.length)}function L(b,c){return b.length>= 8 | c.length&&c==b.substring(b.length-c.length,b.length)}function A(b,c,a){if(c/g,">").replace(/\xa0/g," ")}function E(b){return"XMP"==b.tagName}var B=null;function N(b){if(null==B){var c=document.createElement("PRE");c.appendChild(document.createTextNode('\n'));B=!/");for(var h=b.firstChild;h;h=h.nextSibling){D(h,c)}if(b.firstChild||!/^(?:br|link|img)$/.test(a)){c.push("",a,">")}break;case 2:c.push(b.name.toLowerCase(),'="',b.value.replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/\xa0/," "),'"');break;case 3:case 4:c.push(H(b.nodeValue));break}}function M(b,c){var a=0,d=new u,f=[];for(var h=0;h=0;m-=" ".length){k.push(" ".substring(0,m))}g=d.next;break;case "\n":case "\r":a= 11 | 0;break;default:++a}}k.push(e.substring(g));f.push(new q(k.join(""),i.style))}return f}function K(b){var c=/(?:[^<]+|<\/?[a-zA-Z][^>]*>|<)/g,a=b.match(c),d=[];if(a){var f=null;for(var h=0,i=a.length;h0){a.push(new q(i.token.substring(h,i.token.length),null==i.style?null:l.style))}f+=m;h=0;if(d"==p){a=0;t="dec"}break;case 4:if("-"==p){a=5}break;case 5:if("-"==p){a=6}break;case 6:if(">"==p){a=0;t="com"}else if("-"==p){a=6}else{a=4}break;case 7:if(x(p)){a=8}else if("<"==p){a=1}else{a=0}break;case 8:if(">"==p){a=0;t="tag"}break;case 9:if("?"== 14 | p){a=10}break;case 10:if(">"==p){a=0;t="src"}else if("?"!=p){a=9}break;case 11:if("%"==p){a=12}break;case 12:if(">"==p){a=0;t="src"}else if("%"!=p){a=11}break}if(ia){var k=b.substring(a,i),l=new u;l.decode(k,0);var j=l.ch,o=l.next==k.length,m;if(z(j)){if(F[k]){m="kwd"}else if(j==="@"){m="lit"}else{var n=false;if(j>="A"&&j<="Z"){for(var p=l.next;p="a"&&v<="z"){n=true; 18 | break}}if(!n&&!o&&k.substring(k.length-2)=="_t"){n=true}}m=n?"typ":"pln"}}else if(w(j)){m="lit"}else if(!s(j)){m="pun"}else{m="pln"}a=i;c.push(new q(k,m))}d=0;if(g==-1){h=i;continue}}d=g}}}function X(b){if(!(b&&b.length)){return b}var c=R(b);return G(b,c)}function W(b){var c=[],a=0,d="tag",f=null,h=new u;for(var i=0;i"){if("tag"!=d){m=l;n="tag"}}else{switch(a){case 0:if("<"== 19 | j){a=1}break;case 1:if(s(j)){a=2}break;case 2:if(!s(j)){n="atn";m=l;a=3}break;case 3:if("="==j){m=l;n="tag";a=5}else if(s(j)){m=l;n="tag";a=4}break;case 4:if("="==j){a=5}else if(!s(j)){m=l;n="atn";a=3}break;case 5:if('"'==j||"'"==j){m=l;n="atv";a=6;f=j}else if(!s(j)){m=l;n="atv";a=7}break;case 6:if(j==f){m=o;n="tag";a=2}break;case 7:if(s(j)){m=l;n="tag";a=2}break}}if(m){if(m>k){c.push(new q(g.substring(k,m),d));k=m}d=n}l=o}if(g.length>k){c.push(new q(g.substring(k,g.length),d))}}else{if(e.style){a= 20 | 0;d="tag"}c.push(e)}}return c}function U(b){var c=[],a=null,d=new u,f=null;for(var h=0,i=b.length;;++h){var e;if(h=0&&">"==d.decode(g,j+1)&&g.length==d.next){l=new q(g.substring(j,g.length),"tag");g=g.substring(0,j)}}if(null==f){f=[]}f.push(new q(g,"pln"))}else if("pln"==e.style){if(null==f){f=[]}f.push(e)}else if("tag"==e.style){if("<"==d.decode(e.token,0)&&e.token.length>d.next&&"/"==d.decode(e.token,d.next)){l=e}else{c.push(e)}}else if(h>=i){l=e}else{if(f){f.push(e)}else{c.push(e)}}if(l){if(f){var o= 22 | C(f);c.push(new q("",null));for(var m=0,n=o.length;m",null));f=null}if(l.token){c.push(l)}a=null}}else{c.push(e)}}return c}function Q(b){var c=null,a=null;for(var d=0;d=0;){if("pln"==b[d].style){a=d;break}}if(null==c){return b}var f=new u,h=b[c].token,i=f.decode(h,0);if('"'!=i&&"'"!=i){return b}var e=f.next,g=b[a].token,k=g.lastIndexOf("&");if(k<0){k=g.length-1}var l= 23 | f.decode(g,k);if(l!=i||f.next!=g.length){l=null;k=g.length}var j=[];for(var d=0;d",null));var k=C(Q(a));for(var l=0,j=k.length;l",null));a=null}}else if(f&&e.token.indexOf("=")>=0){var o=f.toLowerCase();if(y(o,"on")||"style"==o){d=true}}else{f=""}}else if("atn"==e.style){f+=e.token}else if("atv"==e.style){if(d){if(null==a){a=[]}g=a;e=new q(e.token,"pln")}}else{if(a){g=a}}g.push(e)}return c}function C(b){var c=V(b),a=[];for(var d=0;d=0;){if("pln"==c[f].style){a=L(I(c[f].token),">");break}}}break}}return a?O(c):C(c)}function Z(b){try{var c=P(b),a=[],d=null;for(var f=0;f")}if(h.style!=null){a.push("")}d=h.style}var i=h.token;if(null!=h.style){i=i.replace(/(\r\n?|\n| ) /g,"$1 ").replace(/\r\n?|\n/g,"")}a.push(i)}if(d!=null){a.push("")}return a.join("")}catch(e){if("console"in window){console.log(e);console.trace()}return b}}function Y(){var b=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],c=[];for(var a=0;a=0){var g=false;for(var k=e.parentNode;k!=null;k=k.parentNode){if((k.tagName=="pre"||k.tagName=="code"||k.tagName=="xmp")&&k.className&&k.className.indexOf("prettyprint")>=0){g=true;break}}if(!g){var l=N(e);l=l.replace(/(?:\r\n?|\n)$/,"");var j=Z(l);if(!E(e)){e.innerHTML=j}else{var o=document.createElement("PRE");for(var m=0;m li:last-child { 194 | border-radius: 0 0 15px 15px; 195 | -moz-border-radius: 0 0 15px 15px; 196 | -webkit-border-bottom-right-radius: 15px; 197 | -webkit-border-bottom-left-radius: 15px; 198 | } 199 | 200 | #qunit-tests .fail { color: #000000; background-color: #EE5757; } 201 | #qunit-tests .fail .test-name, 202 | #qunit-tests .fail .module-name { color: #000000; } 203 | 204 | #qunit-tests .fail .test-actual { color: #EE5757; } 205 | #qunit-tests .fail .test-expected { color: green; } 206 | 207 | #qunit-banner.qunit-fail { background-color: #EE5757; } 208 | 209 | 210 | /** Result */ 211 | 212 | #qunit-testresult { 213 | padding: 0.5em 0.5em 0.5em 2.5em; 214 | 215 | color: #2b81af; 216 | background-color: #D2E0E6; 217 | 218 | border-bottom: 1px solid white; 219 | } 220 | 221 | /** Fixture */ 222 | 223 | #qunit-fixture { 224 | position: absolute; 225 | top: -10000px; 226 | left: -10000px; 227 | } 228 | -------------------------------------------------------------------------------- /src/lina.js/MIT-License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Martin Wendt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/lina.js/test/test-lina.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mar10/arcade-js/feadac82c0c7a3c618819f4e1233d8e4a6dd17e4/src/lina.js/test/test-lina.js -------------------------------------------------------------------------------- /src/lina.js/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | LinaJS unit tests 14 | 15 | 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------
224 | 225 | Extends 226 | Class. 227 | 228 | 229 | 230 | 231 | 232 | Defined in: arcade-controls.js. 233 | 234 |
224 | 225 | 226 | 227 | 228 | 229 | 230 |
210 | 211 | 212 | 213 | 214 | 215 | 216 | Defined in: jsAsteroids.js. 217 | 218 |
210 | 211 | 212 | 213 | 214 | 215 | 216 |
222 | 223 | 224 | 225 | 226 | 227 | 228 |
31 | A JavaScript implementation of the Asteroids game using 32 | arcade.js 33 | (view the source to learn more). 34 |
36 | Use [left], [right], and [up] to move the ship. 37 | [space] to fire. 38 |
42 | This game requires HTML 5 support. 43 |
28 | This game requires HTML 5 support. 29 |
32 | A JavaScript implementation of carambolage using 33 | arcade.js 34 | (view the source to learn more). 35 |
37 | Click and drag the red ball to touch both white balls. 38 |
41 | This game requires HTML 5 support. 42 |
35 | A demo for arcade.js 36 | (view the source to learn more). 37 |
39 | This sample shows how to implement moving objects, circle-circle and 40 | circle-polygon collisions. 41 |
45 | This game requires HTML 5 support. 46 |
9 | A few demo applications built with arcade.js. 10 |
30 | A demo for arcade.js 31 | (view the source to learn more). 32 |
34 | This sample a simple render loop with two reflecting points. 35 |
39 | This game requires HTML 5 support. 40 |
12 | Overview 13 | jsRipOff is a clone of the Rip-off game written by Tim Skelly for 14 | Cinematronics in 1980. 15 | It was created as a demo for the open source game 16 | engine arcade.js. 17 |
19 | This game requires HTML5 support, namely <canvas> and <audio>. 20 | Therefore it will not run on Internet Explorer <= 8. 21 | It was tested however with Firefox 3.6, Chrome 8, Safari, and seems to run. Only 22 | sound is a bit flakey. 23 | 24 | The flocking behavior of the bandits is roughly mimicked, but not yet 25 | complete. 26 |
28 | Usage 29 | The goal of this game is to protect eight canisters in the center of the 30 | screen from being ripped-off by waves of enemies. 31 | Enemies can be destroyed by firing at or colliding with them. 32 | The players have infinite lives, but there is a small time penalty every 33 | time the player is hit. 34 | Player 1 35 | Use [Up], [Left], and [Right] keys to move 36 | the player's tank. Press [Space] to fire. 37 | Player 2 (or alternatively in single player mode) 38 | Use Mouse and left-click to move to cursor. Use right-click to aim and fire. 39 |
41 | The game is over, when the last canister was dragged off the screen by the 42 | enemies. 43 |
45 | Play jsRipOff 46 |
29 | This game requires HTML 5 support. 30 |
31 | A JavaScript implementation of the Rip-off game using 32 | arcade.js 33 | (view the source to learn more). 34 |
Audio with source elements (mp3, oga, wav) and 'type' attribute:
Audio not supported
Audio with source elements (mp3, oga, wav):
Audio with src attribute (mp3):
Audio with src attribute (oga):
Audio with src attribute (wav):