Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 46 characters in body
Source Link

please don't hesitate to answer or comment

please don't hesitate to answer or comment

added 998 characters in body
Source Link

please anyone help, I am very short on timehave tried to add the function checkIfPlayerMovingIntoWall() to the player and the wall objects, see bellow, but again nothing happened.

function Wall (row,col) { this.row = row; this.col = col; this.color = "#000"; this.width= 25 this.height= 25 this.leftX = this.row; this.rightX = this.row + this.width; this.topY = this.col; this.bottomY = this.col + this.height; } function Player(row, col) { this.isUpKey = false; this.isRightKey = false; this.isDownKey = false; this.isLeftKey = false; this.row = row; this.col = col; this.color = "#f00"; this.width= 25 this.height= 25 this.leftX = this.row; this.rightX = this.row + this.width; this.topY = this.col; this.bottomY = this.col + this.height; } function checkIfPlayerMovingIntoWall() { if (currentPlayer.topY < wall.bottomY && currentPlayer.bottomY > wall.topY && currentPlayer.leftX < wall.rightX && currentPlayer.rightX > wall.leftX) { alert("collision detected"); } } 

please anyone help, I am very short on time

I have tried to add the function checkIfPlayerMovingIntoWall() to the player and the wall objects, see bellow, but again nothing happened.

function Wall (row,col) { this.row = row; this.col = col; this.color = "#000"; this.width= 25 this.height= 25 this.leftX = this.row; this.rightX = this.row + this.width; this.topY = this.col; this.bottomY = this.col + this.height; } function Player(row, col) { this.isUpKey = false; this.isRightKey = false; this.isDownKey = false; this.isLeftKey = false; this.row = row; this.col = col; this.color = "#f00"; this.width= 25 this.height= 25 this.leftX = this.row; this.rightX = this.row + this.width; this.topY = this.col; this.bottomY = this.col + this.height; } function checkIfPlayerMovingIntoWall() { if (currentPlayer.topY < wall.bottomY && currentPlayer.bottomY > wall.topY && currentPlayer.leftX < wall.rightX && currentPlayer.rightX > wall.leftX) { alert("collision detected"); } } 
added 32 characters in body
Source Link

please anyone help, I am very short on time

please anyone help

please anyone help, I am very short on time

deleted 7 characters in body
Source Link
Loading
edited tags
Link
A.J. Uppal
  • 19.3k
  • 7
  • 47
  • 82
Loading
added 27 characters in body
Source Link
Loading
added 7 characters in body
Source Link
Loading
added 49 characters in body
Source Link
Loading
Source Link
Loading