Seems that when writing collision layers, the screen origin (as set with SetOrigin) is not taken into consideration as I thought it would/should be.
Run the code below. The collision is set up at the same coordinates as the white square, but is actually detected at the coordinates of the grey square.
Graphics 800,600
SetOrigin 100,100
CollideRect 100,100,50,50,0,1
While Not KeyDown(key_escape)
Cls
SetColor 50,50,50
DrawRect 0,0,50,50'draw a grey square where the collision is being detected (wrong!)
If CollideRect(MouseX(),MouseY(),2,2,1,0)
SetColor 255,0,0
Else
SetColor 255,255,255
EndIf
DrawRect 100,100,50,50'collision should be detected here
Flip
Wend
Is this expected behaviour? It seems wrong to me.
[edit] Maybe this can be ignored - it seems that Mousex() and Mousey() are oblivious to the origin position if its anywhere other than 0,0... I think that's whats causing the problem...
|