Flip screen woes

Blitz3D Forums/Blitz3D Beginners Area/Flip screen woes

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This is my main loop

Include "globals.bb"
Include "leveldata.bb"
Include "Movement.bb"
Include "graphics.bb"
Include "debug.bb"
Include "render.bb"
Include "framespeed.bb"

;---------------------------------------------------------------------
;---------------------------MAIN LOOP---------------------------------
;---------------------------------------------------------------------

While Not KeyHit(1)

framespeed() ;checks the frames per second (only for debug display, it doesn't limit or lock it)

keycheck() ;this is for playermovement

render() ; draws everything to the screen

updateplayerongrid() ;updates the array

Wend

End

;--------------------------------------------------------------------



This is the render loop:

Cls ; clear the screen

DrawImage (ibckgrnd, centerx+gridsize, centery+gridsize); draws the background

debug() ; adds any debug text displays

For b = 1 To 15 ; main render loop for drawing all the sprites
For a = 1 To 15

x = centerx+a*gridsize-(gridsize)
y = centery+b*gridsize-(gridsize)

;Text centerx+a*gridsize, centery+b*gridsize, ""+grid(a,b,1)
If grid(a,b,1) = 1 Then DrawImage (iblock, x, y)
If grid(a,b,1) = 2 Then DrawImage (dblock, (a*gridsize)+centerx-gridsize, (b*gridsize)+centery-gridsize)
Next

Next

DrawImage (iplayer, player1\X, player1\Y) ; and lastly the player!



Flip ; update the screen



The debug functionis just drawing some text:

Function debug()

Text 20, 50, grid((player1\gridx - 1), (player1\gridy-1),1)+" "+grid((player1\gridx), (player1\gridy-1),1)+" "+grid((player1\gridx + 1), (player1\gridy-1),1) ;debug
Text 20, 65, grid((player1\gridx - 1), (player1\gridy),1)+" "+grid((player1\gridx), (player1\gridy),1)+" "+grid((player1\gridx + 1), (player1\gridy),1);debug
Text 20, 80, grid((player1\gridx - 1), (player1\gridy+1),1)+" "+grid((player1\gridx), (player1\gridy+1),1)+" "+grid((player1\gridx + 1), (player1\gridy+1),1) ;debug

Text 0, 5, player1\gridxvalue+ " gridxvalue "+(player1\gridxvalue - spriteoffset)+" spriteoffset "+player1\x+ " "+fps+" fps "

End function