can someone please tell me why the ball doesn´t move at all?
(Attached the game to, becuse i use some own models)
Rem Project: pong
Rem Created: 2005-03-04 22:28:44
Rem ***** Main Source File *****
rem settings
settings()
rem load level
make_lvl()
rem load ball, players and settings
load_players()
rem included variabels
included_variabels()
do
rem player movvement code
players_movement()
rem ball movement code
ball_movement()
sync
loop
rem functions
function settings()
sync on
sync rate 70
hide mouse
make camera 1 : position camera 1,0,0,-50 : color backdrop 1,RGB(0,0,0)
endfunction
function make_lvl()
load object "media/models/tak.3ds",4 : position object 4,0,25,0 : color object 4,RGB(0,0,255) : scale object 4,20,20,20 : rotate object 4,0,90,0
load object "media/models/tak.3ds",5 : position object 5,0,-25,0 : color object 5,RGB(0,0,255) : scale object 5,20,20,20 : rotate object 5,180,90,0
make object box 6,2,46.5,6
position object 6,0,0,0
ghost object on 6
color object 6,RGB(0,128,255)
endfunction
function load_players()
load object "media/models/hover.3ds",1 : color object 1,RGB(0,0,255) : position object 1,-32,0,0 : scale object 1,20,20,20 : rotate object 1,160,0,90
load object "media/models/hover.3ds",2 : color object 2,RGB(0,0,255) : position object 2,32,0,0 : scale object 2,20,20,20 : rotate object 2,340,180,90
make object sphere 3,1.5
endfunction
function included_variabels()
inc p1mvu
inc p1mvd
inc p2mvu
inc p2mvd
inc bally
inc ballx
inc ballz
inc ballyvelo
inc ballxvelo
endfunction
function players_movement()
p1mvu=0
p1mvd=0
p2mvu=0
p2mvd=0
if upkey()=1 then p2mvu=1
if downkey()=1 then p2mvd=1
if keystate(17)=1 then p1mvu=1
if keystate(31)=1 then p1mvd=1
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
x2#=object position x(2)
y2#=object position y(2)
z2#=object position z(2)
if p1mvu=1
y#=y#+0.5
endif
if p1mvd=1
y#=y#-0.5
endif
if p2mvu=1
y2#=y2#+0.5
endif
if p2mvd=1
y2#=y2#-0.5
endif
rem makes the players to stay in screen
if y#>21 then y#=21
if y#<-21 then y#=-21
if y2#>21 then y2#=21
if y2#<-21 then y2#=-21
position object 1,x#,y#,z#
position object 2,x2#,y2#,z2#
endfunction
function ball_movement()
ballx=object position x(3)
bally=object position y(3)
ballz=object position z(3)
rem making the ball move after shooting it
ballx=ballx+0.5
bally=bally+0.5
position object 3,ballx,bally,ballz
endfunction
You never fail, only make mistakes.