Oke now its enough, I see some example on blitzcoder and blitzbasic , I asked here but I still don't have a super basic example :( :( : (
I have made an easy picture so its easy to see what I mean.
[img
/img]
I only want a simple ImagesCollide() example with a moving player that's stop's moving when hit the rock.
As you can see on the picture I have that but when people press for example up and right then he goes through the rock.
And sometimes the players is acting strang because I use this:
I have made an easy picture so its easy to see what I mean.
[img
/img]I only want a simple ImagesCollide() example with a moving player that's stop's moving when hit the rock.
As you can see on the picture I have that but when people press for example up and right then he goes through the rock.
And sometimes the players is acting strang because I use this:
If coll = 208 y%=y%-1 EndIf ....
Graphics 800,600,32,2 SetBuffer BackBuffer() Global x% = 400 Global y% = 400 Global a% = 0 Global coll,coll2 Global sprite1,berg1 ;load tiles backgrd = LoadImage("tiles/grass1.png") berg1 = LoadImage("tiles/berg1.png") ;load sprite sprite1 = LoadAnimImage("sprites/sprite1.png",24,32,0,12) MaskImage sprite1,32,156,0 While Not KeyHit(1) Cls TileBlock backgrd DrawImage berg1,500,500 If MilliSecs() > tmrSprite + 200 Then tmrSprite =MilliSecs() sprite1_frm=(sprite1_frm+1) Mod 3 End If DrawImage sprite1,0,0,sprite1_frm DrawImage sprite1,30,0,(sprite1_frm+3) DrawImage sprite1,60,0,(sprite1_frm+6) DrawImage sprite1,90,0,(sprite1_frm+9) Rect 30,30,660,560,0 ;move If KeyDown(205) Then ;right x%=x%+1 a%=3 coll=205 If KeyDown(208) Or KeyDown(200) Then coll2 = True EndIf EndIf If KeyDown(203) Then ;left x%=x%-1 a%=9 coll=203 If KeyDown(208) Or KeyDown(200) Then coll2 = True EndIf EndIf If KeyDown(200) Then ;up y%=y%-1 a%=0 coll=200 If KeyDown(205) Or KeyDown(203) Then coll2 = True EndIf EndIf If KeyDown(208) Then ;down y%=y%+1 a%=6 coll=208 If KeyDown(205) Or KeyDown(203) Then coll2 = True EndIf EndIf DrawImage sprite1,x%,y%,(sprite1_frm+a%) a% = "" ;idle If CheckCollide() = True If coll2 = False If coll = 208 y%=y%-1 EndIf If coll = 200 y%=y%+1 EndIf If coll = 203 x%=x%+1 EndIf If coll = 205 x%=x%-1 EndIf EndIf EndIf ;debug Text 50,50,"x:"+x% Text 50,60,"y:"+y% Text 50,70,"coll:"+coll Text 50,80,"coll2:"+coll2 Flip Wend End Function CheckCollide() If ImagesCollide(sprite1,x%,y%,a%,berg1,500,500,0) Then Return True Else coll = 0 coll2= False Return False EndIf End Function