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 / Problem with dbMoveSprite

Author
Message
Erevion
15
Years of Service
User Offline
Joined: 10th Jul 2009
Location:
Posted: 5th Nov 2009 12:44
I use dbMoveSprite to move an array of sprites (bullets) using a loop:


But somehow, when the loop contains dbMoveSprite, it causes my player-sprite to get stuck at the X-coordinate 302.

Without dbMoveSprites the player moves fine.

I move the playering using:
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 6th Nov 2009 18:02
In your for loop you pass in 0 - 99 as bullets, but your player sprite IS number 1. So either omit 1 in your for loop or start at 2.

if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
Erevion
15
Years of Service
User Offline
Joined: 10th Jul 2009
Location:
Posted: 11th Nov 2009 08:52
I use (i+20) in the loops to make sure that it never gets close to 1, which is the ID of the player-sprite.

And just to check, I removed the entire function that was supposed to move the bullets and it worked like it should.

Then I added dbMoveSprite(20,10); and the player-sprite got stuck in the middle of the screen again.
Erevion
15
Years of Service
User Offline
Joined: 10th Jul 2009
Location:
Posted: 11th Nov 2009 09:06
I found out what was wrong myself (about 10min after posting xD).

If the sprite that was called to move in dbMoveSprite doesn't exist, it looks like it moves the first sprite it can find (in this case my player sprite). A dbSpriteExist check solved it.

Login to post a reply

Server time is: 2024-10-01 16:29:29
Your offset time is: 2024-10-01 16:29:29