splitscreen by Anonymous Coder22nd Nov 2010 11:02
|
---|
Summary split screen split screen Description split screen split screen split screen split screen split screen Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com REM Project: S H! REM Created: 12/19/2009 12:14:36 PM REM REM ***** Main Source File ***** REM print "type in your name player one." input " name?",player1name$ print "type in your name player 2." input "name? ",player2name$ if player1name$ = "debug" no#=1 else no#=0 endif sync on sync rate 30 make object box 100,100,100,100 delete object 100 sw#=screen width() sh#=screen height() sw2#=sw# / 2 sh2#=sh# / 2 repeat center text SW2#,SH2#,"my game! hit spacekey to start!" worldx#=rnd(3000) worldz#=rnd(3000) type#=rnd(3) red#=rnd(250) blue#=rnd(250) green#=rnd(250) if shiftkey()=1 endif sync until spacekey()=1 center text SW2#,SH2#,"loading! :P" sync rem set up vereables p1move#=1 spherecount#=100 win#=9 newwin#=0 rem debug debug=1 rem >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> rem set up camera make camera 2 sw#=screen width() sh#=screen height() sw2#=sw# / 2 sh2#=sh# / 2 set camera view 2,0,0,sw#,sh2# set camera view 0,0,sh2#,sw#,sh# position camera 0,0,210,0 position camera 2,0,200,0 turn camera left 2,180 turn camera left 0,180 rem make lighting set ambient light 0 color light 0,rgb(10,10,10) hide light 0 make light 1 set spot light 1,50,50 color light 1,rgb(250,250,250) set light range 1,2000 point light 1,0,0,0 make light 2 set spot light 2,50,50 color light 2,rgb(250,250,250) set light range 2,2000 point light 2,0,0,0 color backdrop 0 color backdrop 2,0 rem >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> rem make world make object box 88,3000,1,3000 if no#=0 number#=6 worldx=0 worldz=0 type#=0 red#=0 blue#=0 green#=0 repeat rem set up random numbers worldx#=rnd(3000) worldz#=rnd(3000) type#=rnd(3) if type#=0 then type#=1 red#=rnd(250) blue#=rnd(250) green#=rnd(250) rem make object if type#=1 make object box number#,red#,300,green# color object number#,rgb(red#,green#,blue#) position object number#,worldx#,50,worldz# rotate object number#,0,blue#,0 endif if type#=2 make object cone number#,300 color object number#,rgb(red#,green#,blue#) position object number#,worldx#,50,worldz# endif if type#=3 make object cylinder number#,300 color object number#,rgb(red#,green#,blue#) position object number#,worldx#,50,worldz# endif number#=number# + 1 until number#=50 endif rem make sphere make object box 100,100,200,100 color object 100,rgb(red#,green#,blue#) set object collision on 100 SET OBJECT COLLISION TO BOXES 100 worldx=0 worldz=0 position object 100,worldx#,0,worldz# rem >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> rem load players make object box 2,100,300,100 color object 2,rgb(250,0,0) rotate object 2,0,180,0 fix object pivot 2 position object 2,1500,0,1500 position camera 2,1500,100,1500 SET OBJECT COLLISION TO BOXES 2 make object box 3,100,300,100 rotate object 3,0,180,0 fix object pivot 3 color object 3,rgb(250,0,0) position object 3,1500,0,1500 position camera 0,1500,100,1500 SET OBJECT COLLISION TO BOXES 3 rem start loop do set cursor 0,0 rem select number for leave play. leavesound#=rnd(3) if leavesound#=0 then leavesound#=2 rem control player 1 if keystate(31)>0 and p1move#=1 move object 3,-5 move camera 0,-5 p1play#=1 endif if keystate(17)>0 and p1move#=1 move object 3,5 move camera 0,5 p1play#=1 endif if keystate(30)>0 then angle1#=wrapvalue(angle1#-10) if KEYSTATE(32)>0 then angle1#=wrapvalue(angle1#+10) rotate object 3,0,angle1#,0 rotate camera 0,0,angle1#,0 rem control player 2 if upkey()=1 move object 2,5 move camera 2,5 p2play#=1 endif if downkey()=1 move object 2,-5 move camera 2,-5 p2play#=1 endif if leftkey()=1 then angle2#=wrapvalue(angle2#-10) if rightkey()=1 then angle2#=wrapvalue(angle2#+10) rotate object 2,0,angle2#,0 rotate camera 2,0,angle2#,0 rem handle lights color light 1,rgb(250,250,250) p1lx=object position x(3) p1lz=object position z(3) position light 1,p1lx,200,p1lz lightangle1#=wrapvalue(angle1#+360) rotate light 1,0,lightangle1#,0 rem handle light 2 p1lx=object position x(2) p1lz=object position z(2) position light 2,p1lx,200,p1lz lightangle2#=wrapvalue(angle2#+360) rotate light 2,0,lightangle2#,0 rem keep players in game! if object position x(3) > 3000 position object 3,1500,0,1500 position camera 0,1500,100,1500 stay1#=60 endif if object position z(3) > 3000 position object 3,1500,0,1500 position camera 0,1500,100,1500 stay1#=60 endif if object position x(3) < 0 position object 3,1500,0,1500 position camera 0,1500,100,1500 stay1#=60 endif if object position z(3) < 0 position object 3,1500,0,1500 position camera 0,1500,100,1500 stay1#=60 endif rem keep player 2 in the game if object position x(2) > 3000 position object 2,1500,0,1500 position camera 2,1500,100,1500 stay2#=60 endif if object position z(2) > 3000 position object 2,1500,0,1500 position camera 2,1500,100,1500 stay2#=60 endif if object position x(2) < 0 position object 2,1500,0,1500 position camera 2,1500,100,1500 stay2#=60 endif if object position z(2) < 0 position object 2,1500,0,1500 position camera 2,1500,100,1500 stay2#=60 endif rem print stay text if stay2# > 0 center text 300,150,"stay in the play zone!" stay2#=stay2# - 1 endif if stay1# > 0 center text 300,350,"stay in the play zone!" stay1#=stay1# - 1 endif rem handle sphere if spherecount#=0 spherex#=rnd(3000) spherez#=rnd(3000) spherecount#=600 endif move object 100,0.1 point object 100,spherex#,0,spherez# spherecount#=spherecount# - 1 rem detect for win if object hit(2,100) and spacekey()=1 win#=1 endif if object hit(3,100) and shiftkey()=1 win#=2 endif if win#=1 and newwin#=0 gosub winner endif if win#=2 and newwin#=0 gosub winner endif print " " print " " print " " print " " if win#=1 print " ",player1name$," kicked ",player2name$,"'s butt. you suck " print " ",player2name$,". now go home and cry like a baby." center text sw2#,sh2#,"hit esc to exit." endif if win#=2 print " ",player2name$," kicked ",player1name$,"'s butt. you suck " print " ",player1name$,". your mom must hate you. I do." center text sw2#,sh2#,"hit esc to exit." endif rem end loop sync loop rem end game winner: number#=6 repeat if object exist(number#) delete object number# endif number#=number# + 1 until number#=50 set ambient light 100 color backdrop 0,rgb(0,0,250) color backdrop 2,rgb(0,0,250) newwin#=1 return |