Ive been trying to get KIStechs decoupling working for an hour or two now. What happens is that I just get a back screen, nothing else except for so printing. I think it has to do with the image pasting or set camera to image. The media isnt important and I don't think I can hand them out cause half of them are from DarkMatter. Heres the code.
remstart
===================================
Display And Camera Settings
===================================
remend
sync on : sync rate 0
autocam off
set display mode 1280, 800, 32 ` my display node
sw= screen width() - 200
sh= screen height() - 200
make camera 1
set camera to image 1, 1, 1280, 800
set camera range 1, 1, 17000
set current camera 0
remstart
====================================
Object Loading and Related
====================================
remend
load object "F1Car.x", 1 ` load up the models
load object "Straight.x", 2
load object "Car.x", 3
load object "sky17\sky17.x", 4
scale object 4, 150000,150000,150000
scale object 1, 1000, 1000, 1000
position object 1, -5160, -77, -626 ` position inside map
position object 3, -5160, - 77, -629
position object 4, 0, - 77, -680
sc_setupobject 1,0,0 `collision system setup
sc_setupobject 2,0,0
yrotate object 3, 90
yrotate object 4, -90
yrotate object 1, 270 ` rotate to face foward
`===================================
`Global Varibles and So on
`===================================
global Factor# as float
global FLast as float
global LT as integer = hitimer() ` Loop Timer
global GT as integer = LT ` Game Loop Timer
global DT as integer = LT ` Display Loop Timer
global TV as integer = LT ` Timer Value
type Moving
F# as float
Tqe# as Float
endtype
F# = 0
Anim# = 5
ang# = 90 ` make camera follow properly and because i rotated 90 degrees
`+++++++++++++++++++++++++++++++++++
`Main Loop and counting
`+++++++++++++++++++++++++++++++++++
do
`print "10 press key"
TV = hitimer()
inc LPS
if TV - LT >= 1000
LT = TV
LPS$ = str$(LPS)
LPS = 0
GPS$ = str$(GPS)
GPS = 0
DPS$ = str$(DPS)
DPS = 0
endif
if TV - DT >= 33 ` Rounded 33.3333 milliseconds for 30 FPS desired framerate
DT = TV
gosub Display
inc DPS
endif
if TV - GT >= 8 ` Set for approximately four times the desired framerate
GT = TV
gosub Game
inc GPS
endif
loop
`###############################
` Game loop
`###############################
Game:
TBM()
oldx# = object position x(1) ` for the collision
oldy# = object position y(1)
oldz# = object position z(1)
if upkey() = 1 ` moving forward
inc Anim#, 1
if F# < 50 then inc F#, .2//F#=F# +.2` speed limit
F# = F# - Slow ` if collides with wall, it goes slower
Speed# = F#*10 ` just to make the car seem faster
move object 1, - F#/5` moving
set object frame 1, Anim#
If Anim# >= 25 then Anim# = 5
else
if F# > 0 then Move object 1, - F#/15 `after relesing key, goes foward a little
dec F#,0.4//F#= F#- 0.4 ` goes slower
if F# <0 then F# = 0 ` no negatives
endif
Tqe# = F#/ 10 ` how fast the car can turn
if leftkey() = 1
turn object left 1, Tqe#
ang# = ang# - Tqe# ` camera angle follow
endif
if rightkey() = 1
turn object right 1, Tqe#
ang# = ang# + Tqe#
endif
if downkey() = 1 then move object 1, 2
//sc_updateobject 1
//sc_updateobject 2
x# = object position x(1) `needed by collision system
y# = object position y(1)
z# = object position z(1)
`collide = sc_spherecast(0,oldx#,oldy#,oldz#,x#,y#,z#,object size(1)+10,1) ` check if it collides
collide = sc_objectcollision(1,0)
if collide>0 ` if it collides with something
xx# = sc_getcollisionslidex() ` new positions
yy# = sc_getcollisionslidey()
zz# = sc_getcollisionslidez()
position object 1, xx#, yy#, zz# `position it to the sliding positions
sc_updateobject 1 `updat the object
Slow = 1
else
Slow = 0
endif
`move object 3, 9
set camera to follow 1, object position x(1), object position y(1), object position z(1), ang#, 70, 50, 10, 0
return
`###############################
`Display loop
`###############################
Display:
paste image 1,0,0
print z#
print F#
print str$(screen FPS())
print Tqe#
print x#
print y#
Print Slow
If Pic = 0
save image "C:\Drive\MyPic2.png", 1
Pic = 1
endif
return
function TBM()
t = hitimer()
Diff# = t - FLast
FLast = t
Factor# = Diff# / 1000.0
endfunction
`sc_getfacehit
//endif
`set display mode 1280,800, 16, VSync
//set global collision off
`set object 1,1,1, 0
` to see farther because the normal settings cant see the entire map
//set camera to follow object position x(1), object position y(1), object position z(1), 0, 10, 10, 10, 0
//set object cull 1, 1
//set object cull 2, 1
//set object cull 3, 1
//set object cull 4, 1
`position camera 0, 0, 500, 0
`point camera 0, 0, 0, 0
//global P as integer = 0 ` Chosen planet to display
`wait key
remstart
global LPS as integer = 0 ` Number of overall loops per second
global LPS$ as string
global GPS as integer = 0 ` Number of game loops per second
global GPS$ as string
global DPS as integer = 0 ` Number of display loops per second
global DPS$ as string
remend
//if sc_objectcollision(1,0) = 2 then position object 1, oldx#, oldy#, oldz#
//phy make rigid body static box 1
remstart
Function Slide(obj,checkobj,oldx#,oldy#,oldz#,x#,y#,z#,radius#,exlude)
collide = sc_spherecast(checkobj,oldx#,oldy#,oldz#,x#,y#,z#,radius#,exlude) ` check if it collides
if collide>0 ` if it collides with something
xx# = sc_getcollisionslidex() ` new positions
yy# = sc_getcollisionslidey()
zz# = sc_getcollisionslidez()
position object obj, xx#, yy#, zz# `position it to the sliding positions
sc_updateobject obj `updat the object
Slow = 1
else
Slow = 0
endif
endfunction
remend
//perform checklist for display modes