Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created March 14, 2012 06:35
Show Gist options
  • Save easierbycode/2034645 to your computer and use it in GitHub Desktop.
Save easierbycode/2034645 to your computer and use it in GitHub Desktop.
extending classes
adc = adc or {}
class adc.particle
bounds: null
constructor: ->
@x = Math.random() * @bounds.x2
@y = Math.random() * @bounds.y2
class adc.particleFoo extends adc.particle
bounds:
x2: 640
y2: 480
console.log(new adc.particleFoo) for n in [1..200]
# // [ Object { bounds={...}, x=142.1781918295256, y=66.18729196594839, more...}, Object { bounds={...}, x=605.1677214680562, y=282.0907601316014, more...}, ... ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment