Code Monkey home page Code Monkey logo

heart-breaker's Introduction

How to run

Play the game and it starts right away :)

Description


Play with keyboard ← →

  • You have only 2 lives to break all of bricks!

  • The ball becomes faster when the collision between the ball and the paddle.

  • You can turn on BGM by click sound button. The BGM is Hans Zimmer - Main Theme ❤

heart-breaker's People

Contributors

nuyh99 avatar

Watchers

 avatar

heart-breaker's Issues

Collision Issues

There is a critical issue in collision judgment

function detectCollision() { //충돌 조건 세팅
        for (var c = 0; c < brickColumnCount; c++) {
		for (var r = 0; r < brickRowCount; r++) {
			var b = bricks[c][r];
			if (b.status == 1) {
				if(x+ballRadius > b.x && 	     //공의 오른쪽 부분 > 블록의 왼쪽 부분
				   x-ballRadius < b.x+brickWidth &&  //공의 왼쪽 부분 < 블록의 오른쪽 부분
				   y+ballRadius > b.y && 	     //공의 아래쪽 부분 > 블록의 위쪽 부분
				   y-ballRadius < b.y+brickHeight) { //공의 위쪽 부분 < 블록의 아래쪽 부분
					   if(x<b.x || x>b.x+brickWidth){ //공이 블록의 좌측 or 우측에 맞았을 때
						   dx=-dx; //공의 x방향 반전
						   b.status=0;
						   score+=100;
					   }
					   else{ //공이 블록의 위측 or 아래측에 맞았을 때
							dy=-dy; //공의 y방향 반전
							b.status=0;
							score+=100;
					   }
				}
				if(score/100==brickColumnCount*brickRowCount){ //모든 벽돌의 상태가 0일 때 승리
					alert("승리하셨습니다!!!!");
                      	document.location.reload();
				}
			}
		}
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.