Sprite : How do I keep a constant background

BlitzMax Forums/BlitzMax Beginners Area/Sprite : How do I keep a constant background

DannyD(Posted 2005) [#1]
I have a sprite that works just fine. However the screen background is black while the sprite background is green.How do I change the entire screen to the color of the sprite's background ? Thanks in advance.

MY sprites with their green backgrounds ..


SoggyP(Posted 2005) [#2]
Hello.

SetMaskColor.

Goodbye.


ImaginaryHuman(Posted 2005) [#3]
Or, interpreting the question another way, use `SetClsColor` with the color of the sprite sheet, and then `Cls`.


Sledge(Posted 2005) [#4]
Kick Off was awful.


Sorry, knee-jerk reaction there.


DannyD(Posted 2005) [#5]
Hee-hee, kickoff was great :) Thanks for the replies.


DannyD(Posted 2005) [#6]
SetMaskColor 0,160,0 makes the green transparent which isn't what I wanted to do.What I want to do is set the background in general outside the sprites to 0,160,0.


setclscolor 0,160,0 changes the entire screen to the correct green color but some of the sprite is missing :(

My code
Graphics 1280,854 'set gfx mode
Global FrameTimer = MilliSecs()
Global frame:Int = 0
Global myimage:TImage = LoadAnimImage("ko2.png",16,16,0,5)


Repeat

Cls

DrawImage myimage,50,50,frame

If MilliSecs() > FrameTimer + 100
FrameTimer = MilliSecs()
frame:+1
EndIf

If frame > 4 Then frame = 0

Flip
FlushMem

Until KeyHit(KEY_ESCAPE)


DannyD(Posted 2005) [#7]
Using both setmaskcolor and setclscolor is the solution


Graphics 1280,854 'set gfx mode
Global FrameTimer = MilliSecs()
Global frame:Int = 0
SetMaskColor 0,160,0
Global myimage:TImage = LoadAnimImage("ko2.png",16,16,0,5)
SetClsColor 0,160,0

Repeat

Cls

DrawImage myimage,50,50,frame

If MilliSecs() > FrameTimer + 100
FrameTimer = MilliSecs()
frame:+1
EndIf

If frame > 4 Then frame = 0

Flip
FlushMem

Until KeyHit(KEY_ESCAPE)


Thanks