Well I've been trying with that command, but now the bullet is shot
randomly, if I'm going forward is shot in a direction, but if I'm going backwards is shot in another direction
. Anyone knows how to make a bullet system?
Thnx!
autocam off
sync on
sync rate 50
global char=1
global suelo=2
global man1=3
global man2=4
make object box suelo,10000,.5,10000
color object suelo,rgb(200,20,20)
make object cube char,1
make object sphere man1,.4
make object sphere man2,.4
color object char,rgb(0,255,0)
color object man1,rgb(0,0,251)
color object man2,rgb(251,0,0)
position object man1,7,2,10
position object man2,13,2,10
position camera 10,2,5
rem bullet
global bala=5
make object sphere bala,.4
color object bala,rgb(20,20,201)
phy start
rem rigid bodies
phy make rigid body dynamic sphere man1
phy make rigid body dynamic sphere man2
phy make rigid body static box suelo
phy make rigid body dynamic sphere bala
phy make box character controller char,10,2,12,1,1,1,1, 1.5, 45.0
rem main loop
do
set camera to follow object position x(char),object position y(char),object position z(char),45,7,3,50,1
mover_char(4,1.5)
rem shooting
if scancode()=44
phy set rigid body rotation bala,object angle x(char),object angle y(char),object angle z(char)
phy set rigid body position bala, object position x(char), object position y(char),object position z(char)
Phy add Rigid Body Local Force bala,0,0,5,1
else
endif
text 0,0,"Character Angle X: "+str$(object angle x(char))
text 0,10,"Character Angle Y: "+str$(object angle Y(char))
text 0,20,"Character Angle Z: "+str$(object angle Z(char))
text 0,30,"Bala Angle X: "+str$(object angle x(bala))
text 0,40,"Bala Angle Y: "+str$(object angle Y(bala))
text 0,50,"Bala Angle Z: "+str$(object angle Z(bala))
text 0,70,"Character -> "+str$(object position x(char))+" Y: "+str$(object position y(char))+" Z: "+str$(object position z(char))
text 0,90,"Bala -> "+str$(object position x(bala))+" Y: "+str$(object position y(bala))+" Z: "+str$(object position z(bala))
phy update
sync
loop
rem end of main loop
function mover_char(vel#,vel_ang#)
if upkey()=1
phy move character controller char,vel#
endif
if downkey()=1
phy move character controller char,-vel#
endif
if leftkey()=1
turn object left char,vel_ang#
endif
if rightkey()=1
turn object right char,vel_ang#
endif
endfunction
I am a Maverick hunter. Never know when they're acting against you.