A converter for use with BmpGlyph. Converts the fnt format into coffeescript.
A Pen by Matt Colman on CodePen.
define [ | |
'caper/game', | |
'caper/game_states/intro', | |
'caper/game_states/outro', | |
'activities/barebones/main', | |
], (Game, Intro, Outro, Main) -> | |
class Barebones extends Game | |
states: [ | |
['intro', new Intro] |
barebones: | |
<<: *js_activity | |
:variables: | |
<<: *caper_common | |
<<: *results_sfx | |
extra_assets: | |
:content: | |
- barebones | |
assets: | |
- image: |
:variables: | |
<<: *caper_common | |
<<: *lives | |
lives_options: | |
:content: | |
- {xoffset: 20, yoffset: 0, lives: 4} |
actor = @addActor "sample_actor", SampleActor, parent, {x:10, y:20} |
:variables: | |
<<: *caper_common | |
<<: *tally | |
tally_spacing: | |
:content: | |
- 35 |
# add a bitmap | |
newBitmap = @bitmap('my_bitmap') | |
@stage.addChild(newBitmap) | |
# extract frame 2 from a spriteSheet and use it as a bitmap | |
newSpriteSheet = @spriteSheet('my_spritesheet') | |
newSpriteSheet.bitmapFromFrame(2) | |
@stage.addChild(newSpriteSheet) | |
# add a BitmapAnimation |
@documentMC = @newMovieClip('movieclip_filename', 'MyClassName') | |
# If you enter the class name as the filename you can import the main timeline from the FLA, | |
# unless you have specifically changed the name of the Document class. | |
@mainCnt.addChild @documentMC | |
# **** MONSTER **** # | |
monster = @documentMC.monster | |
monster.onClick = => | |
monster.gotoAndPlay('correct') |
# Fat arrow implementation | |
box.on 'go', @handleGo | |
handleGo: (e) => | |
e.target.removeListener 'go', @handleGo | |
@game.nextState() | |
# Thin arrow implementation | |
scope = @ | |
box.on 'go', -> | |
@removeListener 'go', @ |
A converter for use with BmpGlyph. Converts the fnt format into coffeescript.
A Pen by Matt Colman on CodePen.
$(document).bind("keydown", function (e) { | |
if (e.keyCode == 8) { // backspace | |
e.preventDefault() | |
// do whatever the backspace should do | |
} | |
} | |