I am trying to work on a standard adventure/platform genre game engine that if sucsessful I can use it for future projects. I had intentions to share it on the codebase but despite following the tutorials on DarkBASIC page on the site, I can't set collisions right and hearing about Sparky's Collisions downloaded it. Maybe it's still sharable if possible afterwards.
Problem is I just can't set collisions right, whenever addon or not. First my pointer (object 1) kept phasing through the walls (object 2) and now "Error During Set Scaling: Object (1) Not Setup".
Can someone please help me with this in what I am doing wrong?
Rem Setup sync rate
Sync On
Sync Rate 30
Rem Make map
Load object "First map.x",2
SC_setupComplexObject 2, 0, 0
Rem Create pointer
Load object "media\Pointer.x",1
Scale object 1, 2000, 2000, 2000
SC_allowObjectScaling 1
Position object 1, 0,20,0
SC_updateObject 1
SC_setupObject 1, 0, 2
Rem Create camera sphere
Make object sphere 3, 1
Glue object to limb 3, 1, 0
Hide object 3
Rem Collisions
Rem Main loop
Do
Rem Storage
aY1# = Object angle Y(1)
aY3# = Object angle Y(3)
posX# = Object position x(1)
posY# = Object position y(1)
posZ# = Object position z(1)
Rem Keyboard control input
If upkey()=1 then yrotate object 1, aY3#
If upkey()=1 then move object 1,5
If downkey()=1 then yrotate object 1, aY3# -180
If downkey()=1 then move object 1,5
If leftkey()=1 then yrotate object 1, aY3# -90
If leftkey()=1 then move object 1,5
If rightkey()=1 then yrotate object 1, aY3# +90
If rightkey()=1 then move object 1,5
Rem Gamepad control input
TEXT 5,5,"joystick x "+str$(joystick x())
TEXT 5,15,"joystick y "+str$(joystick y())
TEXT 5,25,"joystick z "+str$(joystick z())
TEXT 590,20,"X"+str$(joystick fire c())
TEXT 600,5,"Y"+str$(joystick fire d())
TEXT 610,20,"B"+str$(joystick fire b())
TEXT 600,35,"A"+str$(joystick fire a())
` Joystick Axis
` If joystick Y()=1 then yrotate object 1, aY3#
` If joystick Y()=1 then move object 1,5
` xrotate object 2,object angle x(2)+joystick y()/3.0
Rem Main camera
Set camera to follow object position x(1), object position y(1), object position z(1), aY3#, 150, 75, 10, 100
If keystate(30)=1 then Yrotate object 3,Wrapvalue(aY3#-5)
If keystate(32)=1 then Yrotate object 3,Wrapvalue(aY3#+5)
Rem Refresh Screen
Sync
Loop
It's all copy and paste. The codes I set with ` are for later use such controlling the character with gamepad.
I am new to all this and my education is the tutorials provided on the DarkBASIC and DarkBASIC Pro Product pages.