1 function theoryline(x1, x2, y1, y2){ 2 this.x1=x1;this.x2=x2;this.y1=y1;this.y2=y2; 3 } 4 5 function theorypoint(x, y){ 6 this.x=x; this.y=y; 7 } 8 9 10 function accDist(a, b){ 11 return Math.sqrt(((a.x-b.x)*(a.x-b.x))+((a.y-b.y)*(a.y-b.y))) 12 } 13 14 function LoadLevel(filename){ 15 blocks = []; 16 balls = []; 17 reload(); 18 var file = OpenFile(filename+".LVL") 19 var numblocks = file.read("numblocks", 0); 20 var i = 0; 21 while(i<numblocks){ 22 //block(x, y, hp, drop, imageorheight, width, color) 23 var bx = file.read("block"+i+"x", 1); 24 var by = file.read("block"+i+"y", 1); 25 var bhp = file.read("block"+i+"hp", 0); 26 var isimage = file.read("block"+i+"isim", 1); 27 28 var imh; 29 var drops = file.read("block"+i+"drop", 0) 30 if(drops==0) {drops=false} 31 else { 32 var dtype = file.read("block"+i+"dtype", "slow") 33 switch(dtype){ 34 case "slow": 35 var deffect = decrementballspeed; 36 break; 37 case "fast": 38 var deffect = incrementballspeed; 39 break; 40 case "unst": 41 var deffect = makeballunstoppable; 42 break; 43 44 45 } 46 var indrop = new drop(bx+32, by+8, 1, LoadImage(file.read("block"+i+"dropim", "bluepowerup")+".tga"),deffect) 47 48 } 49 if(isimage==1){ 50 imh = file.read("block"+i+"im", "redblock")+".tga" 51 blocks.push(new block(bx, by, bhp, drops?indrop:drops, imh)) 52 } 53 else{ 54 imh = file.read("block"+i+"h", 10) 55 w = file.read("block"+i+"w", 0) 56 color = CreateColor(file.read("block"+i+"r", 0), file.read("block"+i+"g", 0), file.read("block"+i+"b", 0), file.read("block"+i+"a", 0)) 57 blocks.push(new block(bx, by, bhp, drops?indrop:drops, imh, w, color)) 58 } 59 i++ 60 } 61 file.close(); 62 63 } 64 65 66 67 function titlescreen(){ 68 while(AreKeysLeft()){GetKey();} 69 var end = false 70 balls.push(new ball(GetScreenWidth()/2, GetScreenHeight()/2, Math.random()*2*Math.PI, 1.5-Math.random(), 0, 16, White)) 71 balls.push(new ball(GetScreenWidth()/2, GetScreenHeight()/2, Math.random()*2*Math.PI, 1.5-Math.random(), 0, 16, White)) 72 balls.push(new ball(GetScreenWidth()/2, GetScreenHeight()/2, Math.random()*2*Math.PI, 1.5-Math.random(), 0, 16, White)) 73 74 while(!end){ 75 76 processBalls(); 77 Rectangle(0,0,GetScreenWidth(), 32, Blue) 78 OutlinedRectangle(2, 2, GetScreenWidth()-3, 29, CreateColor(100,100,100,200)) 79 OutlinedRectangle(1, 1, GetScreenWidth()-3, 29, CreateColor(200,200,200,200)) 80 Line(0, 32, GetScreenWidth(), 32, CreateColor(200,200,200,200)) 81 Line(0, 33, GetScreenWidth(), 33, CreateColor(100,100,100,200)) 82 83 Rectangle(0,GetScreenHeight()-32,GetScreenWidth(), 32, Blue) 84 OutlinedRectangle(2, GetScreenHeight()-30, GetScreenWidth()-3, 29, CreateColor(100,100,100,200)) 85 OutlinedRectangle(1, GetScreenHeight()-31, GetScreenWidth()-3, 29, CreateColor(200,200,200,200)) 86 Line(0, GetScreenHeight()-34, GetScreenWidth(), GetScreenHeight()-34, CreateColor(200,200,200,200)) 87 Line(0, GetScreenHeight()-33, GetScreenWidth(), GetScreenHeight()-33, CreateColor(100,100,100,200)) 88 89 font2.drawText(-15+1+GetScreenHeight()/2, 1+(GetScreenWidth()/2)-(font.getStringWidth("PRESS ANY KEY TO PLAY")/2), "PRESS ANY KEY TO PLAY") 90 font.drawText(-15+GetScreenHeight()/2, (GetScreenWidth()/2)-(font.getStringWidth("PRESS ANY KEY TO PLAY")/2), "PRESS ANY KEY TO PLAY") 91 92 font2.drawText(8, GetScreenHeight()-22, "2012 Flying Jester Entertainment Powered by Sphere Version 0.4") 93 font.drawText(7, GetScreenHeight()-23, "2012 Flying Jester Entertainment Powered by Sphere Version 0.4") 94 95 font2.drawText(101, 11, " Version 0.4 ") 96 font.drawText(100, 10, " Version 0.4 ") 97 98 font2.drawZoomedText(112, 78, 2.3, "Jester's Breakout") 99 font.drawZoomedText(110, 76, 2.3, "Jester's Breakout") 100 FlipScreen(); 101 while(AreKeysLeft()){GetKey(); end = true} 102 while(IsAnyKeyPressed()){} 103 } 104 105 }