Computer Science Canada

Snow? The Beginnings of a Particle Engine?

Author:  [Gandalf] [ Mon Jun 20, 2005 7:29 pm ]
Post subject:  Snow? The Beginnings of a Particle Engine?

Well, I was looking back at Catalyst's manifestations and I thought what they hey. This might not compare at all, and I'm not even sure what a "particle engine" is supposed to be, but its a start. It's not a FP or anything, but I'm probably going to work on it for a while since I haven't really done much large projects on Turing.

Tell me some basic ways to improve it. If it gets good enough I might post the source. I got the movement idea from Catalyst's "Pinwheel" one.

So yeah, what the heck - here it is:

Author:  Cervantes [ Mon Jun 20, 2005 7:45 pm ]
Post subject: 

Pretty good. Now I see why you were asking about the types. Now that I understand, here's the real answer Laughing
code:

var snowFlake : flexible array 1 .. 0 of
    record
        x, y : real
        %maybe you needed vx and vy, or angle and velocity, etc.
        %whatever else you used for the clumps of particles goes here
        particle : array 1 .. 15 of
            record
                x, y : real
                %any other variables
           end record
    end record

Since each snow flake has the same number of particles in it, this is fine. If each snow flake could have a varying number of particles, you'd have to use a flexible array inside the record, which is illegal in Turing. Rolling Eyes
Is that how you did it?

Good work. +15 bits

Author:  [Gandalf] [ Mon Jun 20, 2005 8:00 pm ]
Post subject: 

Thanks for the help and the bits!

For the example I posted I took out all the other variables to make it simpler, but I do have some. No, I didn't do it that way, but I did have the same amount of particles in each snowflake. Now I see that yours is much better Smile. I'll change it as soon as I have some more time.


: