Oval center keeps changing help

Blitz3D Forums/Blitz3D Beginners Area/Oval center keeps changing help

lonewolf22(Posted 2014) [#1]
Help me!Okay, I wrote a simple code.See in my code when user presses or holds the mouse button(left button) the oval should increase upto a limit and it does that and after the user releases the left mouse button it come's back to its original size.All is working.But
when the user holds the mouse the ovals center is changed and dnt want that.I want it to be in the same center.

Here is the code.Please run the code then you will understand what i am trying to say.......

---------CODE----------------------------------

Global x#=1.0,y#=1.0,count=30

Graphics3D 640,480,32,0
SetBuffer BackBuffer()

cam=CreateCamera()
PositionEntity cam,0,0,-10

cone=CreateCone()
PositionEntity cone,0,0,0


While Not KeyHit(1)

If MouseDown(1)
x#=x#+1
y#=y#+1

Else
x#=x#-0.1
y#=y#-0.1
End If


If x#>4.0 And y#>4.0
x#=4.0
y#=4.0
End If
If x#<1.0 And y#<1.0
x#=1.0
y#=1.0
End If

If count<=0
x#=1.0
y#=1.0
End If



RenderWorld
Oval 320,240,10*x,10*y,0
If MouseDown(1)
If count>0 And count<=30
Rect 320+Rand(x#*10),240+Rand(y#*10-10),5,5,1
Delay 50
count=count-1
End If
End If
Text 400,400,"Ammo:"+count,True,False
Flip

Wend


JBR(Posted 2014) [#2]
The oval command is top left to bottom right.

It is not really centred.

So you have to move the first 2 parameters as well as the width/depth to keep the same centre.

Jim