if(alive)
{
m.killMonster(); //alive variable in monster class is set to false.
l.addMonster(m.getMPosX(),m.getMPosY());
}
when the program runs, alive is set to true, so doesnt that mean m.killMonster function is also executed and the alive variable is set to false? This is the only place where I am calling this function and it is working but how does it know when to set the variable to false?
There is a lot of code so I cant copy and paste is but if you want to have a look at it then I have uploaded the file here;