News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

syncing

Started by RaverDave, January 15, 2011, 09:30:03 PM

Previous topic - Next topic

RaverDave

PlayBASIC Code: [Select]
; PROJECT : playbitz
; AUTHOR : david wheeler
; CREATED : 16/01/2011
; EDITED : 16/01/2011
; ---------------------------------------------------------------------
OpenScreen 800,600,16,2

sw=GetScreenWidth()
sh=GetScreenHeight()

Setfps 60

;screenvsync on
xpos=0

makegfx()
repeat
cls 0
updateplayer()

Backdrop()


if esckey()
quit=true
endif
sync
until quit=true


Function BackDrop()
;LockBuffer
inkmode 1
Static baseangle#
col1=RGBFade($ff0000,SinNewValue(50,baseangle#,20))
col2=RGBFade($ffff00,CosNewValue(50,baseangle#,20))

col3=RGBFade($ff00f0,SinNewValue(50,baseangle#*2,20))
col4=RGBFade($1234,CosNewValue(50,baseangle#*2,20))
ShadeBox 0,0,GetScreenWidth(),GetScreenHeight(),col1,col2,col3,col4
baseangle#=Mod(baseangle#+1,360)
;UnLockBuffer
EndFunction

function makegfx()

CreateImage 20,16,32
RenderToImage 20
box 0,0,15,31,1

rendertoscreen
endfunction

function updateplayer()
ypos=mousey()
drawimage 20,xpos,ypos,0
sync
endfunction



ITrying to refamilairize myself with this playbasic, i have a flicker as you can see and dont know where i am going wrong! thanks for any help

kevin


Why are you calling SYNC twice ?

RaverDave

well.. if i take out a sync from updateplayer() i dont see the bat image!

kevin


of course not.. you're drawing the bat, then covering it with the shadebox.. 

RaverDave

hah! of course. I messed about so much i didnt notice! :P
I was using some other language recently where the sprite command kinda had drawing priority! bah!!