Anyone know hot to resolve this?(2d coordinates re

Blitz3D Forums/Blitz3D Beginners Area/Anyone know hot to resolve this?(2d coordinates re

That's what happens when you change values at random in order to solve a bug.

Type oggetto
Field posx
Field posy
End Type


Graphics 640,480,32,1
SetBuffer BackBuffer()
Global terreno=LoadImage("c:\jacob\blitz\shooter test\floor104.bmp") ;a simple texture of 256*256 
Global enemy=LoadImage("c:\jacob\blitz\5inarowicon.bmp")
MidHandle enemy
Global screenx=0
Global screeny=0
Global posx=200
Global posy=200
Global offset=1
While Not KeyHit(1)=True
Cls
x=MouseX()
y=MouseY()
mouse1=MouseHit(1)
MapTiles()
;Origin 0,0
If KeyDown(200)=True Then screeny=screeny-1
If KeyDown(208)=True Then screeny=screeny+1
If KeyDown(205)=True Then screenx=screenx+1
If KeyDown(203)=True Then screenx=screenx-1

If KeyHit(57)=True Then screenx=0:screeny=0	;if i hit the spacebar

Rect MouseX(),MouseY(),9,9
;Origin screenx,screeny



If mouse1=True
create_enemy(MouseX()+screenx,MouseY()+screeny)
EndIf






draw_enemy()
Origin 0,0

Color 255,255,255
Text 50,400,("Mouse X world coords:"+(MouseX()+screenx))
Text 50,410,("Mouse Y world coords:"+(MouseY()+screeny))
Color 255,0,0
Text 50,430,("X offset world coords:"+screenx)
Text 50,440,("Y offset world coords:"+screeny)
Color 0,0,255
Text 50,450,("X mouse coords:"+MouseX())
Text 50,460,("Y mouse coords:"+MouseY())



;If MouseHit(1)=True
	



Flip
Wend

Function MapTiles()
tilex=0
tiley=0
For tiley=0 To 2560 Step 256
For tilex=0 To 640 Step 256
DrawBlock terreno,tilex-screenx,tiley-screeny
Next
Next
End Function


Function draw_enemy1()
DrawImage enemy,posx,posy
posx=posx
posy=posy+offset
If posy =< 0 Then offset=1
If posy => 100 Then offset=-1
End Function



Function create_enemy(x,y)
a.oggetto=New oggetto
a\posx=x
a\posy=y
End Function

Function draw_enemy()
For a.oggetto = Each oggetto
DrawImage enemy,a\posx-screenx,a\posy-screeny
Next
End Function