thanks, fixed the wall proplem
i have another proplem it's like the pool balls, i have tried to use the "object collision()" command to check the collision between several balls but it kinda didn't work because sometimes the balls would bounce and somtimes not so i used the "object screen x()" and "object screen y()" to check if the balls are hitting each other but the code doesn't work and i think that the proplem is in the variables
here is the code
randomize timer()
`--------------------
`declaring variables
`--------------------
displayx=640
displayy=480
camerax#=displayx/2
cameray#=402.5
cameraz#=displayy/2
mousex#=320
mousey#=240
player_object=1
dim max_balls(1)
max_balls(1)=6
`--------------
`setup display
`--------------
set display mode displayx,displayy,16
sync on
sync rate 40
autocam off
backdrop on
color backdrop 0
set ambient light 50
`-------------------------
`make the matrix and stuff
`-------------------------
make matrix 1,displayx,displayy,displayx/31,displayy/31
`prepare matrix texture 1,matrix_texture,1,1
`set matrix texture 1,0,1
make object box 3,20,20,displayy-55 : position object 3,displayx-(displayx-18),10,240 : color object 3,RGB(255,0,0)
make object box 4,20,20,displayy-55 : position object 4,displayx-18,10,240 :color object 4,RGB(255,0,0)
make object box 6,20,20,displayx-55 : position object 6,displayx/2,10,displayy-18 : color object 6,RGB(255,0,0)
yrotate object 6,90
`info panel
make object box 5,40,20,displayx-55 : position object 5,displayx/2,10,displayy-452 : color object 5,RGB(255,0,0)
yrotate object 5,90
`side squares
make object box 7,20,20,20 : position object 7,displayx-(displayx-18),10,displayy-18 : color object 7,RGB(255,0,0)
make object box 8,20,20,20 : position object 8,displayx-18,10,displayy-18 : color object 8,RGB(255,0,0)
make object box 9,20,20,20 : position object 9,displayx-(displayx-18),10,displayy-462 : color object 9,RGB(255,0,0)
make object box 10,20,20,20 : position object 10,displayx-18,10,displayy-462 : color object 10,RGB(255,0,0)
for x=3 to 6
if x=5
`texture object x,panel_texture
else
`texture object x,boarder_texture
endif
next x
for x=7 to 10
color object x,RGB(108,108,108)
next x
`---------------
`set the camera
`---------------
position camera camerax#,cameray#,cameraz#
point camera displayx/2,0,displayy/2
`------------------
`make enemy balls
`------------------
for x = 11 to max_balls(1)+10
make object sphere x,27
color object x,RGB(255,0,0)
position object x,rnd(320)+60,0,rnd(240)+60
enemyangley#=rnd(359.0)+1
yrotate object x,enemyangley#
`texture object x,enemy_texture
next x
`---------
`main loop
`---------
do
`---------------
`move the enemy
`---------------
moveenemy(4.0)
collision()
`---------------------------
`sync and end the main loop
`---------------------------
sync
loop
`--------------------
`move enemy function
`--------------------
function moveenemy(speed#)
if stop=0
for x=11 to max_balls(1)+10
enemyposx#=object position x(x)
enemyposz#=object position z(x)
enemyangley#=object angle y(x)
enemyposx#=newxvalue(enemyposx#,enemyangley#,speed#)
enemyposz#=newzvalue(enemyposz#,enemyangley#,speed#)
if enemyposx#<18+20
enemyangley#=360-enemyangley#
endif
if enemyposx#>622-20
enemyangley#=360-enemyangley#
endif
if enemyposz#>462-20
enemyangley#=wrapvalue(180-enemyangley#)
endif
if enemyposz#<28+40
enemyangley#=wrapvalue(180-enemyangley#)
endif
yrotate object x,enemyangley#
position object x,enemyposx#,20,enemyposz#
next x
endif
endfunction
`-----------------------------
`collision detection function
`-----------------------------
function collision()
for x = 11 to max_balls(1)+10
rightpos1=object screen x(x)+27
leftpos1=object screen x(x)-27
uppos1=object screen y(x)+27
downpos1=object screen y(x)-27
enemyangley1#=object angle y(x)
for x2 = 12 to max_balls(1)+10
rightpos2=object screen x(x2)+27
leftpos2=object screen x(x2)-27
uppos2=object screen y(x2)+27
downpos2=object screen y(x2)-27
enemyangley2#=object angle y(x2)
if rightpos1=leftpos2 and uppos1=downpos2 or leftpos1=rightpos2 and downpos1=uppos2
yrotate object x,enemyangley2#
yrotate object x2,enemyangley1#
endif
next x2
next x
endfunction
i'm one of the bad things that happen to good people