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 / Randomly appearing images... need help

Author
Message
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 27th Jan 2009 02:54
In my game, while playing it occassionally an image (a random image, it's not always the same image) from my game will flicker in the top left corner.


Here's some background on how I handle images in my game:
First, I load all the images I'll be using, then I create a sprite for each of those images. The sprite created is positioned at (-10000,-10000), and I also hide the sprite so even if it was on screen, it wouldn't be visible.
During the game, to show sprites, I simply adjust the parent sprites' settings such as scale, diffuse, alpha, and angle; and then paste them using dbPasteSprite.


Here's some things to note about the images that are appearing and the sprites in my game:
I use solid white images and diffuse them to create different colored images. NONE of the pasted images are white and never can be white by the way I've coded them.
The images that are randomly appearing in the top left corner HAVE no alterations to them. As in, they are not offset, they are always solid white, they always have an alpha value of 255 (completely opaque), and they are not angled in any way and always point upward.


My question here is: How could these images get pasted to the screen? If it's a fault of my sprites, why are they not altered like the sprites are in my game?


The one and only,


Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 27th Jan 2009 14:14
I havnt done 2D for a while but I remember having the same problem,
I THINK that when you create a sprite it does draw it to screen once(flashes). I dont think I came up with a proper solution, but I did work around it somehow, I think I moved them offscreen as soon as they were created and then positioned them on screen where they were needed.
Sorry I couldn't be more help.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 27th Jan 2009 22:18
Yeah, I'm already positioning them offscreen when they get created.

The strangest part about these flashing images is that they don't look like sprites being used in my game, like I said. The sprites in my game are being angled and diffused and alpha faded all the time, but these never are.


Anyone else seen this before?


The one and only,


Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 28th Jan 2009 02:49
Quote: "I moved them offscreen as soon as they were created and then positioned them on screen where they were needed. "


Why not use the dbHideSprite() function instead?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 28th Jan 2009 05:40
Well, that still doesn't help my problem. Here's the code I use for setting up the sprites in my game.



NOTE: I never UNhide the sprites or even move them during the game. I only paste them to their appropriate locations on screen.


The one and only,


Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Jan 2009 13:22
I just looked back at one of my old projects, it seems that the first time you use dbSprite() on your sprite, it flashes the original sprite image (without off-set, scaling, diffuse etc..) on-screen.
Thats why I had to draw them off-screen first, hiding them doesn't seem to work.
You seem to be already doing this in your code, so it should be o.k, is it?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 29th Jan 2009 01:39 Edited at: 29th Jan 2009 01:41
Nope, they flash at random times during gameplay... and during that time I'm not using the 'dbSprite' command.

They're also images that aren't being manipulated or pasted... like I'll see the image for my title screen or gameover screen flash occassionally while I'm playing.

My friend has reported that he's never seen this happen when he plays it on his comp... so this makes it even more weird of a bug.


The one and only,


Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 29th Jan 2009 01:52
It could be that you're not getting rid of the sprites...?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 29th Jan 2009 06:26
Why would I get rid of them?

Like... why would take them out of memory and then put them back in when I can just leave them there?


The one and only,


Scottie Dog
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 29th Jan 2009 19:25
I remember when I wrote my first 2d game using DarkGDK I struggled very hard with sprites.
Unfortunately if you want to do things like Gamma/Transparency effects you have no choice.

A few simple checks then...

Are you allowing the sprites to update their own background, or does you background refresh every frame.
dbSetSprite can be used to turn off sprite refresh (and incidentally save you a little time if you dont need it)

Can remember off the top of my head, but which screen are you working on when you create your sprite.
If might be possible to use dbSetCurrentBitmap to something other than the visible screen to circumvent this issue.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Feb 2009 02:55
OK Plystyre - I HAVE seen something you mentioned above before and when I do see it it frustrates me to NO END!

I sometimes will have a program suddenly FLASH a different view then snap back for a single frame - and it might do it repeatively and seemingly at random times.

I THINK its rounding issues effecting the camera and the whole transform to eular stuff or something. The following little "Proof of concept" code for sparkys collision does it.



Login to post a reply

Server time is: 2024-09-30 17:30:48
Your offset time is: 2024-09-30 17:30:48