Well i have another problem now.
i use Nuclear glory collision and when i tell the player object to position at a checkpoint box positioned at the start of the level if the time runs out. The ball can`t go back because the collision is stopping it.
Here is the current complete code i use:
Rem Project: Ball Run
Rem Created: 08-02-2005 20:51:25
Rem ***** Main Source File*****
` the normal settings
sync on
sync rate 30
hide mouse
` start the collision system
startcollisionPRO( 000000000,000000000,000000000 )
` start the collision debugger
startcollisiondebugPRO()
`set the exclusive to 0
setcollisionexclusive( 0 )
` The constants
#Constant NCULL_COUNTER_CLOCK 1
#Constant NCULL_CLOCK 2
#Constant NCULL_NONE 3
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_SLIDE_NO_ACCEL=5
#Constant RESP_NONE=6
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_NOTURN=3
` My own constants
#constant type_player = 2
#constant type_wall = 1
rem set collision types
SetCollisionsPRO(Type_Player, Type_Wall, ELLIP_2_POLY, RESP_SLIDE, DYN_NO_RESP,Auto_Priority )
` load the ball run map
load object "media/map/training ground.x",1
rotate object 1,0,180,0
position object 1,0,0,550
` load the sounds and music
load music "media/music/music fun.mp3",1
load music "media/music/menu music.wav",2
load sound "media/sounds/coin hit.wav",3
` load the textures
load image "media/texture/goal texture.bmp",1
load image "media/texture/grass.bmp",2
load image "media/menu.bmp",3
`make the menu screen to a sprite and hide it
sprite 1,0,0,3
hide sprite 1
`make the intro screen to a sprite and hide it
sprite 2,0,0,4
hide sprite 2
` Make the player object and position it
make object sphere 2,10
texture object 2,2
position object 2,0,60,30
` make some variables for the checkpoint box
checkpoint_position_x = 0
checkpoint_position_y = 90
checkpoint_position_z = 30
`The checkpoint object
make object box 3,10,10,10
color object 3,RGB(255,0,0)
` This is the collision types for object 1 and 2
collisiontypePRO( 1,type_wall )
collisiontypePRO( 2,type_player )
` Player variables
player_speed = 4
player_life = 3
`In-Game variables
Game_time = 300
rem set radius for player as it is being used as an ellip collision
SetObjRadiusPRO(2,object size x(2)/2,object size y(2)/2,object size z(2)/2)
`set object gravity
SetObjGravityPRO( 2, 1 )
` play the menu music
loop music 2
` Jump the credit over and go to the menu
goto menu
` the credits label
credits:
hide sprite 1
print "Credits go here"
print "press any key to go back to the menu"
wait key
goto menu
` The menu label
menu:
` take the menu texture, make it to a sprite and position it
sync
`show the menu texture
show sprite 1
` If c then goto the credits
if keystate(46) = 1
goto credits
endif
if inkey$() = "s"
goto start_game
endif
goto menu
start_game:
` stop the menu music
stop music 2
` delete the menu texture
delete sprite 1
` begin to loop the In_Game music
loop music 1
` make a score variable.
score = 0
` Position the coins
for x= 5 to 20
load object "media/models/coin.x",x
scale object x,20,20,20
position object x,rnd(600),30,rnd(3000)
next x
`THIS IS THE MAIN LOOP
do
` position the checkpoint object`s
position object 3,checkpoint_position_x,checkpoint_position_y,checkpoint_position_z
`print the player life on the screen
set cursor 0,27
print player_life
` the collision system for the coins and the player object
for x= 4 to 20
if object exist(x)
if object collision(2,x)
delete object x
score = score+1
play sound 3
endif
endif
next x
` print the current score
set cursor 0,15
print "Your score is : "; score
`start the game time to count down
game_time = game_time-1
`If the time is out lose a life and reset.
if game_time<0
player_life = player_life-1
game_time = 2000
SetObjRadiusPRO(2,object size x(2)/0,object size y(2)/0,object size z(2)/0)
position object 2,object position x(3),object position y(3),object position z(3)
endif
`If player_life is = 0 then end the game
if player_life<0
end
endif
`´ Print the game time on the screen
set cursor 0,0
print "Time left : "; game_time
` The ball control input
move object 2,player_speed
if leftkey() = 1
move object left 2,player_speed
endif
if rightkey() = 1
move object right 2,player_speed
endif
` rotate the ball
scroll object texture 2,0,0.006
` set the camera to follow the player object
set camera to follow object position x(2),object position y(2),object position z(2),0,10,10,10,0
` run the collision system
runcollisionPRO()
sync
loop
How can i make the ball go to the checkpoint box at the start of the level without collide with the level?
Thanks
The Nerd