I found out that the object was too close to the camera a couple of minutes after i posted here so that problem is solved. I added shooting and then I added a box that the player can shoot. I then tried to make it so that the bullet would be deleted after it left it hit the walls of the level but i am having trouble with that.
sync on
sync rate 30
load object "simplemap.x", 1
position object 1,0,0,0
scale object 1, 300,300,300
load image "pistol texture.bmp",3
load object "pistol.x",2
rem make box to shoot
make object cube 35,25
position object 35, 200,100,200
load object "pistol.x",4
load image "Wall06.jpg",1
texture object 1,1
texture object 2,3
texture object 4,3
set object collision to polygons 1
scale object 2, 130, 130,130
position camera 100,100,100
position object 2, 7,-5,10
lock object on 2
scale object 4, 130, 130,130
position object 4, -7,-5,10
lock object on 4
shot=0
autocam off
Rem Main loop
Do
Rem Store camera angle
caY#= Camera angle Y()
Rem Control input for camera movement
If Upkey()=1 then Move camera 10
If Leftkey()=1 then Yrotate Camera Wrapvalue(caY#-5)
If Rightkey()=1 then Yrotate Camera Wrapvalue(caY#+5)
If spacekey()=1
gosub shoot
endif
if shot = 1
if object collision(10,1)>0
shot=0
delete object 10
else
gosub bulletmove
if object collision(10,35)>0
delete object 35
delete object 10
shot = 0
endif
endif
endif
Rem Refresh Screen
Sync
Loop
shoot:
if shot = 0
make object sphere 10,10
position object 10, camera position x(), 100, camera position z()
yrotate object 10,caY#
shot = 1
spacepressed = 1
endif
return
bulletmove:
move object 10, 25
return
that is my code so far. I think i am doing collision right so why does the bullet still go through walls?
edit: it also seems that the box moves when i move and i dont know why that is