Skip to content

marcelfalliere/HTML5-canvas-breakout-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

== HTML5 canvas breakout

This is a rails app just to take advantage of heroku.com as a host. The game is in /public.

== Wants to make a level ?

 - pull the repo on your machine
 - create a .js file "levelA.js"
 - include it in index.html
 - inside your .js file :
 
		function levelA() {
			level_x(A, draw_levelA);
		}

		function draw_levelA() {
			
			// Override initial ball / paddle caracteristics (OPTIONAL)
			paddlex=(WIDTH/2) - (75/2);
			paddleh=10;
			paddlew=75;

			balls_lost = [false];
			x = [400];
			y = [550];
			r = [DEFAULT_BALL_RAYON];
			dx = [1];
			dy = [2.3];
				
			// Destroyable bricks
			briques_x=[0, 0, 0, 0];
			briques_y=[20, 320, 300, 0];
			briques_h= [270, 210, 10, 10];
			briques_w=[800, 800, 800, 800];
			briques_colors=[std_brique_color, std_brique_color, std_brique_color, std_brique_color];
			briques_destroyed=[false, false, false, false];
			
			
			// Indestructible bricks
			unb_briques_x=[0, 0, 0, 0];
			unb_briques_y=[310, 10, 290, 530];
			for(i=0;i<unb_briques_x.length;i++) {
				unb_briques_w[i]=800;
				unb_briques_h[i]=std_brique_h;
				
				switch(i) {
					case 0: unb_briques_lives[i]=10; break;
					case 1: unb_briques_lives[i]=20; break;
					case 3: unb_briques_lives[i]=1; break;
					default: unb_briques_lives[i]=DEFAULT_NB_LIVES; break;
				}
				
				unb_briques_colors[i]=DEFAULT_UNBREAKABLE_COLOR;
				unb_briques_last_impact_ts[i]=(new Date()).getTime();
			}

			// Bonuses
			bonuses_x=[60, 180, 300, 420, 540, 660];
			for(i=0;i<bonuses_x.length;i++) {
				bonuses_x[i]=bonuses_x[i]+40;
				bonuses_used[i]=false;
				bonuses_y[i]=60;
				bonuses_type[i]=FONTAIN_OF_BALL;
				bonuses_finished[i]=false;
			}
			
			// Background images
			images_full_path=["stuck.png"];
			images_x=[500];
			images_y=[40];
			images_loaded=[false];
			
		}

		
	- push your changes
	- I'll take a look and include it
	
It may evolve in the future so it's easier.