SetMaskColor problem

BlitzMax Forums/BlitzMax Beginners Area/SetMaskColor problem

JohnK(Posted 2007) [#1]
Please Help me! There is my code
 		AutoMidHandle True 
	     Type player
	               	   Field x#,y#,xspd#,yspd#,friction#=0.004,acceleration#=0.008,spdvector#,direction#,maxspd#=0.6
				   	   Field turnspd#,turnaccel#=0.1,turnmax#=0.7,turnfriction#=0.04, life
					    Field entity=LoadImage("player.png")
					Method create()
						x=400 ; y=300 ' создание плеера в центре экрана
					End Method
					
		 Method update()
						If KeyDown(Key_up)
							 xspd:+Cos(direction)*acceleration	 
							 yspd:+Sin(direction)*acceleration
						End If
						If KeyDown(Key_down)
							 xspd:-Cos(direction)*acceleration
							 yspd:-Sin(direction)*acceleration
						End If
						spdvector=Sqr(xspd*xspd+yspd*yspd) 'вектор скорости
									If spdvector > 0
										xspd:-(xspd/spdvector)*friction
										yspd:-(yspd/spdvector)*friction
									End If
									
									If spdvector>maxspd
										xspd:+(xspd/spdvector)*(maxspd-spdvector)
										yspd:+(yspd/spdvector)*(maxspd-spdvector)
									End If
							If spdvector<0.2		  ' условие "скольжения"
								turnfriction=10
							Else
								turnfriction=0.04
						    End If
							      	x:+xspd
									y:+yspd
						DrawText (spdvector,15,15)
						
						If KeyDown(KEY_RIGHT) turnspd:+turnaccel
						If KeyDown(KEY_LEFT) turnspd:-turnaccel
						
		  If turnspd>turnmax turnspd=turnmax
		  If turnspd<-turnmax turnspd=-turnmax	
		  direction:+turnspd
		  If direction>360 direction:-360
		  If direction<0 direction:+360				
	      If turnspd>turnfriction Then turnspd:-turnfriction
		  If turnspd<-turnfriction Then turnspd:+turnfriction
	      If turnspd < turnfriction And turnspd > -turnfriction Then turnspd=0		
							SetScale 0.3,0.3
							SetRotation direction
							DrawImage entity,x,y
							SetRotation 0
							SetScale 1,1
	 End Method
				  
		EndType 
		
		Graphics 800,600,32
		water=LoadAnimImage("wateranim.jpg",124,124,0,23)
		AutoImageFlags (MASKEDIMAGE)
		SetMaskColor (0,0,0)
		player1:player=New player
		player1.create()
		Repeat
		Cls
		frame=MilliSecs()/92 Mod 23
		TileImage (water,0,0,frame)
		player1.update()
		Flip
		Until KeyHit(Key_Escape)


Who know, why setmaskcolor don't work?


Amon(Posted 2007) [#2]
Setmaskcolor must come before loadimage. :) I think anyway.


JazzieB(Posted 2007) [#3]
I'm pretty sure you have to set the mask colour before you load your image. Same with the AutoImageFlags.


JohnK(Posted 2007) [#4]
thanks for advice. But image still have black edge's =(


H&K(Posted 2007) [#5]
Probably the Edges are "Nearly" black


JohnK(Posted 2007) [#6]
no...edges fully black (i check it by Paint =) )

PS Does SetScale aspect on TileImage?


JazzieB(Posted 2007) [#7]
If the rest of the mask is now not displayed, then the edges of your image cannot be black, otherwise you wouldn't be able to see them. If you can, post a link to your image and we'll take a look at it.

As for SetScale affecting TileImage, I'm afraid it does not. SetRotation doesn't affect TileImage either.


JohnK(Posted 2007) [#8]
JazzieB, thanks! I has solved my problem.