Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Program problem

Author
Message
TeenCHristian
14
Years of Service
User Offline
Joined: 22nd Jun 2010
Location:
Posted: 2nd Jul 2010 15:28
So I've embarked on my second program with the Dark GDK. It's been going great so far. What I've got now is a screen with a background, and clouds floating by. The problem is that when I add a animated sprite one of the clouds just stays at one point. When I take the code for the animated Sprite out, everything works fine.

Before animated sprite code:


With animated Sprite code:


Any help? Thanks!

Learning C++
Proud member of www.codecall.com
bloodmage2
15
Years of Service
User Offline
Joined: 14th Jun 2009
Location:
Posted: 5th Aug 2010 18:49
there are a couple of things wrong with this.
first off, create your animated sprite outside of LoopGDK. this is basically loading the sprite every cycle, and is not good practice. when you play the sprite, it has an incredibly high delay, so lower that to say, less than 25. also, this wouldn't create problems for the program, but its better to use words than single characters for variable names. it would be even better if you had them in an array.
for example, replace k,a,b,c with "int CloudX[4] = {-1150, -1200, -800, -300};", and access it with "CloudX[/*number here*/]" with k's number being 0, a's 1, b's 2, and c's 3. also, you do not need to use dbSprite inside the while loop. if the object is not moving.

-to the optimist, the glass is half full. to the pessimist, it is half empty, to the engineer, it is twice as big as it needs to be.
http://www.lionsbloodstudios.justinman.net/index.htm
TeenCHristian
14
Years of Service
User Offline
Joined: 22nd Jun 2010
Location:
Posted: 6th Aug 2010 01:02
Thanks for your response bloodmage. I have, in fact, fixed my problem. I have my animated sprite over a moving background. At this point I have run into a new problem. It would be great if you could check it out here. Hopefully you'll have some advice.

Thanks for everything!

Learning C++
Proud member of www.codecall.com

Login to post a reply

Server time is: 2024-07-02 09:02:05
Your offset time is: 2024-07-02 09:02:05