Hi guys/gals,
I'm trying to create a pseudo camera zoom in a bmx game I'm making at the moment. I have a number of objects at certain coords and myself, at certain coords always displayed at the centre of the screen. I want to change the "zoom" of the "camera" to achieve an effect similar to this:
The problem with this example is, if you move anywhere, the effect is broken somehow. Any chance anyone knows how to fix it?
I'm trying to create a pseudo camera zoom in a bmx game I'm making at the moment. I have a number of objects at certain coords and myself, at certain coords always displayed at the centre of the screen. I want to change the "zoom" of the "camera" to achieve an effect similar to this:
The problem with this example is, if you move anywhere, the effect is broken somehow. Any chance anyone knows how to fix it?
Global objList:TList=CreateList() Graphics 640,480,0,60 Global s#=1.0 For Local i=1 To 25 Local o:obj=New obj o.x=Rand(-GraphicsWidth(),GraphicsWidth()) o.y=Rand(-GraphicsHeight(),GraphicsHeight()) Next Global youX#,youY# While KeyHit(KEY_ESCAPE)=0 Cls If KeyDown(KEY_NUMADD) Then s:+0.1 If KeyDown(KEY_NUMSUBTRACT) Then s:-0.1 If s<0.1 Then s=0.1 If s>4 Then s=4 If KeyDown(KEY_UP) Then youY:-1*s If KeyDown(KEY_DOWN) Then youY:+1*s If KeyDown(KEY_LEFT) Then youX:-1*s If KeyDown(KEY_RIGHT) Then youX:+1*s updateObjs() SetColor 0,255,0 DrawRect (GraphicsWidth()/2)-3,(GraphicsHeight()/2)-3,7,7 SetColor 255,255,255;DrawText s,0,0 DrawText "Press +/- on the numpad to zoom. Cursors to move",0,10 Flip Wend End Type obj Field x,y Method New() ListAddLast(objList,Self); End Method Method update() Local dx=youX-GraphicsWidth()/2 Local dy=youY-GraphicsHeight()/2 SetScale 1,1 SetColor 255,0,0 DrawRect (x*s-3)-dx,(y*s-3)-dy,7,7 End Method End Type Function updateObjs() For Local i:obj=EachIn objList i.update() Next End Function