
I have created a dynamic text box with an instance name 'deaths_txt', placed it in a new layer on the main timeline (so that it is displayed on all of my levels/screens), then I went back to the 'initialization' frame where the majority of the code is; this is also where the "//dangerous surfaces" code is. This is where I would presume a counter for the amount of deaths could be made...
the code I added is in Bold
//## Dangerous surfaces
var deaths = 0;
for (i=0; i<mcLevel.fryArray.length; i++){
if ( mcLevel.fryArray[i].hitTestObject( mcLevel.mcPlayer.collisionBox ) ){
//mcLevel.mcPlayer.x = safeSpot.x;
//mcLevel.mcPlayer.y = safeSpot.y;
xMove = 0;
yMove = 0;
grounded = false;
touchingSlope = "not";
dying = true
if(dying == true); {
deaths += 1;
deaths_txt.text = string(""+deaths+"");
}
}
}
My code doesn't work


I have tryed a few variations ALL with the same effect.
Anyone know a solution
please
