2D snow Need help
Blitz3D Forums/Blitz3D Programming/2D snow Need help
| ||
Hey, I'm making a 2D game right, where the character is able to dig through snow. What I've done so far, is created a Type called Snow, then made several thousand 1 pixel by 1 pixel pieces of snow to cover the ground. Then I simply run a function, that erases one anytime the player collides with it. The problem is, my game can only handle about 5000 of these before crashing and I need them to fill the entire screen. (Meaning around 480,000 of them). I created them, by making a 1,1 image using createimage, and then using Plot to slap down a white pixel. Then a For loop like so. For Snows = 1 to 5000 Snow.Snow = New Snow Snow\image = SnowImage; < The image previously created Snow\x = x Snow\y = y next Is there a better way to do this? to create several thousand 1 pixel snow flakes that cover the screen? Thanks, WERDNA |
| ||
Haha, Thats crazy 480,000 images Well couldn't you just void creating the image all together? Just plot on the back buffer? |
| ||
If the char image is not very big you could loop through every pixel of it and where the char-image-pixels are not transparent compare against the pixels of a snow-image on the proper x, y offset, and simply "remove" the snow by writing pixels of a different color ... Example: (keys w, a, s, d and ESC to end) |
| ||
Oh, lol! I should have thought of that. Thanks for the example Mahan! Thanks to this, in a few days I'll be able to upload my newest mini game. Plow Dog! WERDNA |