Page 1 of 1
Falling Snow
Posted: Mon Feb 25, 2013 10:20 pm
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.
Re: Falling Snow
Posted: Tue Feb 26, 2013 12:24 am
by J. Baker
Re: Falling Snow
Posted: Tue Feb 26, 2013 10:25 pm
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.
Re: Falling Snow
Posted: Tue Feb 26, 2013 11:02 pm
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.

Re: Falling Snow
Posted: Tue Feb 26, 2013 11:49 pm
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.

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.