Anyone tell me why the below does not detect the collision between the man and the bat?
;========================================================================================== ;#Region setup ;create globals for video display Global gfx_x=640 Global gfx_y=480 Global gfx_colour_depth=16 ;Global man_walk ;========================================================================================== ;create window Graphics gfx_x,gfx_y,gfx_colour_depth,0 ;screen =640,480,16 bit colour AppTitle="Stickman" SetBuffer BackBuffer() ;SeedRnd MilliSecs();get better random result ;HidePointer ;hide the mouse arrow ;#End Region ;========================================================================================== ;variables etc ;#Region variables etc Global manfly ;rocket on? 1 yes 0 no Global manflyframechange=0 ;change frame count depending on 1 flying or 0 walking Global gfx_manwalk=LoadAnimImage("gfx\gfx_manwalk.bmp" ,80,80,0,13) Global gfx_manfly=LoadAnimImage("gfx\gfx_manfly.bmp",80,80,0,5) Global gfx_bat=LoadAnimImage("gfx\gfx_bat.bmp",84,65,0,4) Global gfx_background=LoadImage("gfx\gfx_backdrop.bmp") MaskImage gfx_manwalk,255,0,255 MaskImage gfx_manfly,255,0,255 MaskImage gfx_bat,255,0,255 ;#End Region ;========================================================================================== ;create types Type manwalk Field x,y,frame,gfx End Type Type bat Field x,y,frame,gfx,up,left End Type ;========================================================================================== ;create objects from types; ;#Region type objects Global man.manwalk=New manwalk man\frame =6 man\x=160 man\y=240 man\gfx=gfx_manwalk Global bat1.bat=New bat bat1\frame=0 bat1\x=80 bat1\y=160 bat1\gfx=gfx_bat bat1\Left =0 bat1\up =0 ;#End Region ;========================================================================================== ;main loop timer=CreateTimer (25) While Not KeyHit(1) draw_objects move_man move_bat check_collisions Gosub debug WaitTimer timer ;WaitMouse Wend End ;========================================================================================== ;functions Function move_man() ;movement Local fr fr=man\frame If KeyDown(203) Then ;move left man\x=man\x-8 ;keep within frame range If manfly=0 Then ;walking man\gfx =gfx_manwalk fr=fr-1 If fr<0 Then fr=fr+5 ;loop the frame Else ;flying man\gfx=gfx_manfly fr=fr-1 If fr<0 Then fr=0 End If ElseIf KeyDown(205) Then ;move right man\x=man\x+8 ;keep within frame range If manfly=0 Then ;walking man\gfx =gfx_manwalk fr=fr+1 If fr>12 Then fr=fr-5 Else ;flying man\gfx=gfx_manfly fr=fr+1 If fr>4 Then fr=4 End If ElseIf KeyDown(200) Then ;move up manfly=1 ;flying man\y=man\y-8 ;move 8pixels up man\gfx=gfx_manfly ;flying pic If manflyframechange=0 Then ;when man flys and is using old framecount for walking (0-12) manflyframechange=1 ;change the frame count for man flying (0-5) Select True Case fr >= 0 And fr<= 4 fr=0 ;left Case fr=5 fr=1 ;left Case fr=6 fr=2 ;facing you Case fr=7 fr=3 ;right Case fr=>8 And fr<=12 fr=4 ;right End Select End If ElseIf manfly=1 ;bring man back to earth! man\y=man\y+16 If man\y >240 Then ;when man hits ground change graphic and reset flags man\y=240 : manfly=0 : man\gfx=gfx_manwalk : manflyframechange=0 If fr>=3 Then fr=8 ;if frame is manflying right then change to man walking right End If End If ;keep man on screen If man\x<0 Then man\x=0 If man\x >gfx_x-80 Then man\x=gfx_x-80 If man\y<0 Then man\y=0 man\frame =fr ;change frame of man depending on walking or flying End Function Function move_bat() Local fr=bat1\frame If bat1\up =0 Then ;moving down fr=fr+1 bat1\y=bat1\y+2 If fr=>3 Then fr=0 Else fr=fr-1 ;moving up bat1\y=bat1\y-2 If fr<=0 Then fr=3 End If If bat1\y>240 Then bat1\y=240: bat1\up=1 ;at bottom of screen so move bat up End If If bat1\y<160 Then bat1\y=160: bat1\up=0 ;at top of screen so move bat down End If bat1\frame=fr End Function Function draw_objects() Cls DrawImage gfx_background,0,0 DrawImage man\gfx,man\x,man\y,man\frame ;Draw our image DrawImage bat1\gfx,bat1\x,bat1\y,bat1\frame End Function Function check_collisions() a= ImagesCollide (man\gfx ,man\x,man\y,0,bat1\gfx,bat1\y,bat1\x,0) Text(6,380,a) End Function ;debug ;#Region debug .debug Text(6,360,"man_x:"+man\x+" man_y:"+man\y+" man:"+man\frame+" fly:"+manfly +" frchange:"+manflyframechange ) Text(6,370,"bat1_x:"+bat1\x+" bat_y"+bat1\y+" batfr:"+bat1\frame ) Flip Return ;#End Region