8sj E-?4 dd ( @ (//(  0/80@0?/8 0( ?G@POWOXOP?H0@/7@O_``h_hPX 0(P_oppxow_g@O/8'' 7p`o?G/7 0??H/8`/o?GOX@H0?/pOW?H/8 7OP?G/7( P0@PX@O0@ 0O @H/@' 00@@P0?'_OP@H( 7/7' ^^^^^^^^^^^^^^^^^^^^^^^^^^TeeBBBBeTT^^^^^^^eBDJ33333JJDBeZ^^^^TD33==#####==3JDBT^^^^eJ=###=3DeZ^^TB3# #=3JBZ^^T3#  #=JBT^^J# Sll #=JBZ^T# %,68??86,/@A*< ##45('.6787-9%:;*<=#$+&,--.,/01)2 3 $%&&'%($!)* ##  !"#     ??d\@script0E//One Script Breakout // //By Dreamisle // //Last Modified Nov. 23 // ////////////////////////////// //SCORE = 0 - SETUP if (score = 0) { //room setup font_style = fs_bold room_caption = 'Breakout Revisited'; show_score = false; room_speed = 30; screen_height = 500; screen_width = 640; background_color = c_black; //high score array setup hs_num = 5; hs_hi = 0; for (i=0; i 630) { xspeed = -(xspeed); } if (ballx > 650) or (ballx < -10) { xspeed = 5; yspeed = -5; ballx = 330; bally = 280; } if (bally > 470) { if shield { bally = 10; } else { lives -= 1; ballx = 330; bally = 430; xspeed = 5; yspeed = -5 paddlex = 330; pw = 30; pupy = 1; firecount = 0; shieldcount = 0; } } if ((bally > 440 ) && (ballx >= paddlex-pw) && (ballx <= paddlex+pw)) { yspeed = -(yspeed); xspeed = (random(1) + 2) * sign(ballx - paddlex) * (abs(ballx - paddlex) / 5); } //UFO 1 movement/collision br1x = br1x + xspeed1 br1y = 150 + sin(br1x/(xspeed1 * 4))*5 if (br1x < 20 ) or (br1x > 620 ) { xspeed1 = -(xspeed1) } if ((bally >= br1y - 10) && (bally <= br1y + 10) && (ballx >= br1x-29) && (ballx <= br1x+29) && (br1 = true)) { if not fire { yspeed = -(yspeed); } hits += 1; br1 = false; if si_enabled = true and space = false { space = true; si_x = ballx; si_y = br1y - 25; } } //UFO 2 movement/collision br2x = br2x + xspeed2 br2y = 210 + sin(br2x/(xspeed2 * 4))*5 if (br2x < 20 ) or (br2x > 620 ) { xspeed2 = -(xspeed2) } if ((bally >= br2y - 10) && (bally <= br2y + 10) && (ballx >= br2x-29) && (ballx <= br2x+29) && (br2 = true)) { if not fire { yspeed = -(yspeed); } hits += 1; br2 = false; if si_enabled = true and space = false { space = true; si_x = ballx; si_y = br2y - 25; } } //space invader movement/collision if space = true { si_move += 1; if si_move = 5 { si_move = 0; si_x = si_x + si_dir; if (si_x >= 620 and si_dir = 15) or (si_x <= 20 and si_dir = -15) { si_dir = -(si_dir); si_y += 30; } if si_y >= paddley { space = false; } } if ((bally >= si_y - 9) && (bally <= si_y + 9) && (ballx >= si_x - 9) && (ballx <= si_x + 9)) { space = false; hits += 1; if not fire { yspeed = -(yspeed); } } } //life brick collision if ((bally >= 235 ) && (bally <= 245 ) && (ballx >= brlifex-39) && (ballx <= brlifex+39) && (brlife = true)) { lives += 1; hits += 1; brlife = false; if not fire { yspeed = -(yspeed); } } //normal brick collision cx = -1; if (ballx >= 156) && (ballx <= 229) { cx = 0; } if (ballx >= 281) && (ballx <= 359) { cx = 1; } if (ballx >= 406) && (ballx <= 484) { cx = 2; } cy = -1; if (bally >= 25) && (bally <= 35) { cy = 0; } if (bally >= 55) && (bally <= 65) { cy = 1; } if (bally >= 85) && (bally <= 95) { cy = 2; } if (bally >= 115) && (bally <= 125) { cy = 3; } if (bally >= 175) && (bally <= 185) { cy = 4; } if cx >= 0 and cy >= 0 { if brick[cy,cx] = true { hits += 1; brick[cy,cx] = false; pupcheck = true; if not fire { yspeed = -(yspeed); } } } //Powerup Creation if pupcheck { pupcheck = false; if not powerup { powerup = floor(random(2)); puptype = floor(random(7)); pupx = random(470) + 15; } } //Powerup Movement and Use if powerup { pupy = pupy * 1.05; if pupy >= 450 { powerup = false; pupy = 1; if puptype = 6 { puptype = floor(random(6)); } if (pupx < paddlex+pw) and (pupx > paddlex-pw) { if puptype = 0 and pw >= 5 { pw = pw - 5; } if puptype = 1 and pw <= 60 { pw = pw + 5; } if puptype = 2 { lives += 1; } if puptype = 3 { fire = true; firecount += 500; } if puptype = 4 { shield = true; shieldcount += 500; } if puptype = 5 { hits += 20 } } } } //Fireball Time if fire { firecount -= 1; if firecount <= 0 { fire = false; } } if shield { shieldcount -= 1; if shieldcount <= 0 { shield = false; } } //Paddle Movement if (keyboard_check(vk_left)) and not mouse { paddlex -= 9; } if (keyboard_check(vk_right)) and not mouse { paddlex += 9; } if (keyboard_check(vk_space)) { mouse = not mouse; keyboard_clear(vk_space); } if mouse { paddlex = paddlex + ((mouse_x - paddlex)/5); } if mouse_check_button(mb_right) { mouse = not mouse; mouse_clear(mb_right); } //Pause if mouse_check_button(mb_left) or keyboard_check(vk_control) { io_clear() score = 3; } //End Game if (lives <= 0) { frommenu = false; score = 4; } //Board Cleared endcheck = 0; for (i=0; i<5; i+=1) { for (j=0; j<3; j+=1) { if brick[i,j] = true { endcheck = true; } } } if (endcheck = false) and (br1 == false) and (br2 == false) and (brlife == false) { for (i=0; i<5; i+=1) { for (j=0; j<3; j+=1) { brick[i,j] = true; } } br1 = true; br2 = true; brlife = true; room_speed = room_speed + 5; } } //SCORE = 1, 2, or 3 - Draw Paddle/Bricks if score = 1 or score = 2 or score = 3 { //draw paddle pen_color = c_white; brush_color = c_blue; draw_rectangle(paddlex-(pw-10),paddley,paddlex+(pw-10),paddley+10); pen_color = c_white; brush_color = c_black; draw_circle(paddlex+(pw-10),paddley+5,6); draw_circle(paddlex-(pw-10),paddley+5,6); //draw standard bricks for (i=0; i<5; i+=1) { for (j=0; j<3; j+=1) { if brick[i,j] = true { curx = j * 125; cury = i * 30; if cury >= 120 { cury = 150; } pen_color = c_white; brush_color = make_color(0,i*63,j*127); draw_rectangle(165 + curx,25 + cury,225 + curx,35 + cury); } } } } //SCORE = 2 or 3 - Draw if score = 2 or score = 3 { //draw score/caption font_align = fa_left; font_color = c_white; font_size = 9; if score = 2 { if mouse = true { message = 'Mouse (space bar or right click to change) / Click or Ctrl Key to Pause'; } else { message = 'Arrow Keys (space bar or right click to change) / Click or Ctrl Key to Pause'; } } else { message = 'PAUSED / Click or Ctrl Key to Continue'; } draw_text(10,467,'Hits: ' +string(hits) +' / Lives: ' +string(lives) +' / Level:' +string((room_speed-25)/5)); draw_text(10,482,'Mode: ' +string(message)); font_align = fa_right; font_color = c_yellow; if fire { draw_text(630,467,'Fire: ' +string(firecount div 10)); } font_color = c_aqua; if shield { draw_text(630,482,'Save: ' +string(shieldcount div 10)); } //draw ball if fire { pen_color = make_color(255,255,0); brush_color = make_color(255,0,0); } else { pen_color = c_white; brush_color = c_white; } brush_style = bs_solid; draw_circle(ballx,bally,5); if shield { pen_color = c_aqua; brush_style = bs_hollow; } draw_circle(ballx,bally,(shieldcount/25)+5); brush_style = bs_solid; //draw powerup if (powerup == true) { if puptype = 0 { pen_color = c_red; brush_color = c_red; draw_triangle(pupx-1,pupy,pupx-5,pupy+4,pupx-5,pupy-4); draw_triangle(pupx+1,pupy,pupx+5,pupy+4,pupx+5,pupy-4); } if puptype = 1 { pen_color = c_lime; brush_color = c_lime; draw_triangle(pupx-5,pupy,pupx-1,pupy+4,pupx-1,pupy-4); draw_triangle(pupx+5,pupy,pupx+1,pupy+4,pupx+1,pupy-4); } if puptype = 2 { pen_color = c_red; brush_color = c_red; draw_rectangle(pupx-1,pupy-5,pupx+1,pupy+5); draw_rectangle(pupx-5,pupy-1,pupx+5,pupy+1); } if puptype = 3 { pen_color = c_yellow; brush_color = c_red; draw_circle(pupx,pupy,5); } if puptype = 4 { pen_color = c_aqua; brush_color = c_navy; draw_circle(pupx,pupy,5); } if puptype = 5 { font_color = c_lime; draw_text(pupx-8,pupy-3,'20'); } if puptype = 6 { font_color = c_yellow; draw_text(pupx-3,pupy-3,'?'); } } //draw life brick if (brlife == true) { pen_color = c_white; brush_color = c_white; draw_rectangle(brlifex-30,brlifey-5,brlifex+30,brlifey+5); pen_color = c_red; brush_color = c_red; draw_rectangle(brlifex-1,brlifey-3,brlifex+1,brlifey+3) ; draw_rectangle(brlifex-3,brlifey-1,brlifex+3,brlifey+1); } //draw UFOs if (br1 == true) { pen_color = c_white; brush_color = c_gray; draw_ellipse(br1x-20,br1y-5,br1x+20,br1y+5); pen_color = c_yellow; brush_color = c_yellow; draw_ellipse(br1x-3,br1y-2,br1x+3,br1y+2); draw_ellipse(br1x-11,br1y-2,br1x-8,br1y+2); draw_ellipse(br1x+11,br1y-2,br1x+8,br1y+2); draw_circle(br1x,br1y,2); draw_circle(br1x-8,br1y,2); draw_circle(br1x+8,br1y,2); } if (br2 == true) { pen_color = c_white; brush_color = c_gray; draw_ellipse(br2x-20,br2y-5,br2x+20,br2y+5); pen_color = c_yellow; brush_color = c_yellow; draw_ellipse(br2x-3,br2y-2,br2x+3,br2y+2); draw_ellipse(br2x-11,br2y-2,br2x-8,br2y+2); draw_ellipse(br2x+11,br2y-2,br2x+8,br2y+2); draw_circle(br2x,br2y,2); draw_circle(br2x-8,br2y,2); draw_circle(br2x+8,br2y,2); } //draw space invader if (space = true) { pen_color = c_lime; brush_color = c_black; draw_circle(si_x + 5, si_y + 4, 8) pen_color = c_lime; brush_color = c_lime; //horizontal lines draw_line(si_x + 2,si_y,si_x + 8, si_y) draw_line(si_x + 2,si_y + 1,si_x + 8, si_y + 1) draw_line(si_x + 2,si_y + 4,si_x + 8, si_y + 4) draw_line(si_x + 2,si_y + 5,si_x + 8, si_y + 5) //vertical lines draw_line(si_x,si_y + 2,si_x, si_y + 7) draw_line(si_x + 1,si_y + 2,si_x + 1, si_y + 7) draw_line(si_x + 4,si_y + 2,si_x + 4, si_y + 7) draw_line(si_x + 5,si_y + 2,si_x + 5, si_y + 7) draw_line(si_x + 8,si_y + 2,si_x + 8, si_y + 7) draw_line(si_x + 9,si_y + 2,si_x + 9, si_y + 7) } } //SCORE = 3 - Paused Game if score = 3 { //draw store options pen_color = c_white; brush_color = c_black; draw_rectangle(10,260,630,400) font_align = fa_left; font_color = c_white; font_size = 9; draw_text(20,270,'Key'); draw_text(55,270,'Price'); draw_text(125,270,'Item'); draw_line(20,283,620,283); draw_text(20,285,'Q'); draw_text(55,285,'100'); draw_text(125,285,'Extra Life'); draw_text(20,300,'W'); draw_text(55,300,'75'); draw_text(125,300,'50+ Shield'); draw_text(20,315,'E'); draw_text(55,315,'75'); draw_text(125,315,'50+ Fireball'); if si_enabled = false { draw_text(20,330,'R'); draw_text(55,330,'50'); draw_text(125,330,'Space Invader'); } draw_text(20,360,'Z/C'); draw_text(55,360,'Free'); draw_text(125,360,'Change \# of HS Slots - Currently ' +string(hs_num)); //check input for store if keyboard_key = ord('Q') { io_clear(); if hits >= 100 { hits -= 100; lives += 1; } } if keyboard_key = ord('W') { io_clear(); if hits >= 75 { hits -= 75; shield = true; shieldcount += 500; } } if keyboard_key = ord('E') { io_clear(); if hits >= 75 { hits -= 75; fire = true; firecount += 500; } } if keyboard_key = ord('R') { io_clear(); if hits >= 50 { hits -= 50; si_enabled = true; } } if keyboard_key = ord('C') and hs_num < 10 { io_clear(); hs_num += 1; } if keyboard_key = ord('Z') and hs_num > 3 { io_clear(); hs_num -= 1; } //check input if mouse_check_button(mb_left) or keyboard_check(vk_control) { io_clear(); score = 2; } } //SCORE = 4 - Highscore Load from File if score = 4 { //Read from file if file_exists('breakout.txt') { file_open_read('breakout.txt'); file_readln(); for (i=0; i hs[2,1] { score = 5; } else { score = 7; } } //SCORE = 5 - Enter Name for Highscore if score = 5 { //draw text font_align = fa_left; font_color = c_white; font_size = 9; draw_text(10,2,'Enter Your Name - Press Enter or Left Click to Continue'); draw_text(10,482,keyboard_string + '_'); //check for input if keyboard_lastchar = '#' { keyboard_key_press(vk_backspace); } if mouse_check_button(mb_left) or keyboard_check(vk_enter) { keyboard_clear(vk_enter); mouse_clear(mb_left); score = 6; } } //SCORE = 6 - Replace highscores with new if score = 6 { //switch spots depending on new score newhs = string(keyboard_string) for (i=0; i hs[i,1] { for (j=hs_num-1; j>i; j-=1) { for (k=0; k<3; k+=1) { hs[j,k] = hs[j-1,k]; } } hs[i,0] = newhs; hs[i,1] = hits; hs[i,2] = (room_speed-25)/5; hits = 0; } } //rewrite the file file_open_write('breakout.txt'); file_write_real(hs_num); file_writeln(); for (i=0; i