Rem Project: Adavinor
Rem Created: 2006-03-18 10:35:48
Rem ***** Main Source File *****
sync on : backdrop off : set display mode 1024,768,32
`sync rate 0
rem load world
`remstart
load object "media/ad.x",1
`load object "media/ad_lm.x",2
`ghost object on 2
set object light 1,0
set object collision off 1
load object "media/niebo/sb.x",3
scale object 3,160,160,160
set object cull 3,0
set object light 3,0
set object texture 3,2,1
set object collision off 3
` remend
rem load images
load image "media/adavinor.bmp",1
load image "media/images/hero1.bmp",2,1
`menu()
single()
function menu()
rem change font properities
set text font "endor"
set text size 720
set text to bold
ink rgb(0,64,128),1
rem set a camera to position above gate
position camera -1482,444,-2592
set camera range 1,100000
rotate camera 0,12.5,0
do
rem patste text Adavinor on top of menu
paste image 1,screen width()/2-227,30,1
rem write text to choose
set text size 70 : ink rgb(0,64,128),1 : center text 512,250,"Nowa Gra" : center text 512,350,"Wczytaj Gre" : center text 512,450,"Opcje" : center text 512,550,"Autorzy" : center text 512,650,"Wyjscie"
set text size 100 : ink rgb(0,100,200),1 : center text 512,250,"Nowa Gra" : center text 512,350,"Wczytaj Gre" : center text 512,450,"Opcje" : center text 512,550,"Autorzy" : center text 512,650,"Wyjscie"
set text size 100 : ink rgb(255,255,255),1
rem changing colour when mouse is on text
klik=0
if mousey()>650 and mousey()<750 and mousex()>400 and mousex()<600 then klik=5 : center text 512,650,"Wyjscie"
if mousey()>250 and mousey()<350 and mousex()>400 and mousex()<600 then klik=1 : center text 512,250,"Nowa Gra"
if mousey()>350 and mousey()<450 and mousex()>370 and mousex()<630 then klik=2 : center text 512,350,"Wczytaj Gre"
if mousey()>450 and mousey()<550 and mousex()>430 and mousex()<570 then klik=3 : center text 512,450,"Opcje"
if mousey()>550 and mousey()<650 and mousex()>400 and mousex()<600 then klik=4 : center text 512,550,"Autorzy"
rem change function when you click
if mouseclick()=1
if klik=1 then single()
if klik=2 then load()
if klik=3 then option()
if klik=4 then autor()
if klik=5 then end
endif
` if upkey()=1 then move camera 1
` if downkey()=1 then move camera -1
` if shiftkey()=1 then move camera 10
` rotate camera camera angle x(0)+(mousemovey()/2.0),camera angle y(0)+(mousemovex()/2.0),0
` text 0,0,str$(camera position x())
` text 10,100,str$(camera position y())
` text 10,200,str$(camera position z())
` text 10,300,str$(camera angle x())
` text 10,400,str$(camera angle y())
` text 10,500,str$(camera angle z())
sync
loop
endfunction
function option()
endfunction
function single()
`---------------
`remstart
speed=0
delay=100
frame=11
cell=10
x=0
move=0
load bitmap "media/images/heroes2.bmp",11
set current bitmap 11
for y=0 to 7
` for x=1 to 1
inc cell
get image cell,(x*60+1),(y*60+1),(x*60+60),(y*60+60)
` next
next
delete bitmap 11
`remend
`-----------------
rem Clear screen
hide mouse
` cls
set text size 50
`------------
`-COLLISIONS-
`------------
make object box 1001,50,50,500
` make object collision box 1001,50,50,500,0,0,0,0
yrotate object 1001,30
position object 1001,150,0,200
make object sphere 1002,100
position object 1002,-100,0,-100
rem make a hero
hero=4 : gosub hero
gosub NPC
rem set a camera
xrotate camera 90
position camera 0,1000,0
`-------------
`- main loop -
`-------------
do
talk=0
rem set camera following hero
position camera 0,object position x(hero),camera position y(),object position z(hero)
position object 5,object position x(hero),object position y(5),object position z(hero)
rem rotating hero
yrotate object hero,heroangle
rem hero movement
if upkey()=1
texture object hero,frame
move object hero,3
position camera 0,object position x(hero),camera position y(),object position z(hero)
inc move
if move>5
inc frame
if frame>18 then frame=11
move=0
endif
if object collision(5,0)>0
ax#=object position x(hero)-get object collision x()
ay#=object position y(hero)-get object collision y()
az#=object position z(hero)-get object collision z()
position object hero,ax#,ay#,az#
endif
endif
if downkey()=1
texture object hero,frame
move object hero,-1
position camera 0,object position x(hero),camera position y(),object position z(hero)
inc move
if move>7
inc frame
if frame>18 then frame=11
move=0
endif
if object collision(5,0)>0
ax#=object position x(hero)-get object collision x()
ay#=object position y(hero)-get object collision y()
az#=object position z(hero)-get object collision z()
position object hero,ax#,ay#,az#
endif
endif
if leftkey()=1
dec heroangle,3
yrotate object hero,heroangle
endif
if rightkey()=1
inc heroangle,3
yrotate object hero,heroangle
endif
if upkey()=0 and downkey()=0 then texture object hero,14
`---------
`-TALKING-
`---------
if object collision(5,2002)>0 and shiftkey()=1 then talk=1
select talk
case 1
center text screen width()/2,10,"Witaj!"
endcase
endselect
rem update screen
sync
loop
rem making hero
hero:
make object plain hero,100,100
position object hero,0,10,0
xrotate object hero,-90
fix object pivot hero
texture object hero,14
set object transparency hero,1
set object light hero,0
set object filter hero,1
set object collision off hero
make object sphere 5,75
hide object 5
set object collision to boxes 1001
`set object collision off 5
return
NPC:
make object plain 2001,100,100
position object 2001,-300,10,-500
xrotate object 2001,-90
fix object pivot 2001
texture object 2001,14
set object transparency 2001,1
set object light 2001,0
set object filter 2001,1
set object collision off 2001
make object sphere 2002,75
position object 2002,object position x(2001),0,object position z(2001)
hide object 2002
`set object collision off 2002
return
endfunction