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 / Whats wrong with my code? (Absolute GDK beginner here)

Author
Message
Ulnarian
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 30th Apr 2009 05:38
So, I have the following program which creates to ball shaped sprites. When the user presses the spacebar, the bottom sprite is supposed to move towards the top sprite. When the two touch each other, I want the moving sprite to be reset to its original position.

Trouble is, nothing is moving in my program. What am I doing wrong?





Thanks
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 30th Apr 2009 21:42
For dbMoveSprite(), you have 8.0f as the velocity. That is really fast. Try using something like 0.5f because what I think is happening is the sprite is moving, but it's moving so fast that you can't see it and it gets reset to it's original position.

Tell me if this helps.

#ifdef _DEBUG
FixBugs(All);
#endif
Ulnarian
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 1st May 2009 07:11
Fixed it

Turns out the problem was with my sprite creation.

I created my ball sprites with GIMP. I removed the background by using "Remove Alpha Color" which leaves everything but the ball in my image. Or so I thought, turns out the background is probably still there...just invisible.

Thus, instead of two small objects, I actually likely had two small objects smack in the middle of two, mostly invisible 1024x768 objects. Thus, the statement is always true and the object will never move

Login to post a reply

Server time is: 2024-09-30 23:22:53
Your offset time is: 2024-09-30 23:22:53