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.

DarkBASIC Professional Discussion / Sprite leaves a trail behind it as it moves, why?

Author
Message
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Mar 2003 00:19
As I move my sprite across the screen it leaves a trail behind, why?

I can post the code here, but how do I get the image for the sprite here?



my first post, I hope the code worked...

Where can I post my "Glider-Left-20.bmp" file for this code sample?
(It is a small 20x20 pixel image,and I don't have a web site yet)

Thanks,
BillR
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 20th Mar 2003 00:30
Try clearing the screen in the FOR/NEXT loop

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
ToXic
23
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Australia
Posted: 20th Mar 2003 00:37
It has something to do with the set sprite command, remove it and it will work as it should.

ToXic.
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 20th Mar 2003 00:46
I tried this code and it left no trail. My sprite image did not push the boundaries of the image width so I used step -10 to simulate the effect, and still I left no trail - other than the CRT (monitor's tube) adjusting slowly to the change in contrast.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 20th Mar 2003 01:29
turn your backdrop back on using
BACKDROP ON
i think that should help!!!!

I have a word of advice...
..don't piss on an electric fence!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Mar 2003 01:31
Thanks MrTAToad,

cls works for my simple example, but I don't want to redraw the screen for my retro game entry each time through the main loop...

Upon closer checking, the sprite has colored pixels where my image doesn't, I wonder if the image is wrapping to the right side of the sprite somehow.
I will try to show with ascii chars..

my image:
--------
* <-
* <-
* <-leaving black at the right side of my image for the sprite should
* <-erase any colored pixel on screen as I move my sprite to the left
* <-
--------

sprite on screen:
--------
*
*
* *<---an extra pixel at the right side of the sprite shows up on screen
* and leaves a trail as the sprite moves left.
* I don't know how to stop this since my image doesn't have this pixel
-------- turned on (it's black)

If I can't post my small .bmp file anywhere, I will email it to anyone that would like to take a look at it.

Thanks,
BillR.

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Mar 2003 01:32
wow,

my ascii example got all screwed up when I posted it, sorry

Richard Davey
Retired Moderator
24
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 20th Mar 2003 02:19
BillR - look at the help file for "set sprite", you'll notice the 2nd parameter is: If the backsave state is set to zero, the sprite will not restore its background and leave a trail as it moves.

Also, put an extra 1 after the load image command to disable mipmapping.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 20th Mar 2003 09:36
Yeah soon as I saw the new description I saw it...

load image "Glider-Left-20.bmp",1,1


As a test try changing your background colour to white, you will see lots of extra dots around the edge of the sprites but putting an extra ,1 on the end of the load image will cure that.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Mar 2003 11:45
Rich - I new about the set sprite command, the 2nd param is too costly in term of frame rate, so I was handling the screen restore myself.

What was causing the problem was the mipmapping on the sprite. I didn't know about the ,1 for mipmapping on the load image command, using it solved my problem....Thanks

And thanks everyone else, I tried all your suggestions, the load image mipmapping fix was the answer for my retro game...thanks all.

BillR

Login to post a reply

Server time is: 2026-07-10 17:17:48
Your offset time is: 2026-07-10 17:17:48