Hi there,
I started using Dark Basic Pro around a week ago as a part of the course i am on at the moment.
In my free time ive been looking at multiple tutorials on how to create certain aspects of games such as 3d environments and collision detection and stuff.
There is one thing i would be 1 area i would like to find i write up about which is basically a game where you have to look for items and when you collect say 10 of said item then its a "congrats you won" type thing.
But i honestly cannot find resources that help me. Because i normally impliment the code then look at each line to see what it does.
If anyone can help me i would really appreshiate it, then i can finish off my work really quickly
Heres what i got so far
Sync On
Sync Rate 30
` the 2nd two numbers are X and Z dimentions
Make matrix 1,2000,2000,20,20
Load image "cottag02.bmp",1
LOAD MUSIC "music.wav", 1
`Load the the music file
PLAY MUSIC 1
LOOP MUSIC 1
`play the music clip and loop it
Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
`Make the player
Load image "JAKEX.bmp",2
Make object cube 10,25
Texture object 10,2
position object 10,100,0,100
rem Randomize the matrix
`randomize matrix 1,125
For x = 1 to 9
Make object cube x,300
Position object x,Rnd(2000),0,Rnd(2000)
Set object collision to boxes x
Texture object x,1
Next x
` Main loop
Do
set cursor 0,0
print screen fps()
Rem Store Object angle
AngleY# = object angle Y(10)
Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 10,10
Endif
Endif
` Adding the back button to make the cube reverse
If keystate(208)=1
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 10,-10
Endif
Endif
`Collision detection
If Object collision(10,0)>0
Position object 10,X#,0,Z#
Endif
If Leftkey()=1 then Yrotate object 10,Wrapvalue(AngleY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(AngleY#+5)
X# = Object position x(10)
Z# = Object position z(10)
Y# = Get Ground Height(1,X#,Z#)
Position object 10,X#,Y#+12.5,Z#
CameraZ# = Newzvalue(Z#,AngleY#-180,100)
CameraX# = Newxvalue(X#,AngleY#-180,100)
CameraY# = Get Ground Height(1,CameraX#,CameraZ#)
Position camera CameraX#,CameraY#+50,CameraZ#
Point camera X#,Y#+25,Z#
If keystate(17)=1 then Move camera 20
If keystate(30)=1 then Yrotate Camera Wrapvalue(CameraAngleY#-1)
If keystate(32)=1 then Yrotate Camera Wrapvalue(CameraAngleY#+1)
If Keystate(31)=1 then Move camera -20
`Endif
Rem Refresh Screen
Sync
Loop
JakeX