Rem ***** Main Source File ***** REM F08, mindesign entertainment Rem ***** Includes ***** #Include "Includes/builder.dba" Rem ******************** Rem ***** ***** Inicializálás ***** ***** Rem Autocam off Hide Mouse Sync On : Sync Rate 60 Rem ***** ***** ***** ***** ***** ***** Rem ///// ///// Globális változók Rem TPS Sugár Global TPS_R As Float : TPS_R=30 Rem Karakter Global Karakter As Integer : Karakter=FreeObject() Rem Alapok Global Alap As Integer : Alap=FreeObject()+100 Rem Ugrás változók Global MaxY# as Float : MaxY#=5.0 Global SzintY# as Float : SzintY#=MaxY#-0.3 Global DeltaY# as Float : DeltaY#=0.1 Global Jump as Boolean : Jump=0 Global yPuffer# as Float Global Mozgas$ : Mozgas$="elore" Rem Builder DIM map(1000,1000) as byte Global done as boolean Rem Globális változók \\\\\ \\\\\ Rem Debug Matrix Make matrix 1,100,100,25,25 Rem TPS Kamera Global Self As Integer : Self=1 Make object cube Self,10 : Hide object Self Rem Karakter Betöltése Make object box Karakter, 5,10,5 Rem Alapok betölése Make object box Alap,15,5,15 Hide object Alap Rem Pálya betöltése Build_Map(20) Rem Main Loop Do Rem Alprogramok meghívása Gosub Control_Karakter Gosub Control_Camera Gosub Debug Rem Képernyő frissítés Sync Loop Rem Kamera kezelő alprogram Control_Camera: Rem Egér Rotate object Self, Object Angle X(Self)+MouseMoveY(),Object Angle Y(Self)+MouseMoveX(),0 Rem Debug If Object Angle X(Self)<10 then xRotate Object Self,10 If Object Angle X(Self)>50 then xRotate Object Self,50 If Object Angle Y(Self)>360 then yRotate Object Self,0 If Object Angle Y(Self)<0 then yRotate Object Self,360 Rem Asszimilálódás Position camera Object Position X(Self),Object Position Y(Self)+yPuffer#,Object Position z(Self) Rotate camera Object Angle X(Self),Object Angle Y(Self),Object Angle Z(Self) Rem Sugár Move camera TPS_R*(-1) Return Rem Karakter kezelő alprogram Control_Karakter: Rem Karakter mozgatása If not jump Mozgas$="" If keystate(17) Move object Karakter,0.5 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="elore" Endif If keystate(31) Move object Karakter,-0.5 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="hatra" Endif If keystate(32) yRotate object Karakter,Object Angle Y(Karakter)+90 Move object Karakter,0.5 yRotate object Karakter,Object Angle Y(Karakter)-90 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="jobbra" Endif If keystate(30) yRotate object Karakter,Object Angle Y(Karakter)-90 Move object Karakter,0.5 yRotate object Karakter,Object Angle Y(Karakter)+90 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="balra" Endif Rem Srég If keystate(17) and keystate(32) then Mozgas$="jobbfel" If keystate(17) and keystate(30) then Mozgas$="balfel" If keystate(31) If keystate(32) then Mozgas$="jobble" If keystate(30) then Mozgas$="balle" Endif Rem Mozgás vége Endif Rem Ugrás If spacekey() then Jump=1 If Jump If Mozgas$="elore" then Move object Self,0.5 If Mozgas$="hatra" then Move object Self,-0.5 If Mozgas$="balra" yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif If Mozgas$="jobbra" yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="balfel" Rem Fel Move object Self,0.5 Rem Balra yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif If mozgas$="jobbfel" Rem Fel Move object Self,0.5 Rem Jobbra yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="jobble" Rem Fel Move object Self,-0.5 Rem Jobbra yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="balle" Rem Fel Move object Self,-0.5 Rem Balra yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif yPuffer#=(yPuffer#+(MaxY#-yPuffer#)*DeltaY#) If yPuffer#>=SzintY# and DeltaY#>0 then DeltaY#=(-1)*DeltaY# If yPuffer#<=0.005 and DeltaY#<0 Jump=0 DeltaY#=DeltaY#*(-1) yPuffer#=0 Endif Endif Rem Karakter szink Position Object Karakter, Object Position X(Self),yPuffer#,Object Position Z(Self) Position Object Self, Object Position X(Self),0,Object Position Z(Self) yRotate Object Karakter, Object Angle Y(Self) Return Rem Debug Debug: Set Cursor 1,1 Print "xAngle: ",Object Angle X(Self) Print "yAngle: ",Object Angle Y(Self) Print "FPS: ",Screen FPS() Print Jump Print "Y ",yPuffer# Print "DeltaY ",DeltaY# Print Object Position Y(Self) Print Mozgas$ Return Rem ********** Függvények ********** Rem BuildMap Function Build_Map(elemszam as integer) Randomize timer() done=0 map(50,50)=1 map(49,50)=1 kirak(49,50,2,elemszam) For n=1 to 1000 For m=1 to 1000 If map(n,m)>0 temp=FreeObject() Clone object temp,Alap Position object temp,m*17,0,n*17 Endif Next m Next n Endfunction Rem FreeObject Function FreeObject() I=1 Repeat I=I+1 Until Object Exist(I)=0 Endfunction I Rem ********************************Rem 0:le,1:jobbra,2:fel,3:balra} Rem 0:lentről,1:jobbról,2:fentről,3:balról} DIM map(1000,1000) as byte Global done as boolean Set text font "Arial" Set text size 7 randomize timer() done=0 map(50,50)=1 map(49,50)=1 kirak(49,50,2,200) Rem Main Do cls For w=0 to 80 For v=0 to 120 Print map(w,v)," "; Next v Print " " Next w Sync Loop Function kirak(x as integer,y as integer,honnan as integer,van_meg as integer) Rem Locális deklarációk Local DIM mehet(3) as boolean i as integer uj_x as integer uj_y as integer tempx as integer tempy as integer irany as integer jo as boolean Rem Begin Rem fillchar(mehet,sizeof(mehet),true); For t=0 to 3 mehet(t)=1 Next t tempx=x tempy=y Select honnan Case 0 mehet(2)=0 tempx=x-1 endcase Case 1 mehet(3)=0 tempy=y-1 endcase Case 2 mehet(0)=0 tempx=x+1 endcase Case 3 mehet(1)=0 tempy=y+1 endcase Endselect i=0 while done=0 and (i<=2) Rem begin map(x,y)=0 irany=RND(3) while mehet(irany)=0 irany=RND(3) endwhile mehet(irany)=0 uj_x=x uj_y=y Select irany Case 0 uj_x=x+1 endcase Case 1 uj_y=y+1 endcase Case 2 uj_x=x-1 endcase Case 3 uj_y=y-1 endcase endselect jo=1 if map(uj_x,uj_y)=1 then jo=0 if (map(uj_x-1,uj_y)=1) then jo=0 if (map(uj_x,uj_y-1)=1) then jo=0 if (map(uj_x+1,uj_y)=1) then jo=0 if (map(uj_x,uj_y+1)=1) then jo=0 map(tempx,tempy)=0 if (map(uj_x+1,uj_y+1)=1) then jo=0 if (map(uj_x+1,uj_y-1)=1) then jo=0 if (map(uj_x-1,uj_y+1)=1) then jo=0 if (map(uj_x-1,uj_y-1)=1) then jo=0 map(tempx,tempy)=1 if jo Rem begin map(uj_x,uj_y)=1 if van_meg=0 Rem begin map(x,y)=1 done=1 else map(x,y)=1 kirak(uj_x,uj_y,irany,van_meg-1) endif endif inc i endwhile if done=0 Rem begin map(x,y)=0 endif Endfunction Remstart procedure kiir; var f:text; i,j:integer; temp:string[101]; begin assign(f,'ki.ki'); rewrite(f); for i:=0 to 100 do begin temp:=''; for j:=0 to 100 do begin if map[i,j]=1 then begin temp:=temp+'X'; end else begin temp:=temp+' '; end; end; writeln(f,temp); end; close(f); end; begin randomize; done:=false; map[50,50]:=1; map[49,50]:=1; kirak(49,50,2,200); kiir; end. Remend [COMMON] PathToEXE=D:\temp\Projects\f08\CrashOn_09_26_08.txt [CEXE] m_dwRuntimeErrorDWORD=Internal Code:12002 m_dwRuntimeErrorLineDWORD=1042 Rem ***** Included Source File ***** REM KIDA BETEG KONSZEPTJE Rem Inicializálás Rem Autocam off Hide Mouse Sync On : Sync Rate 60 Rem Globális változók Rem TPS Sugár Global TPS_R As Float : TPS_R=30 Rem Karakter Global Karakter As Integer : Karakter=FreeObject() Rem Ugrás változók Global MaxY# as Float : MaxY#=5.0 Global SzintY# as Float : SzintY#=MaxY#-0.3 Global DeltaY# as Float : DeltaY#=0.1 Global Jump as Boolean : Jump=0 Global yPuffer# as Float Global Mozgas$ : Mozgas$="elore" Rem Debug Matrix Make matrix 1,100,100,25,25 Rem TPS Kamera Global Self As Integer : Self=1 Make object cube Self,10 : Hide object Self Rem Karakter Betöltése Make object box Karakter, 5,10,5 Rem Main Loop Do Rem Alprogramok meghívása Gosub Control_Karakter Gosub Control_Camera Gosub Debug Rem Képernyő frissítés Sync Loop Rem Kamera kezelő alprogram Control_Camera: Rem Egér Rotate object Self, Object Angle X(Self)+MouseMoveY(),Object Angle Y(Self)+MouseMoveX(),0 Rem Debug If Object Angle X(Self)<10 then xRotate Object Self,10 If Object Angle X(Self)>50 then xRotate Object Self,50 If Object Angle Y(Self)>360 then yRotate Object Self,0 If Object Angle Y(Self)<0 then yRotate Object Self,360 Rem Asszimilálódás Position camera Object Position X(Self),Object Position Y(Self)+yPuffer#,Object Position z(Self) Rotate camera Object Angle X(Self),Object Angle Y(Self),Object Angle Z(Self) Rem Sugár Move camera TPS_R*(-1) Return Rem Karakter kezelő alprogram Control_Karakter: Rem Karakter mozgatása If not jump Mozgas$="" If keystate(17) Move object Karakter,0.5 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="elore" Endif If keystate(31) Move object Karakter,-0.5 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="hatra" Endif If keystate(32) yRotate object Karakter,Object Angle Y(Karakter)+90 Move object Karakter,0.5 yRotate object Karakter,Object Angle Y(Karakter)-90 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="jobbra" Endif If keystate(30) yRotate object Karakter,Object Angle Y(Karakter)-90 Move object Karakter,0.5 yRotate object Karakter,Object Angle Y(Karakter)+90 Position Object Self, Object Position X(Karakter),Object Position Y(Self),Object Position Z(Karakter) If not jump then Mozgas$="balra" Endif Rem Srég If keystate(17) and keystate(32) then Mozgas$="jobbfel" If keystate(17) and keystate(30) then Mozgas$="balfel" If keystate(31) If keystate(32) then Mozgas$="jobble" If keystate(30) then Mozgas$="balle" Endif Rem Mozgás vége Endif Rem Ugrás If spacekey() then Jump=1 If Jump If Mozgas$="elore" then Move object Self,0.5 If Mozgas$="hatra" then Move object Self,-0.5 If Mozgas$="balra" yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif If Mozgas$="jobbra" yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="balfel" Rem Fel Move object Self,0.5 Rem Balra yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif If mozgas$="jobbfel" Rem Fel Move object Self,0.5 Rem Jobbra yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="jobble" Rem Fel Move object Self,-0.5 Rem Jobbra yRotate object Self,Object Angle Y(Self)+90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)-90 Endif If mozgas$="balle" Rem Fel Move object Self,-0.5 Rem Balra yRotate object Self,Object Angle Y(Self)-90 Move object Self,0.5 yRotate object Self,Object Angle Y(Self)+90 Endif yPuffer#=(yPuffer#+(MaxY#-yPuffer#)*DeltaY#) If yPuffer#>=SzintY# and DeltaY#>0 then DeltaY#=(-1)*DeltaY# If yPuffer#<=0.005 and DeltaY#<0 Jump=0 DeltaY#=DeltaY#*(-1) yPuffer#=0 Endif Endif Rem Karakter szink Position Object Karakter, Object Position X(Self),yPuffer#,Object Position Z(Self) Position Object Self, Object Position X(Self),0,Object Position Z(Self) yRotate Object Karakter, Object Angle Y(Self) Return Rem Debug Debug: Set Cursor 1,1 Print "xAngle: ",Object Angle X(Self) Print "yAngle: ",Object Angle Y(Self) Print "FPS: ",Screen FPS() Print Jump Print "Y ",yPuffer# Print "DeltaY ",DeltaY# Print Object Position Y(Self) Print Mozgas$ Return Rem ********** Függvények ********** Rem FreeObject Function FreeObject() I=1 Repeat I=I+1 Until Object Exist(I)=0 Endfunction I Rem ********************************