Skip to content

Instantly share code, notes, and snippets.

View bokuweb's full-sized avatar
👾
Working from home

bokuweb bokuweb

👾
Working from home
View GitHub Profile
Timer = cc.Class.extend
ctor : ->
@_startTime = 0
@_pauseTime = 0
start : -> @_startTime = new Date()
get : ->
if @_startTime
((new Date() - @_startTime) + @_pauseTime) / 1000
res = require('./resource').res
GameLayer = cc.Layer.extend
ctor : ->
@_super()
@_addBg()
size = cc.winSize
helloLabel = new cc.LabelTTF "Hello World", "Arial", 38
helloLabel.x = size.width / 2
res =
noteImage : "res/note.png"
destImage : "res/dest.png"
bgImage : "res/bg.jpg"
music : "res/Ouroboros.mp3"
coverImage : "res/cover.jpg"
resources = []
resources.push v for k, v of res
res = require('./resource').res
resources = require('./resource').resources
cc.game.onStart = ->
GameScene = require './app'
if not cc.sys.isNative and document.getElementById "cocosLoading"
document.body.removeChild(document.getElementById "cocosLoading")
cc.view.enableRetina off
cc.view.adjustViewPort on
HelloWorldLayer = cc.Layer.extend
sprite : null
ctor : ->
@_super()
size = cc.winSize
helloLabel = new cc.LabelTTF "Hello World", "Arial", 38
helloLabel.x = size.width / 2
helloLabel.y = size.height / 2
@addChild helloLabel, 5
gulp = require 'gulp'
coffee = require 'gulp-coffee'
watchify = require 'gulp-watchify'
watching = false
gulp.task 'enable-watch-mode', -> watching = true
gulp.task 'build:coffee', ->
gulp.src './src/*.coffee'
.pipe coffee()
Layer = cc.Layer.extend
ctor : ->
@_super()
cc.eventManager.addListener
event : cc.EventListener.TOUCH_ONE_BY_ONE
swallowTouches : true
onTouchBegan : @onTouchBegan.bind this
, this
onTouchBegan : (touch, event)->
res =
textureImage : "res/particle_texture.png"
texturePlist : "res/particle_texture.plist"
resources = []
resources.push v for k, v of res
module.exports =
res : res
Layer = cc.Layer.extend
ctor : ->
@_super()
size = cc.director.getWinSize()
emitter = new cc.ParticleSystem Res.texturePlist
emitter.x = size.width / 2
emitter.y = size.height / 2
@addChild emitter
res =
textureImage : "res/particle_texture.png"
texturePlist : "res/particle_texture.plist"