I make a zombie game but i have a bullet problem
I still have it... I try but i dont know how to make a wrong...
That is my code game.
Ctrl is shoot. Pistol is a "1".
REM Project: City Of Dead
REM Created: 2007-11-16 17:36:57
REM By Sebastian Woźnicki
REM ***** Main Source File *****
REM
`Startowe ustawienia
SYNC ON:SYNC RATE 60:AUTOCAM OFF:HIDE MOUSE:hide light 0
center text screen width()/2,screen height()/2,"Ładowanie Sebolix engine Alpha 0.1"
sync : sync
`************Postacie i elementy************
load object "Soldier.x",1
scale object 1,10,10,10
position object 1,0,25,0
`******************Bronie********************
load object "Pistolet.x",500
scale object 500,100,70,70
hide object 500
`*****************pocisk********************
target = 10
make object sphere target,5.0
color object target,rgb(255,255,255)
hide object target
`*****************LEVEL**********************
load object "lvl.x",100
position object 100,200,120,0
load image "grass.bmp",1
MAKE MATRIX 1,5000,5000,50,50
prepare matrix texture 1,1,1,1
POSITION MATRIX 1,-2500,0,-2500
`Wazne
Bullet=1
speed#=2.0
speed_obrot#=4.0
Ammo#=12
MaxAmmo#=12
magazynki#=3
maxmagazynki#=3
SC_SetupObject 100,0,0
`Cienie wszystkich obiektów
make light 1
position light 1,0,300,0
set shadow shading on 1
set shadow shading on 500
`main loop
DO
`stara pozycja gracza
OX# = OBJECT POSITION X(1)
OY# = OBJECT POSITION Y(1)
OZ# = OBJECT POSITION Z(1)
`Poruszanie sie i sterowanie (zmiana broni tez)
if upkey()=1 then move object 1,speed#: loop object 1,0,19 : set object speed 1,50
if downkey()=1 then move object 1,-speed#: loop object 1,0,19 : set object speed 1,50
if leftkey()=1 then turn object left 1,speed_obrot#
if rightkey()=1 then turn object right 1,speed_obrot#
if keystate(44)=1 then move object left 1,speed#
if keystate(45)=1 then move object right 1,speed#
if upkey()+downkey()=0 then loop object 1,0,0
if keystate(2)=1 : glue object to limb 500,1,87 : show object 500 : Gun#=1 : show object target
rotate limb 1,85,-50,0,-20
rotate limb 1,86,10,0,0
endif
if keystate(18)=1 : hide object 500 : Gun#=0 : hide object target
rotate limb 1,85,0,0,0
rotate limb 1,86,0,0,0
endif
`nowa pozycja gracza
X# = OBJECT POSITION X(1)
Y# = OBJECT POSITION Y(1)
Z# = OBJECT POSITION Z(1)
`position the camera
Position Camera Object Position X(1),Object Position Y(1)+250,Object Position Z(1)
Point Camera Object Position X(1),Object Position Y(1),Object Position Z(1)
gosub _shoot:
`kolizje on
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,10,1,100)
`Takei info heh
TEXT 0,0,"Sebolix Engine Alpha 0.1"
text 0,screen height()-50,"amunicja: "+str$(ammo#)
text 0,screen height()-40,"magazynki: "+str$(magazynki#)
`Odswiezanie
SYNC
`Loop
LOOP
`********************STRZAL********************
_shoot:
PistolX# = limb position x(1,87)
PistolY# = limb position y(1,87)
PistolZ# = limb position z(1,87)
x1# = object position x(1)
y1# = object position y(1)
z1# = object position z(1)
position object target,x1#,y1#,z1#
set object to object orientation target,1
move object target,100.0
tx# = object position x(target)
ty# = object position y(target)
tz# = object position z(target)
if keystate(29) and Gun#=1 and Shoot#=0
for b = 1 to 10
Make object sphere b,10
Shoot#=1
position object b,PistolX#,PistolY#,PistolZ#
b=b+1
if b>10 then b=1
point object b,tx#,ty#,tz#
move object b,10.0
next b
if keystate(29)=0 then Shoot#=0
endif
return
`Funkcja kolizji(bez niej nie dziala)
FUNCTION SlidingCollision(X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,Dyn,Obj)
C = sc_SphereSlide(Obj,X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,0)
IF C > 0
cx# = sc_getCollisionSlideX()
cy# = sc_getCollisionSlideY()
cz# = sc_getCollisionSlideZ()
POSITION OBJECT Dyn, cx#, cy#, cz#
ENDIF
ENDFUNCTION
DELETE MEMBLOCK 1