I remmed out a bunch of stuff in your code and made some primatives in order to make a working example of it. This assumes that you have the current version of Sparky's in your 'user-plugins' folder.
Rem Project: weapontest
Rem Created: Sunday, May 24, 2009
Rem ***** Main Source File *****
Sync On : Sync Rate 0 : set display mode 1280, 800, 32
set window off
global oldx# as float : global oldy# as float : global oldz# as float
global radius# as float
Do
if Button(20,55,"New Game")=1 then Goto New_Game
Button(20,95,"Load Game")
If Button(20,135,"Exit")=1 then End
sync
loop
New_Game:
sync
hide mouse
make object sphere 1,10
SC_setupObject 1,0,0
SC_AllowObjectScaling 1
SC_setObjectCollisionOn 1
scale object 1, 40, 40, 40
SC_updateObject 1
position object 1, 10, 5, 10
radius# = object size y(1) * .2
`load object "media\Template Body 2.x", 1
make memblock 1,100
`xpos#=object position x(1)
`ypos#=object position y(1)
`zpos#=object position z(1)
`loop object 1
make object sphere 7,10
color object 7,rgb(255,255,0)
`load object "media\Template Body 1.x", 7
position object 7,30, 5, 50
SC_SetupObject 7,1,0
SC_setObjectCollisionOn 7
SC_UpdateObject 7
make object box 2,10,20,5
SC_setupobject 2,1,0
SC_AllowObjectScaling 2
SC_setObjectCollisionOn 2
color object 2,rgb(255,0,0)
position object 2,90,10, 140
scale object 2, 1200, 1200, 1200
rotate object 2, 0,0,180
SC_setObjectCollisionOn 2
SC_UpdateObject 2
`load object "media\house.3ds", 2
make object box 3,10,20,5
color object 3,rgb(0,255,0)
`load object "media\house.3ds", 3
position object 3, 50, 10, 30
SC_SetupObject 3,1,0
SC_setObjectCollisionOn 3
ink rgb(0,200,95),0
box 0,0,50,50
get image 5, 0, 0, 50, 50
get image 6, 0, 0, 50, 50
`load image "media\tmp27.jpg", 5
`load image "media\tmp27.jpg", 6
`texture object 2, 5
cls
make matrix 1,800,800,5,5
Position Matrix 1,-100,0,-100
prepare matrix texture 1, 5, 5, 5
`load object "media\simple shelf.x", 13
`scale object 13, 400, 400, 400
`rotate object 13, 90, 0, 0
`position object 13, 15, 1, 193
`load object "media\simple barrel.x", 14
`scale object 14, 300, 300, 300
`position object 13, 20, 1, 30
`load object "media\orange.x", 15
`scale object 14, 200, 200, 200
`p`osition object 14,20, 301, 30
movespeed = 75
turnspeed = 87.5
time=timer()
Ang# = 270
CamYPos# = 130
Do
gameTime=timer()-time
MSframe#=gameTime*(movespeed/1000.0)
TSframe#=gameTime*(turnspeed/1000.0)
oldx# = object position x(1)
oldy# = object position y(1)
oldz# = object position z(1)
If Upkey()=1
Move Object 1,MSframe#
endif
If Downkey()=1
Move Object 1,-MSframe#
endif
If Leftkey()=1
Dec a#,TSframe#
endif
If Rightkey()=1
Inc a#,TSframe#
endif
yrotate object 1,a#
x# = object position x(1)
y# = object position y(1)
z# = object position z(1)
collide = SC_sphereSlideGroup ( 1, oldx#, oldy#, oldz#, x#, y#, z#, radius#, 0 )
if collide > 0
x# = SC_getCollisionSlideX()
y# = SC_getCollisionSlideY()
z# = SC_getCollisionSlideZ()
position object 1,x#,y#,z#
else
endif
posy#=object position y(1)
posx#=cos(Ang#-a#) * 90 + object position x(1)
posz#=sin(Ang#-a#) * 90 + object position z(1)
Position Camera posx#,object position y(1)+CamYPos#,posz#
Point Camera object position x(1),object position y(1),object position z(1)
move camera mousez()/5
if MouseClick()=4
dec Ang#, MouseMoveX()/5
dec CamYPos#, MouseMoveY()/5
endif
Ang# = Wrapvalue(Ang#)
time=timer()
set cursor 0,0
print mousemovey()
print mousemovex()
sync
Loop
end
function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed
By the way, I believe you could easily code this to eliminate the goto.
LB