I'm working on a driving game, and every time I run the program the matrix starts flickering.
I searched the forum and found this thread:
http://forum.thegamecreators.com/?m=forum_view&t=16707&b=3
but none of that seems relevent to my program, except for maybe the clearing the screen part. I've tried using the CLS command at various areas in the code, but it didnt help at all.
Here is my code so far:
Sync On
Sync Rate 30
Backdrop on
Set Camera range 1,5000
Fog on
Fog Distance 4000
Fog Color RGB(128,128,128)
Color backdrop RGB(128,128,128)
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill Matrix 1,0,1
Rem Make Player Sphere
Make Object Box 10,10,10,20
YRotate object 10,180
Fix object pivot 10
Position object 10,100,0,100
Rem Randomize the matrix
randomize matrix 1,125
Rem Values
traction#=0.95
radius#=100.5
pi#=3.141
Rem Main loop
Do
Rem Print X,Y, and Z information to the Screen
Set Cursor 0,0
Print newposx#
Print posy#
Print newposz#
Print screen fps()
Print speed#
Rem Store Object angle
AngleY# = object angle Y(10)
Rem Control input for camera
if upkey()=1 and speed#<15 then inc speed#
if downkey()=1 then speed#=speed#*0.85
newposx#=newxvalue(posx#,Angley#,speed#)
newposz#=newzvalue(posz#,Angley#,speed#)
if leftkey()=1
yrotate object 10,wrapvalue(Angley#-(180*speed#/(pi#*radius#)))
endif
if rightkey()=1
yrotate object 10,wrapvalue(Angley#+(180*speed#/(pi#*radius#)))
endif
Rem Get ground height, then position object 12.5 units above the ground
posx# = object position x(10)
posz# = object position z(10)
posy# = Get ground height(1,newposx#,newposz#)
Position object 10,newposx#,posy#+20,newposz#
CameraX#= newxvalue(newposx#,AngleY#-180,100)
CameraZ#= newzvalue(newposz#,AngleY#-180,100)
Rem Get Ground Height Below the camera, and make camera 50 units higher
CameraY#= Get ground height(1,CameraX#,CameraZ#)
Position Camera CameraX#,posy#+50,CameraZ#
Point Camera newposx#,posy#+25,newposz#
Rem Refresh Screen
Sync
Loop