Skip to content

Instantly share code, notes, and snippets.

View mattcolman's full-sized avatar

Matt Colman mattcolman

View GitHub Profile
actor = @addActor "sample_actor", SampleActor, parent, {x:10, y:20}
:variables:
<<: *caper_common
<<: *lives
lives_options:
:content:
- {xoffset: 20, yoffset: 0, lives: 4}
@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:
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]
# call @method in 2 seconds
@delayedCall(2, @method)
# delete the delayedCall
@tweenMax.killDelayedCallsTo(@method)
@mattcolman
mattcolman / clickable.coffee
Created September 27, 2012 03:48
Clickable
# turn a DisplayObject 'coin' into a Clickable object
coin = @bitmap 'coin'
coin.centreRegistrationPoint()
coin.x = coin.y = 300
@stage.addChild coin
@clickable = @makeClickable coin, {over: @bitmap('coin_light'), down: @bitmap('coin_dark')}
@clickable.on 'click', @handleClick
# use the SimpleButton class to create...a simple button
@mattcolman
mattcolman / extract_frame.coffee
Created September 27, 2012 03:41
Extracting a frame from a Spritesheet
img = @mySpritesheet.bitmapFromFrame 'frameLabelOrIndex'
img.centreRegistrationPoint()
@stage.addChild img
@mattcolman
mattcolman / hit_area.coffee
Created September 21, 2012 06:03
HitArea
@cnt.addHitArea new Rectangle(0, 0, 200, 300), false
@droppable = new Droppable(@cnt)
@mattcolman
mattcolman / aspect-ratio.coffee
Created September 21, 2012 05:56
Aspect ratio
class Main extends Activity
enter: ->
super
@mainCnt = new Container()
@stage.addChild @mainCnt
@adjustForAspectRatio @mainCnt
@mattcolman
mattcolman / drag_drop.coffee
Created September 17, 2012 06:03
Drag and drop
define [
'caper/actor'
], (Actor) ->
class Ball extends Actor
added: ->
#DRAGGABLE
@dragImage = @bitmap 'draggy'
@stage.addChild @dragImage