Skip to content

Instantly share code, notes, and snippets.

View mattcolman's full-sized avatar

Matt Colman mattcolman

View GitHub Profile
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]
@mattcolman
mattcolman / barebones.yml
Created October 7, 2012 22:18
barebones yml
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}
@mattcolman
mattcolman / tally.yml
Created October 19, 2012 03:25
Tally
:variables:
<<: *caper_common
<<: *tally
tally_spacing:
:content:
- 35
@mattcolman
mattcolman / add_assets.coffee
Last active December 13, 2015 21:08
Adding assets
# 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
@mattcolman
mattcolman / movieclips.coffee
Last active December 13, 2015 21:08
Movieclips
@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')
@mattcolman
mattcolman / fat_thin.coffee
Created February 13, 2014 00:09
fat or thin arrow
# 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', @
$(document).bind("keydown", function (e) {
if (e.keyCode == 8) { // backspace
e.preventDefault()
// do whatever the backspace should do
}
}