Skip to content

Instantly share code, notes, and snippets.

@Awea
Last active November 12, 2015 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Awea/9c7e4f0ac42b8a7fe337 to your computer and use it in GitHub Desktop.
Save Awea/9c7e4f0ac42b8a7fe337 to your computer and use it in GitHub Desktop.
class ChildrenFilter
@byName: (children, name) ->
$.grep(children, (child) ->
return child.name == name
)[0]
@byNameOrCreate: (game, stage, children, name) ->
byName = @byName(children, name)
byName = if typeof byName == 'undefined' then false else byName
if byName
byName
else
new Phaser.Group(game, stage, name, true)
class CanvasTweens
@starsBlink: (context, stars) ->
stars.forEach((star) ->
@game.add.tween(star).to({
alpha: 0
}, @game.rnd.integerInRange(600, 1500), null, true, @game.rnd.integerInRange(800, 1500), -1, true)
, context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment