Hi guys
I'm having some trouble with my code. It seems like it just stopped working for no reason, everything that is in it worked before.
I've spent a couple of hours now trying to debug my code but just can't seem to figure out what is wrong
Here is my code,
`***** 3D OBJECTS *****
#CONSTANT player_one 1
`***** IMAGE FILES *****
#CONSTANT player_img 1
#CONSTANT floor_img 2
`***** MOVEMENT STUFF *****
#CONSTANT forward_move 1
#CONSTANT backward_move -1
#CONSTANT stationary 0
`***** TYPES *****
TYPE tvector
x AS FLOAT
y AS FLOAT
z AS FLOAT
ENDTYPE
TYPE tplayer
id AS INTEGER
pos AS tvector
movement AS FLOAT
ENDTYPE
GLOBAL car_one AS tplayer
car_one.id = player_one
`***** SET UP GAME AND LOAD PLAYER *****
initialize()
loadplayer1()
`***** MAIN LOOP *****
DO
`cords_debug()
controlplayer1()
SYNC
LOOP
FUNCTION initialize()
SET DISPLAY MODE 800,600,32
AUTOCAM OFF
COLOR BACKDROP RGB(0,0,0)
POSITION CAMERA 0,40,0
POINT CAMERA 0,0,0
SYNC ON
SYNC RATE 60
ENDFUNCTION
FUNCTION loadplayer1()
LOAD OBJECT "car.x",player_one
LOAD IMAGE "car_img.dds",player_img
TEXTURE OBJECT player_one,player_img
ENDFUNCTION
FUNCTION controlplayer1()
movement = stationary
IF UPKEY()=1 THEN movement = forward_move
IF DOWNKEY()=1 THEN movement = backward_move
IF Movement = forward_move THEN MOVE OBJECT player_one,car_one.movement
IF Movement = forward_move THEN INC car_one.movement,-0.01
IF Movement = backward_move THEN MOVE OBJECT player_one,car_one.movement
IF Movement = backward_move THEN INC car_one.movement,0.01
IF car_one.movement < -0.4 THEN car_one.movement = -0.4
IF car_one.movement > 0.2 THEN car_one.movement = 0.2
IF movement = stationary
car_one.movement = car_one.movement/1.4
IF car_one.movement>-0.05 AND car_one.movement<0.05 THEN car_one.movement=0.0
ENDIF
if leftkey() = 1 then yrotate object 1, (object angle y(1) - 2.3)
if rightkey() = 1 then yrotate object 1, (object angle y(1) + 2.3)
ENDFUNCTION
FUNCTION cords_debug()
x = OBJECT POSITION X(player_one)
y = OBJECT POSITION Y(player_one)
z = OBJECT POSITION Z(player_one)
TEXT 20,20,STR$(x)
TEXT 20,30,STR$(y)
TEXT 20,40,STR$(z)
ENDFUNCTION
I have not included the media but will upload if you really need it.
Thanks in advance!