Hi guys!
I have seen a nice example of a Mario Kart like game using Monkey, and I'm trying to port it to Pascal using the ZenGL game Engine.
Well... here is the original result!
You can test this demo (http://www.monkeycoder.co.nz/Communi...1083&app_id=83) and download it's monkey source code here (http://earok.net/game/earoks-monkey-demos)
But, here is my ZenGL Version!
For sure, something is wrong with my version!
Attached there is the demo and the binaries of my version.
I think something is wrong with my DrawMode7 function (And I really don't understand how it works, and I would love to understand it!). =P
Original Code (Monkey Code) :
Code:
DrawImage ImgSky,0,0
For Local a = 0 to YLines-1
'Detect the X and Y location in the 3D world where the ray hit
Local XHit:Float = CameraX + (cosine*VDist[a])
Local YHit:Float = CameraY + (sine*VDist[a])
'Draw only this single line
SetScissor(0,240+a,XRes,1)
'Position, scale and rotate the image to draw on screen
ImgTrack.SetHandle(XHit,YHit)
DrawImage ImgTrack,320,240+a,-(CameraDir-90),VScale[a],VScale[a]
Next
SetScissor(0,0,XRes,YRes)
Well... To help :
Method SetHandle( x#, y# ) - Sets the image offset handle for this image. The handle is a 2D offset subtracted from the x,y coordinates of the image when it is drawn.
Function DrawImage( image:Image, x#, y#, rotation#, scaleX#, scaleY#, frame=0 )
My Code :
Code:
asprite2d_Draw(texBack, 0, 0, texBack.Width, texBack.Height, 0, 1);
For a := 0 to YLines - 1 do
begin
// Detect the X and Y location in the 3D world where the ray hit
XHit := CameraX + (cosine * VDist[a]);
YHit := CameraY + (sine * VDist[a]);
// Draw only this single line
scissor_Begin(0, 240 + a, XRes, 1);
// 'Position, scale and rotate the image to draw on screen
fx2d_SetRotatingPivot(XHit, YHit);
fx2d_SetScale(VScale[a], VScale[a]);
asprite2d_Draw(texTrack, 320, 240 + a, texTrack.Width, texTrack.Height, -(CameraDir - 90), 1, 255, FX_BLEND or FX2D_RPIVOT or FX2D_SCALE);
scissor_End;
end;
Some of you guys have any idea of what I'm doing wrong and how can I fix it?
Thanks!
Bookmarks