0

cell.health -= fighters[0].compDmg(fighters[0],cell)
TypeError: compDmg() takes exactly 2 arguments (3 given)

Both fighters[0] and cell are object instances. How on earth does it see 3 arguments in this? I don't think wider context is needed, but just ask if it is.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by bvdet
0

obj.compDmg(), being a method of fighters[0], will automatically be passed the instance object. In effect, the method receives three arguments in your case. Try this:

cell.health -= fighters[0].compDmg(cell)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.