Ok this is a really odd situation i find myself in. I had a piece of code for blocks to be activated and explode after a while when another object touches it, all well and good and it works lovely, then i put Sparkys collision onto it, again worked lovely BUT then i tried adding my own textures to it... and now it doesn't work properly, either SOME blocks activate or none activate... BUT if i use a 10x10 box made in 3DS max(pointless i know, but i had to test it)... it works but the textures don't.
Rem Project: Dark Basic Pro Project
Rem Created: Thursday, May 29, 2014
Rem ***** Main Source File *****
rem Setup global stuff
set display mode 640,480,32
hide mouse
autocam off
make memblock 1,1
rem Hide loading
sync on
sync rate 0
sync
center text 320,240,"LOADING"
sync
Global radius# as Double Float : radius#=3.0
`player movement vector
Global vx# as Double Float
Global vy# as Double Float
Global vz# as Double Float
Global gravity# as Double Float : gravity#=-0.1
Global slope# as Double Float : slope#=0.5
Global ground as Integer : ground=1
dim BoxLife(100)
dim BoxTriggered(100)
rem Make textures
cls rgb(255,255,0)
text 0,0,"3"
get image 1,0,0,12,16
cls rgb(255,100,0)
text 0,0,"2"
get image 2,0,0,12,16
cls rgb(255,0,0)
text 0,0,"1"
get image 3,0,0,12,16
rem Make player
make object sphere 2,radius#*2.0
color object 2,rgb(0,255,0)
position object 2,10,75,10
sc_setupobject 2,0,1
`sc_drawobjectbounds (2)
rem Make level
Obj=3
for y=10 to 1 step -1
for x=1 to 10
read LevelData
if LevelData=1
make object cube Obj,10
`load object "block.x",Obj
position object Obj,x*10,0,y*10
color object Obj,rgb(100+rnd(155),rnd(155),0)
sc_setupobject Obj,1,2
BoxLife(Obj)=300
BoxTriggered(Obj)=0
inc Obj,1
endif
next x
next y
rem Lock frame rate
sync on
sync rate 100
rem Start the main loop
do
rem Take input
OldX# = Object Position X(2)
OldY# = Object Position Y(2)
OldZ# = Object Position Z(2)
AngY# = Object Angle Y(2)
AngX# = Object Angle X(2)
vx# = 0
vz# = 0
If vy# = 0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
If KeyState(32)=1 or rightkey()=1 Then vx#=vx#+0.8
If KeyState(30)=1 or leftkey()=1 Then vx#=vx#-0.8
If KeyState(31)=1 or downkey()=1 Then vz#=vz#-0.8
If KeyState(17)=1 or upkey()=1 Then vz#=vz#+0.8
x# = OldX#+vx#
y# = OldY#+vy#
z# = OldZ#+vz#
`Collision Data
collide = sc_spherecastgroup(1,OldX#,OldY#,OldZ#,OldX#,OldY#+vy#,oldZ#,radius#,0)
If collide > 0
ny# = sc_getCollisionNormalY()
If abs(ny#) > slope#
OldY# = sc_getStaticCollisionY() `Flat Ground
Else
x# = x# - OldX# : z# = z# - OldZ# `Steep Slope, Cause Player To Slide
OldX# = sc_getCollisionSlideX()
OldY# = sc_getCollisionSlideY()
OldZ# = sc_getCollisionSlideZ()
x# = x# + OldX# : z# = z# + OldZ#
ENDIF
If ny# > slope#
ground = 1
vy# = 0
Else
ground = 0
If vy# < -slope# then vy# = gravity#
ENDIF
Else
OldY# = OldY# + vy#
ground = 0
ENDIF
collide = sc_SphereSlideGroup(1,OldX#,OldY#,OldZ#,x#,OldY#,z#,radius#,0)
If collide > 0
x# = sc_getCollisionSlideX()
OldY# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
ENDIF
Position Object 2,x#,OldY#,z#
sc_updateObject 2
rem Blow up blocks
for b=3 to Obj-1
if object exist(b)=1
if object collision(b,2)>0
BoxTriggered(b)=1
endif
if BoxTriggered(b)=1
BoxLife(b)=BoxLife(b)-1
endif
if BoxLife(b)<300 and BoxLife(b)>199
texture object b,1
endif
if BoxLife(b)<200 and BoxLife(b)>99
texture object b,2
endif
if BoxLife(b)<100
texture object b,3
endif
if BoxLife(b)<1
delete object b
if object exist(b) then sc_updateobject b
sc_removeobject b
endif
endif
next b
rem Control camera
position camera X#,Y#+50,Z#-50
point camera X#,Y#,Z#
rem Update the screen
sync
rem End the loop
loop
rem Design level
LevelData:
data 1,1,1,0,1,1,1,0,1,1
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,0,1,0,1,0,1,0
data 1,0,1,1,1,0,1,1,1,0
I know my coding is badly laid out and a right mess... but if anyone can see what's wrong i love to know... it just confuses me as to why it worked fine until i wanted to add my own texture.
I can see from your smile, you're not here for the sunset
Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD