Sprites

BlitzMax Forums/BlitzMax Beginners Area/Sprites

foosh(Posted 2007) [#1]
So I've created a sprite with 4 frames (2x2), and when I run the game, I can move that player and it looks good. The image is black and white. So I added a white background to the game, and all of a sudden, my sprite disappears, as if it's transparent. But the player is definitely black, and ive tried different colors and still see that the player is considered transparent. Suggestions?


GfK(Posted 2007) [#2]
SetMaskColor()?


foosh(Posted 2007) [#3]
I've set mask color to both 0,0,0 and 255,255,255 and neither works. 0,0,0 just makes it stay the same, 255,255,255 turns the whole screen black. When I set MaskColor for the player as 0,0,0 and the background as 255,255,255, I only get a 64x64 viewing box of the map...


GfK(Posted 2007) [#4]
Um... are you drawing the sprite first, then the background? Draw the background first.


foosh(Posted 2007) [#5]
So I drew the background firsrt, and still mask does nothing. Now I just have a lil white 64x64 square movin around.

SetMaskColor 255,255,255
Local Background:TBackground = TBackground.Create("background.png",0,0)
SetMaskColor 0,0,0
Local Player:THero = THero.Create("guywalking.png",15,142)

That's the closest I got to what I wanted, but still, that creates a 64x64 square of vision around my player, so the rest of the map is invisible.

Sorry if this is some reall basic error I'm making, and thank you so much for your help.


foosh(Posted 2007) [#6]
SOLVED! Updated the code... weird that it wasnt working before.

So I've tried setting mask colors and everything and nothing seems to work. Any suggestions? This is my source for the graphics and main loop...

'-------------------------------------------------------------------GAME SETUP

Graphics 510,300,0
Local Background:TBackground = TBackground.Create("background.png",0,0)

SetMaskColor 255,255,255
Local Player:THero = THero.Create("guywalking.png",15,142)

'--------------------------------------------------------------------MAIN LOOP

Repeat
	Cls
	Background.DrawSelf()
	Player.UpdateState()
	Player.DrawSelf()
	Flip
Until KeyDown(KEY_ESCAPE) Or AppTerminate()
End



foosh(Posted 2007) [#7]
I actually think I solved it... thanks!


Czar Flavius(Posted 2007) [#8]
Are you flagging it as MASKEDIMAGE when loading the image file?