Well I got really bored with Paint Pot drawing the pictures to colour so I thought I would have a break and see if I could flesh out a Pole Position style Pseudo 3D track.
The code is below and is only the start and not animated yet and no corners etc but all you can see is the road being copied to the screen with Memblocks.
Pictures of the track and background are here too.
Don't get too caught up with the code at this stage as it is really rough and was the first 20 minutes of it!
screenWidth = 640
screenHeight = 480
SetSyncRate(0,0)
SetWindowTitle( "Pseudo 3D Track" )
SetWindowSize( screenWidth, screenHeight, 0 )
SetVirtualResolution( screenWidth, screenHeight )
SetOrientationAllowed( 1, 1, 1, 1 )
road = LoadImage("/media/road.png")
background = LoadImage("/media/background.png")
roadImage = CreateMemblockFromImage (road)
mainBackImage = CreateMemblockFromImage (background)
bufferImage = CreateMemblockFromImage (background)
backImageSize = GetMemblockSize (mainBackImage)
mainImageScreen = CreateImageFromMemblock (bufferImage)
mainSpriteScreen = CreateSprite (mainImageScreen)
SetSpritePosition (mainSpriteScreen, 0, 0)
roadWidth = 1000
xRoadPos = ((roadWidth/2)-(screenWidth/2))+0 // Change the 0 for X position of road
yBufferPos = 370
yRoadPosDark = 0
yRoadPosLight = 110
roadNum = 1
if roadNum = 1
roadNum = yRoadPosDark
else
roadNum = yRoadPosLight
endif
do
// Copy the main background image to the buffer image memblock (eg clear screen)
CopyMemblock( mainBackImage, bufferImage, 12, 12, backImageSize - 12 )
// Draw a road slice to the image buffer memblock
for i = 0 to 109
offsetRoad = 12 + (( xRoadPos + ((roadNum+i) * roadWidth )) * 4 )
offsetBuffer = 12 + (( (yBufferPos+i) * screenWidth ) * 4 )
CopyMemblock( roadImage, bufferImage, offsetRoad, offsetBuffer, (screenWidth*4))
next i
// Draws the buffer memblock to the main sprite screen to make visible
DeleteImage(mainImageScreen)
mainImageScreen = CreateImageFromMemblock( bufferImage )
SetSpriteImage ( mainSpriteScreen, mainImageScreen )
Print( ScreenFPS() )
Sync()
loop
I got to this stage of just copying the lines of the track before I was going to animate the road, I was going to use a Y offset for the road animation and copy sections of the track from the light and dark parts to create the effect but then when I ran the program, although I got 90 fps on the PC I only got 3.5 fps on the tablet
I was a bit surprised at this as I purposely chose a low res image to test it and only copying 110 lines in the loop at a time.
I think I will have to think of another way of doing this instead of memblocks maybe, unless anyone can see something obvious I am having a senior moment with my brain going dead drawing these Paint Pot pictures lol
Could be quite a good little demo concept if get it going
Image for road:
Image for background:
The Amiga and Amos were great!
Download my game - Paint Pot from Amazon and Google here - http://leap.my-free.website/