Skip to content

Commit

Permalink
* Updated emitter tutorial
Browse files Browse the repository at this point in the history
* Fixing some documentation
  • Loading branch information
bfattori committed Aug 23, 2011
1 parent ed521b7 commit 2b9041c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
8 changes: 4 additions & 4 deletions build.properties
@@ -1,17 +1,17 @@
## Numeric version of the engine (used in filename) ## Numeric version of the engine (used in filename)
app.version=2.0.0.10 app.version=2.0.0.11


## Text version of the engine (used in docs) ## Text version of the engine (used in docs)
build.version=v2.0.0.10 beta build.version=v2.0.0.11 beta
build.date=7/20/2011 build.date=8/14/2011


## Compressor options ## Compressor options
compress.option=engine.compile compress.option=engine.compile
compiler.jvm=C:/Program Files (x86)/Java/jdk1.6.0_20/bin/java compiler.jvm=C:/Program Files (x86)/Java/jdk1.6.0_20/bin/java


## DEMOS TO COPY ## ## DEMOS TO COPY ##
#demo.set=potris/**,smb/**,spaceroids/**,wii_test/** #demo.set=potris/**,smb/**,spaceroids/**,wii_test/**
demo.set=empty/**,htmlcontext/**,isometric/**,physics/**,physics2/**,textrender/**,tilemap/**,ui/**,vector/** demo.set=empty/**,htmlcontext/**,isometric/**,physics/**,physics2/**,tilemap/**,vector/**


## TOOLS TO COPY ## ## TOOLS TO COPY ##
#tool.set=support/**,font_editor/** #tool.set=support/**,font_editor/**
Expand Down
6 changes: 3 additions & 3 deletions engine/baseobject.js
Expand Up @@ -167,7 +167,7 @@ R.engine.BaseObject = function(){
}, },


/** /**
* Add an event handler to this object, as long as it has an associated HTML element. Within the * Add an event handler to this object. Within the
* event handler, <tt>this</tt> refers to the object upon which the event is being triggered. It is * event handler, <tt>this</tt> refers to the object upon which the event is being triggered. It is
* possible to bind an event simply by calling <tt>addEvent</tt> with the type and callback, like * possible to bind an event simply by calling <tt>addEvent</tt> with the type and callback, like
* so: * so:
Expand Down Expand Up @@ -248,10 +248,10 @@ R.engine.BaseObject = function(){
* <pre> * <pre>
* // Shorthand * // Shorthand
* this.addEvents({ * this.addEvents({
* "keydown": function(which) { * "keydown": function(evt, which) {
* this.onKeyDown(which); * this.onKeyDown(which);
* }, * },
* "keyup": function(which) { * "keyup": function(evt, which) {
* this.onKeyUp(which); * this.onKeyUp(which);
* } * }
* }); * });
Expand Down
2 changes: 1 addition & 1 deletion engine/build/engine.intro.js
Expand Up @@ -84,7 +84,7 @@ R._unsupported = function(method, clazz) {
throw new Error(method + " is unsupported in " + clazz.getClassName()); throw new Error(method + " is unsupported in " + clazz.getClassName());
}; };


/** private **/ /** @private **/
R.str = Object.prototype.toString; R.str = Object.prototype.toString;


/** /**
Expand Down
14 changes: 13 additions & 1 deletion engine/particles/emitter.js
Expand Up @@ -40,13 +40,25 @@ R.Engine.define({
}); });


/** /**
* @class Particle emitter class. A particle emitter emits particles at a regular * @class Particle emitter class. Emits particles at a regular
* interval as long as it is active. The function that is passed to generate * interval as long as it is active. The function that is passed to generate
* the particles will be called with three arguments: an offset position, the * the particles will be called with three arguments: an offset position, the
* current world time, and the delta from when the last frame was drawn. The function * current world time, and the delta from when the last frame was drawn. The function
* can either return a single particle or an <code>Array</code> of particles. * can either return a single particle or an <code>Array</code> of particles.
* Within the scope of the function, "this" refers to the {@link R.particles.Emitter} * Within the scope of the function, "this" refers to the {@link R.particles.Emitter}
* object. * object.
* <pre>
* // Create the particle emitter which returns the type of particle
* // we want to emit. 5 is the delay between particle emissions and
* // 350 is the life of the particle (both in milliseconds)
* var emitter = R.particles.Emitter.create(function(offset) {
* // Create a particle
* return FuseParticle.create(offset, 350);
* }, 5);
*
* // Assign the emitter to the particle engine which will draw it
* emitter.setParticleEngine(Tutorial13.pEngine);
* </pre>
* *
* @param emitFunc {Function} A function that emits new particles. * @param emitFunc {Function} A function that emits new particles.
* @param interval {Number} The time between emissions * @param interval {Number} The time between emissions
Expand Down
7 changes: 5 additions & 2 deletions tutorials/tutorial13/bomb.js
Expand Up @@ -70,10 +70,13 @@ var Bomb = function() {
// Create the particle emitter which returns the type of particle // Create the particle emitter which returns the type of particle
// we want to emit. 5 is the delay between particle emissions and // we want to emit. 5 is the delay between particle emissions and
// 350 is the life of the particle (both in milliseconds). An emitter // 350 is the life of the particle (both in milliseconds). An emitter
// only emits one particle per cycle. // can emit multiple particles at a time by returning an array of
// particles.
var emitter = R.particles.Emitter.create(function(offset) { var emitter = R.particles.Emitter.create(function(offset) {
// Create a particle // Create a particle
return FuseParticle.create(offset, 350); return [FuseParticle.create(offset, 350),
FuseParticle.create(offset, 500),
FuseParticle.create(offset, 180)];
}, 5); }, 5);


// Assign the emitter to the particle engine which will draw it // Assign the emitter to the particle engine which will draw it
Expand Down

0 comments on commit 2b9041c

Please sign in to comment.