With all your Picture Declarations near the top of the program, you don't need all those "freed" lines, just draw the pics. (and also no need for those other picture declarations in there.) Heck, I think you can just junk the entire "FreePics" procedure, because you've already gotten all the pictures you need, and there is no need to be freeing them repeatedly.
Posted: Wed Oct 19, 2011 10:18 pm Post subject: Re: Platformer (Climber)
Beastinonyou @ 19/10/2011, 8:58 pm wrote:
I No Longer Crash ... Which is a good thing =P
and there is no need to be freeing them repeatedly.
It's not freeing them repeatedly. I'll take it out if necessary, but isn't it good to practice freeing your pics? It's not repeatedly freeing them because it frees the bottom pictures (after u go through the portal) if you go above the purple platform. You can't go back down. (Unless you Admin cheat). Isn't this conserving space? I realize that I don't have 1000 pictures, but that shouldn't prevent me from freeing picks after a certain point? Or should it?
Tony said the same thing you did, could you please elaborate on why it's not good? (Other than the program being small.)
Beastinonyou
Posted: Wed Oct 19, 2011 10:34 pm Post subject: Re: Platformer (Climber)
Freeing your pictures should be used when necessary, like in the instance that you are using many, many images.
In your situation, with a mere 15 pictures, freeing them to conserve space, is just more coding that doesn't need to be coded.
Somewhat of an Analogy - You have a gun with 1,000 bullets, and you're reloading after you fire off <15 bullets.
Not sure if it's a proper analogy, but it doesn't really make sense if you're reloading after 15 bullets, if you have 1,000, and say "Just in case I don't run out"
Aange10
Posted: Wed Oct 19, 2011 10:53 pm Post subject: RE:Platformer (Climber)
Well, is it not good coding practice? I took me less than 10 minutes to code that. I want to make everything run right, and even better. 10 minutes is not much for something so appeasing. And it's easy to add new pictures. If I continued to expand, I would have a system to conserve space.
And it's more like if quick writing an essay. Yeah I don't need to think recursively to write the paper, a linear approach would be just fine. But if it was a real essay I would need to. I'm not losing anything by practicing my writing skills.
Tony
Posted: Wed Oct 19, 2011 11:10 pm Post subject: RE:Platformer (Climber)
It adds complexity, which in software typically leads to bugs.
To be exact, you are manually keeping track of specific pictures, specific player locations/boundaries, and a bunch of flag/state variables. You essentially have resource, data, and logic duplication between proc free_pics and the rest of your program.
You make a good point about coding practice -- I would suggest thinking about a procedure to load/unload an abstract level. Something general enough to work for any level (current and future), so no reference to any specific resource by name.