Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

c++ 2d rectangle collision

var rect1 = {x: 5, y: 5, width: 50, height: 50}
var rect2 = {x: 20, y: 10, width: 10, height: 10}

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.height + rect1.y > rect2.y) {
    // collision détectée !
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Back button directive Angular 
Javascript :: jlkjl 
Javascript :: finnhub 
Javascript :: javascript loop 2 
Javascript :: validate url in javascript 
Javascript :: how to press enter key automatically using javascript 
Javascript :: how to pass an id to the route of a seprate file react 
Javascript :: relation entre la faune et la flore 
Javascript :: different getters js 
Javascript :: Popup is not working 
Javascript :: convert fetch promise to observable 
Javascript :: compbineReducers from redux 
Javascript :: newline in javascript 
Javascript :: bad request while authenticating locally with passport-local-mongoose stackoverflow 
Javascript :: how to toglle button in viewjs 
Javascript :: google script isnan 
Javascript :: js rgba to hex 
Javascript :: angular escape style attr 
Javascript :: js regex replace unsafe regex 
Javascript :: scope hierarchy in angularjs 
Javascript :: AngularJS module can be created using ............ A. module.create(); B.angular.create(); C.angular.module(); D.var myModule = new module(); 
Javascript :: fastselect clear select 
Javascript :: validate date 
Javascript :: how to use variable key as dictionary key in javascript 
Javascript :: DeleteAsync 
Javascript :: array object sort by date 
Javascript :: https://web.roblox.com/users/20732870/profile 
Javascript :: amazing js hacls prank 
Javascript :: ip address pattern regex javascript 
Javascript :: runjs 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =