This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing(..) | |
import Html exposing (..) | |
import Html.App as Html | |
import Html.Events exposing (..) | |
import Html.Attributes exposing (src, style, class, id, width, height, autoplay, loop) | |
import Json.Decode as Json | |
import String | |
import String.Extra | |
import List.Extra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Main exposing(..) | |
import Html exposing (..) | |
import Html.App as Html | |
import Html.Events exposing (..) | |
import Html.Attributes exposing (src, style) | |
import Json.Decode as Json | |
import String | |
import String.Extra | |
import Regex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (Html, button, div, text) | |
import Html.App as Html | |
import Html.Events exposing (onClick) | |
main = | |
Html.beginnerProgram | |
{ model = model | |
, view = view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (..) | |
import Html.App as Html | |
-- MODEL | |
type alias Model = | |
{ value : Int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (..) | |
import Html.App as Html | |
import Html.Events exposing (..) | |
-- MODEL | |
type alias Model = | |
{ content : String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
#### rectangleCollision | |
Use it to prevent two rectangular sprites from overlapping. | |
Optionally, make the first retangle bounceoff the second rectangle. | |
Parameters: | |
a. A sprite object with `x`, `y` `center.x`, `center.y`, `halfWidth` and `halfHeight` properties. | |
b. A sprite object with `x`, `y` `center.x`, `center.y`, `halfWidth` and `halfHeight` properties. | |
c. Optional: true or false to indicate whether or not the first sprite | |
should bounce off the second sprite. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset="utf-8"> | |
<title>Basic WebAudio API sound sprite</title> | |
<p>Press 1 to play the sound</p> | |
<script> | |
//Define the audio context | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# movingCircleCollision | |
Use it to make two moving circles bounce off each other. | |
Parameters: | |
a. A sprite object with `x`, `y` `centerX`, `centerY` and `radius` properties. | |
b. A sprite object with `x`, `y` `centerX`, `centerY` and `radius` properties. | |
The sprites can contain an optional mass property that should be greater than 1. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
makeIsoTiledWorld | |
================= | |
An interpreter for isometric Tiled Editor JSON output. | |
Important: To work it requires to custom map properties: | |
`cartTilewidth` and `cartTileheight`. These are the Cartesian | |
(flat 2D) dimensions of the tile map array. These are needed | |
because it's common to have a 32x32 tile map array that displays | |
64x64 sprites. |
NewerOlder