Falling Snow

Advanced game related topics
The Th!ng
New User
New User
Posts: 4
Joined: Wed Feb 20, 2013 10:00 pm

Falling Snow

Post by The Th!ng »

To start off my adventures in PB I'd like to write a program that displays falling snow - that is one pixel represents one flake, falling from the top of the screen to the bottom and building up there in drifts as it were. What is the best means of keeping track of a few hundred flakes as they fall at different speeds. Is a list or an array the best option in this regards? To check if a flake has reached the bottom of the screen I'll just check it's status on the Y-Axis, but what about the build-up of flakes along the bottom of the screen? Is a check of the colour of the pixel in front of (below) the falling flake the right way of determining whether a flake continues to fall or not the right way of doing it?

Looking forward to some helpful replies, thanks.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Falling Snow

Post by J. Baker »

www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
The Th!ng
New User
New User
Posts: 4
Joined: Wed Feb 20, 2013 10:00 pm

Re: Falling Snow

Post by The Th!ng »

Thanks for the link, J. Baker, there's no comments which leaves some of it a bit cryptic for me. for starters could you explain what
Static Dim Snow.SnowCalculations(#MaxFlakes) is doing - you have a static array of some type called snow is it??? or is the array called Snow.SnowCalculations - I'm coming from C# so whenever I see dot notation I'm thinking of it like a method or property.


Thanks again.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Falling Snow

Post by luis »

The Th!ng wrote: Static Dim Snow.SnowCalculations(#MaxFlakes) is doing - you have a static array of some type called snow is it??? or is the array called Snow.SnowCalculations - I'm coming from C# so whenever I see dot notation I'm thinking of it like a method or property.
http://www.purebasic.com/documentation/ ... ables.html

http://www.purebasic.com/documentation/ ... e/dim.html

SnowCalculations it's the data type, it's a structure, so Snow it's an array of structures.

Probably you should give the manual a read from top to bottom before starting to code something not trivial, anyway it's your choice. :wink:
"Have you tried turning it off and on again ?"
The Th!ng
New User
New User
Posts: 4
Joined: Wed Feb 20, 2013 10:00 pm

Re: Falling Snow

Post by The Th!ng »

luis wrote:
The Th!ng wrote: Static Dim Snow.SnowCalculations(#MaxFlakes) is doing - you have a static array of some type called snow is it??? or is the array called Snow.SnowCalculations - I'm coming from C# so whenever I see dot notation I'm thinking of it like a method or property.
http://www.purebasic.com/documentation/ ... ables.html

http://www.purebasic.com/documentation/ ... e/dim.html

SnowCalculations it's the data type, it's a structure, so Snow it's an array of structures.

Probably you should give the manual a read from top to bottom before starting to code something not trivial, anyway it's your choice. :wink:
Ah, now I understand, thank you for clearing that up and for the links, too.

I bought a copy of Programming 2D Scrolling Games for my Kindle yesterday and I have been reading the PureBasic - A Beginner's Guide To Computer Programming *.pdf as well as using the help file that comes with PB.


Regards.
Post Reply