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 / Moving background, noob question

Author
Message
Erevion
15
Years of Service
User Offline
Joined: 10th Jul 2009
Location:
Posted: 10th Jul 2009 11:49
I'm using the darkGDK in c++ and is trying to get the background to move.



The dbSprite won't use the new values of moveX to change the position of the sprites.

If I change the initial value they will though.

I might be doing it all wrong, so any help is appreciated.
logicandchaos
15
Years of Service
User Offline
Joined: 22nd Sep 2009
Location:
Posted: 5th Nov 2009 01:19
i use the dbOffsetSprite function to move the backgrounds of my games
void dbOffsetSprite(int iSprite,int iX,int iY)
you can use it like this:
dbOffsetSprite(spriteID,moveX,moveY);

logicandchaos
logicandchaos
15
Years of Service
User Offline
Joined: 22nd Sep 2009
Location:
Posted: 5th Nov 2009 01:26
i think real problem is:
moveX = moveX + (dbRightKey() - dbLeftKey());
moveY = moveY + (dbDownKey() - dbUpKey());
you should do something like:
if(dbUpKey())
moveY--;
else if(dbDownKey())
moveY++;
else if(dbLeftKey())
moveX--;
else if(dbRightKey())
moveX++;

logicandchaos

Login to post a reply

Server time is: 2024-10-01 05:54:06
Your offset time is: 2024-10-01 05:54:06