Sprites
BlitzMax Forums/BlitzMax Beginners Area/Sprites
| ||
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? |
| ||
SetMaskColor()? |
| ||
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... |
| ||
Um... are you drawing the sprite first, then the background? Draw the background first. |
| ||
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. |
| ||
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 |
| ||
I actually think I solved it... thanks! |
| ||
Are you flagging it as MASKEDIMAGE when loading the image file? |