T
T
Triborg-3332019-08-29 01:12:58
JavaScript
Triborg-333, 2019-08-29 01:12:58

Uncaught TypeError: Cannot read property 'x' of undefined Collision check. How to solve the problem?

Uncaught TypeError: Cannot read property 'x' of undefined Collision check. How to solve the problem ?
here is the game. The Game itself
Check for clash of swords, with doge.

Game.prototype.update = function(){
  for(let i = 0; i < this.doges.length; i++){
  	for(let i = 0; i < this.sword_right.length; i++){
  		if(Math.abs(this.doges[i].x+50-this.sword_right[i].x)< 50 && Math.abs(this.doges[i].y+-this.sword_right[i].y)<50){
  			this.doges.splice(i,1);
  			break;
  		}
  	}
  }
}

Help me please. Maybe I'm doing the check wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question