Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SnowFlake
- {
- private float x, y;
- private float xspeed, yspeed;
- public SnowFlake()
- {
- Reset();
- }
- public void Reset()
- {
- this.x = rand() * SCREEN_WIDTH;
- this.y = 0;
- this.xspeed = rand() * 10.0 - 5.0;
- this.yspeed = 1.0 + rand() * 2.0;
- }
- public void Update()
- {
- this.x += this.xspeed;
- this.yspeed += this.yspeed;
- if (/* PARTICLE OUTSIDE SCREEN */)
- Seed();
- }
- public void Draw()
- {
- // Draw particle to screen somehow
- }
- }
- flakes = new SnowFlake[100];
- for (int i=0;i<flakes.Count;i++)
- flakes[i] = new SnowFlake();
- for(flake in flakes)
- {
- flake.Update();
- flake.Draw();
- Sleep(10); // Slow down
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement