Flint Particle System Forum - Cellular Automata2010-12-25T17:32:04+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Cellular Automatahttp://flintparticles.org/forum/comments.php?DiscussionID=240&Focus=866#Comment_8662009-07-17T19:10:31+01:002010-12-25T17:32:04+00:00ppdev5http://flintparticles.org/forum/account.php?u=225
Hello,
I've been playing around with Flint for some days and I like it very much. Thanks Richard!
I've thought about it and I would think i't woul be really cool to have an action to ...
I've been playing around with Flint for some days and I like it very much. Thanks Richard!
I've thought about it and I would think i't woul be really cool to have an action to incorporate cellular automata!(example :http://blog.soulwire.co.uk/flash/actionscript-3/2d-cellular-automata/)
You can change the rules around for the cellular automata to create cool effects. For example there is a "copy random neighbor" rule that creates a perfect explosion effect. I suggest you read more : http://en.wikipedia.org/wiki/Cellular_automaton
I'm thinking of creating my own action that makes a cellular automata that can be extended to create differnet rules, but I have no idea how to start.
Any ideas on how to do this?]]>
Cellular Automatahttp://flintparticles.org/forum/comments.php?DiscussionID=240&Focus=868#Comment_8682009-07-17T22:33:50+01:002009-07-17T22:41:28+01:00ppdev5http://flintparticles.org/forum/account.php?u=225
Hey guys,
I'm finished with the CellularAutomata action, it still needs some work(e.g. particles can't come back to life)!
Here is the source code:
package ...
I'm finished with the CellularAutomata action, it still needs some work(e.g. particles can't come back to life)!
Here is the source code: package org.flintparticles.twoD.actions{ //Author Priyank Patel //Uses Flint Particle System import org.flintparticles.common.actions.ActionBase; import org.flintparticles.common.emitters.Emitter; import org.flintparticles.common.particles.Particle; import org.flintparticles.twoD.emitters.Emitter2D; import org.flintparticles.twoD.particles.Particle2D;
public class CellularAutomata extends ActionBase{
public var automate:Function; public var boxw:int; public var boxh:int; public var result:Boolean;
public function CellularAutomata(rule:Function,width:int=3,height:int=3){
public override function update(emitter:Emitter,particle:Particle,time:Number):void{
var p:Particle2D = Particle2D( particle ); var e:Emitter2D = Emitter2D( emitter ); var particles:Array = e.particles; var neighbors:Array = new Array();
Implement it like this: emitter.addAction( new CellularAutomata(rule,101,101)); function rule(neighbors:Array,particle:Particle2D){ if(neighbors.length>1){ return true; } else{ trace("died!"); return false; } } ]]>