Loop within a function? Show me how

Blitz3D Forums/Blitz3D Beginners Area/Loop within a function? Show me how

I made a program with several functions in it. Each function is basically a SEPERATE screen showing JPG images.


The problem is I need a LOOP within each function and when I do try to make a loop, it NEVER shows the images that are suppose to be shown. Instead the program goes to the function and Freezes up. for example


;initiate settings and stuff

;MAIN GAME LOOP

while not keydown(1)

; just 1 function



if such and such

thisscreen()

endif


wend






function thisscreen()

while not keydown(1); my loop that never works in the function

drawimage 1,20,20

if such and such
do this
endif


wend

end function



;and this is where the program freezes up. How can I
;correctly add a CONDITIONAL loop to a FUNCTION?

are you still using cls and flip in the second loop? sometimes not flipping the buffers causes my computer to freeze.

drawimage 1,20,20
Are you even allowed to use numbers as variable names?

sometimes not flipping the buffers causes my computer to freeze.
This will never cause your computer to freeze.

By not flipping the buffers, you never see anything that's been drawn to the backbuffer. But the program *is* still running.

Yeah, 1 probably isnt a valid image handle, as it's a memory pointer, and 1 is awfully low.

GFK

IDK why it causes my comp to freeze maybe it is something about vista. It doesn't happen on my other comp.

put a 'flip' before 'wend'

Thanks I got it to work.