Hi guys,
I downloaded the trail version of DarkBasic and I really like it. Though I'm a 14 year old Dutch guy and I am facing some difficulties in coding. I wan't to make a platform engine.. I wan't gravity.. I wan't my objects to move ON the ground and not just in 1 line.. Here I wanted to make a moon rolling over a platform. Instead, It rolls under the surface in a straight line.. How can I make a platform engine? Please help me
Though try and explane a bit slow. I've been working with this for only a few hours now...
rem ******************
rem * MY FIRST TRIES *
rem ******************
`-----------------------
rem Load stone floor bitmap into image
LOAD BITMAP "dirt.bmp",1
GET IMAGE 1,0,0,16,16
DELETE BITMAP 1
LOAD BITMAP "moon.bmp",2
GET IMAGE 2,0,0,16,16
DELETE BITMAP 2
rem Colour Back Black
color backdrop 0
rem Fog settings
fog on
fog color 0
fog distance 1000
rem Activate manual syncronization and hide mouse
SYNC ON : HIDE MOUSE
rem Make a 3D landscape
MAKE MATRIX 1,10000.0,10000.0,10,10
rem Texture landscape
PREPARE MATRIX TEXTURE 1,1,1,1
rem Randomise landscape
RANDOMIZE MATRIX 1,400.0
rem Create a moving object
MAKE OBJECT SPHERE 1,50
POSITION OBJECT 1,0,0,-80.0
rem Try texturing the moon again
TEXTURE OBJECT 1,2
rem Setting starting rotation speed
b=1
rem Starting y settings
y=200.0
rem Begin loop
DO
rem Trying to make a gravity engine already <--------BUGG
IF GET MATRIX HEIGHT(1,OBJECT POSITION X(1),OBJECT POSITION Z(1))=<OBJECT POSITION Y(1) THEN y=y-2
IF GET MATRIX HEIGHT(1,OBJECT POSITION X(1),OBJECT POSITION Z(1))=>OBJECT POSITION Y(1) THEN y=y+2
rem Adding an angle to the moon
b=b+1
rem Rotating the moon
IF b=<360
XROTATE OBJECT 1,b
ENDIF
rem Setting b to 0 after 1 lap
IF b=360 THEN b=0
rem Inloop set position Z to Z + 2
POSITION OBJECT 1,200.0,(y-600),a
a=a+2
rem Control camera turret
IF LEFTKEY()=1 THEN angle#=angle#-3.0
IF RIGHTKEY()=1 THEN angle#=angle#+3.0
IF MOUSECLICK()=1 THEN MOVE CAMERA 10.0
IF UPKEY()=1 THEN angle2#=angle2#-3.0
IF DOWNKEY()=1 THEN angle2#=angle2#+3.0
rem Ensure angle stays within range
angle#=wrapvalue(angle#)
angle2#=wrapvalue(angle2#)
rem Update camera
YROTATE CAMERA angle#
XROTATE CAMERA angle2#
rem Refresh screen
SYNC
rem End loop
LOOP
- Mitch
Me vs. The World...