It's doing collision detection with only one object.
I need it to do more.
Here's whhat I got so far.
Rem * Title : X-FileLoading
Rem * Author : Scott B.
Rem * Date : 07/30/07
Backdrop on
Sync On
Sync Rate 30
Make object plain 101,1,5
Make object plain 102,5,1
Make object cylinder 103,.05
Make object cylinder 104,.05
Color object 103,RGB(255,0,0)
Color object 104,RGB(255,0,0)
x1 = 4
y1 = 0 - 4
z1 = 0
x2 = 0 - 4
y2 = 0 - 4
z2 = 0
Make object collision box 103,x1,y1,z1,0,0,0,0
Make object collision box 104,x2,y2,z2,0,0,0,0
Set object collision to spheres 103
Set object collision to spheres 104
dim depth(200)
dim x3d(200)
dim y3d(200)
for i = 1 to 2
rem Load object "asteroid.x",i
rem Load image "asteroid.bmp",1
Make object sphere i,10
Load image "backdrop.bmp",2
Texture backdrop 2
rem Texture object i,1
x = rnd(20)
y = rnd(20)
z = rnd(512)
sign = rnd(1)
if sign = 0 then x = x
if sign = 1 then x = 0 - x
sign = rnd(1)
if sign = 0 then y = y
if sign = 1 then y = 0 - y
x3d(i) = x
y3d(i) = y
depth(i) = 64
Position object i,x3d(i),y3d(i),depth(i)
Make object collision box i,x3d(i),y3d(i),depth(i),0,0,0,0
Set object collision to spheres i
next i
Hide mouse
xold = MouseX()
yold = MouseY()
Backup:
Do
for i = 1 to 2
Position object i,0,0,0
aY# = Object angle Y(i)
aX# = Object angle X(i)
aZ# = Object angle z(1)
aY# = WrapValue(aY#+1)
aX# = WrapValue(aX#+1)
aZ# = WrapValue(aZ#+1)
rem YRotate object i,aY#
rem XRotate object i,aX#
rem ZRotate object 1,aZ#
Position object i,x3d(i),y3d(i),depth(i)
size# = 512 - depth(i)
s# = size# / 512
Scale object i,s#*200,s#*200,s#*200
rem Move object i,1
if depth(i) = 0 then gosub ReFresh
rem depth(i) = depth(i) - 1
rem Position camera 0,0,0
rem Point camera 0,0,0
next i
xu = x2d
yu = y2d
x2d = MouseX()
y2d = MouseY()
if x2d > xu then x3d2# = x3d2# + 2
if x2d < xu then x3d2# = x3d2# - 2
if y2d < yu then y3d2# = y3d2# + 2
if y2d > yu then y3d2# = y3d2# - 2
Position object 101,x3d2#,y3d2#,128
Position object 102,x3d2#,y3d2#,128
Position mouse xold,yold
x2d = xold
y2d = yold
if c = 0 then gosub Setup
if Mouseclick() = 1 then fire = 1
if fire = 1 then gosub Lasers
for j = 1 to 2
if Object collision(103,j) > 0 then goto Reset
if Object collision(104,j) > 0 then goto Reset
next j
Sync
Loop
ReFresh:
x = rnd(320)
y = rnd(240)
z = 512
sign = rnd(1)
if sign = 0 then x = x
if sign = 1 then x = 0 - x
sign = rnd(1)
if sign = 0 then y = y
if sign = 1 then y = 0 - y
x3d(i) = x
y3d(i) = y
depth(i) = z
Make object collision box i,x3d(i),y3d(i),depth(i),0,0,0,0
Set object collision to spheres i
Return
Setup:
rem Color object i,RGB(255,255,255)
x1 = 2
y1 = 0 - 2
z1 = 0
x2 = 0 - 2
y2 = 0 - 2
z2 = 0
Position object 103,x1,y1,0
Position object 104,x2,y2,0
rem Hide object 3
rem Hide object 4
c = 1
return
Lasers:
rem Show object 3
rem Show object 4
if c2 = 0 then nx# = x3d2#:ny# = y3d2#:c2 = 1
Point object 103,nx#,ny#,128
Point object 104,nx#,ny#,128
Move object 103,inc#
Move object 104,inc#
inc# = inc# + 1
if inc# > 128 then fire = 0:c = 0:inc# = 0:c2 = 0
XRotate object 103,90
XRotate object 104,90
rem Scale object 3,1000,1000,1000
rem Scale object 4,1000,1000,1000
return
Reset:
Color object j,RGB(255,0,0)
c = 0
fire = 0
inc# = 0
c2 = 0
Goto Backup