wobblyhead hg > minor_monsters
comparison game/js/input.js @ 32:85d23328a215 0.10.0
added intro music, logic for browser audio triggering on splash screen
| author | ark |
|---|---|
| date | 2026-10-20 18:39 +0200 |
| parents | 3f2811aebb3d |
| children | 83e8b0e0f010 |
comparison
equal
deleted
inserted
replaced
| 31:d1ae50439686 | 32:85d23328a215 |
|---|---|
| 11 // how far a press on the preview may move and still count as a tap that | 11 // how far a press on the preview may move and still count as a tap that |
| 12 // builds, css pixels. a longer move drags the preview | 12 // builds, css pixels. a longer move drags the preview |
| 13 var DRAG_SLOP = 10; | 13 var DRAG_SLOP = 10; |
| 14 var REFUSED_TIME = 500; | 14 var REFUSED_TIME = 500; |
| 15 | 15 |
| 16 // app: {canvas, view, game(), layout(), and the screen actions play(), | 16 // app: {canvas, view, game(), layout(), and the screen actions |
| 17 // next(), retry(), restart()} | 17 // startSound(), play(), next(), retry(), restart()} |
| 18 function attach(app) { | 18 function attach(app) { |
| 19 var c = app.canvas; | 19 var c = app.canvas; |
| 20 // the press that moves the placement preview, followed until the | 20 // the press that moves the placement preview, followed until the |
| 21 // pointer is released. other pointers are ignored meanwhile | 21 // pointer is released. other pointers are ignored meanwhile |
| 22 var drag = null; | 22 var drag = null; |
| 105 // any other button cancels an armed sell, and any button outside | 105 // any other button cancels an armed sell, and any button outside |
| 106 // the tower menu closes it | 106 // the tower menu closes it |
| 107 if (b.id !== "sell") game.sellArmed = false; | 107 if (b.id !== "sell") game.sellArmed = false; |
| 108 if (b.id !== "sell" && b.id !== "upgrade") game.selected = null; | 108 if (b.id !== "sell" && b.id !== "upgrade") game.selected = null; |
| 109 if (b.id === "logo" || b.id === "email") return { game: game, button: b.id }; | 109 if (b.id === "logo" || b.id === "email") return { game: game, button: b.id }; |
| 110 if (b.id === "play") app.play(); | 110 if (b.id === "start_sound") app.startSound(); |
| 111 else if (b.id === "play") app.play(); | |
| 111 else if (b.id === "next") app.next(); | 112 else if (b.id === "next") app.next(); |
| 112 else if (b.id === "retry") app.retry(); | 113 else if (b.id === "retry") app.retry(); |
| 113 else if (b.id === "restart") app.restart(); | 114 else if (b.id === "restart") app.restart(); |
| 114 else if (b.id === "help") game.openHelp(); | 115 else if (b.id === "help") game.openHelp(); |
| 115 else if (b.id === "close_help") game.closeHelp(); | 116 else if (b.id === "close_help") game.closeHelp(); |
