The Beginner's Guide to Game Programming:
A Problem Solving Approach
Episode 1: Makin' Pickin' Sticks
Part 8: Enumerations and Random Numbers
Displaying sprites off a sprite sheet with Enumeration...
The Beginner's Guide to Game Programming: A Problem Solving Approach Episode 1: Makin' Pickin' Sticks Part 8: Enumerations and Random Numbers
Displaying sprites off a sprite sheet with Enumerations
Generating Random Numbers
This is a written and video tutorial created to teach the basics of Allegro and SDL as well as game programming in general, while encouraging the newbie to code it out themselves.
Like to rate videos and let people know what you think?
Automatically share your ratings, favorites, and more on Facebook, Twitter, and Google Reader with YouTube Autoshare.
Autoshare makes certain YouTube activities public on the services you choose. Select only the services you are comfortable with - like Facebook, Twitter, or Google Reader - to let your friends know what you like on YouTube. You can turn Autoshare off at any time.
Like to share videos with friends?
Automatically share your ratings, favorites, and more on Facebook, Twitter, and Google Reader with YouTube Autoshare.
Autoshare makes certain YouTube activities public on the services you choose. Select only the services you are comfortable with - like Facebook, Twitter, or Google Reader - to let your friends know what you like on YouTube. You can turn Autoshare off at any time.
I'm having trouble with my coordinate generation function. The first time I use it, it generates a random number. After that, the coordinates go in a diagonal line until they hit the edge of the screen and then it appears at the opposite side of the screen. What could I be doing wrong?
Enumerations automatically initialize all the stuff they contain with an increasing value each time. So first will be one, second will be 2 and so on.
This is usefull when you just want any old intialized value.
Autoshare makes certain YouTube activities public on the services you choose. Select only the services you are comfortable with - like Facebook, Twitter, or Google Reader - to let your friends know what you like on YouTube. You can turn Autoshare off at any time.
but i suggest to delve deeper into "random" numbers generation via the % operator ... there's a problem with lower bits being far from random.
don't they take up a bit of RAM and do the same thing as #define wich uses 0 RAM?
maybe i'm missing something :P
That's about it. I like making random datatypes for "Direction", "GameState", etc.
This is usefull when you just want any old intialized value.
I haven't found anything that covers it... ):
If it's "unsigned", that means it's positive only, so it doubles how large it can be since it doesn't have an amount for the - numbers.