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 / DarkGDK Moving Sprite problem?

Author
Message
steakyfask
13
Years of Service
User Offline
Joined: 9th Jan 2011
Location:
Posted: 29th Aug 2011 04:34
Hi Im having problems getting an animation/Sprite to move across the screen.

I have created a Startup screen, which displays a picture, a few sprites some text and a sound.

I have created a class called Startup, which displays the start screen and initiates the game. Within this class I have created a member function to display an animation on my startup screen.

my problem is getting it to move across the screen.

I have been playing with my code for ages and can't get it right

dbMoveSprite() does not seem to work
I have tried using a for loop which increasses the Sprites position each loop, but only my final position gets displayed, I Played around using dbSync() which finaly showed my animation moving but my background screen flickers!?




This iss my Main.cpp








My startup screen gets displayed in Start.Play_low_budge();





The problem is in void Startup:layWb() Im using dbMoveSprite() but it dosent move? any help please?

Thanks.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Aug 2011 17:11
I don't see the PLAYER class, so I can't tell what's wrong with the movement.

The fastest code is the code never written.
steakyfask
13
Years of Service
User Offline
Joined: 9th Jan 2011
Location:
Posted: 29th Aug 2011 18:56
sorry, the way Ive coded it might be confussing, but the animation Im trying to get working is all inside my member function, Startup:layWb() which gets called from my member function Startup:lay_low_budge().
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Aug 2011 20:10

This will create the sprite each time you call it. I think this will fail just like trying to create an object when it already exist. Make another function that only does the loading:

and take those parts out of the PlayWB() function.

The fastest code is the code never written.
steakyfask
13
Years of Service
User Offline
Joined: 9th Jan 2011
Location:
Posted: 30th Aug 2011 02:25
Hi, I tried that but did not work I tried using a different picture, just creating a sprite and still didn't work.

I have noticed that if i use a for loop to move the sprite each time and use dbSync(); inside the loop, my sprite moves like i want it to but the rest of my sprites filcker on and off??

steakyfask
13
Years of Service
User Offline
Joined: 9th Jan 2011
Location:
Posted: 30th Aug 2011 02:43
Ah Thank you!! I got it working now!!

I was calling upon my LoadWB() function inside my GDKloop which I guess was creating a new sprite every loop.


Thanks again!

Login to post a reply

Server time is: 2024-10-02 19:23:30
Your offset time is: 2024-10-02 19:23:30