to make things more complicated i'm trying to create those objects on a seperate page. it would be more simple to show you what i mean.
i have 3 files.
one file is the page where all the action goes on(html, buttons etc).
i have a php file that houses the object definition and then an instance of that object
and on page 3 i have code that will allow ajax to call a function of the object on button click.
the problem is
for some reason no matter what i try *whether it's creating the object on file one.. or creating it in file two* i can't get the object to echo attributes.
i would post actual code but to be honest it's thousands of lines long. if anyone follows what i presented and can help me discover what the problem is or offer suggestions i would be appreciative.
i keep getting this error
<br /> <b>Fatal error</b>: Call to undefined function dodmg() in <b>/www/uuuq.com/n/i/n/nindoway/htdocs/class_nin.php</b> on line <b>215</b><br />
pertaining to this code:
CODE
function doDmg($target)
{
if($target->currentturn=="defend")
{
if($this->strength >= $target->currentdef)
{
$Dmg=1;
$combo=rand(1,4);
$dmgDone=$combo*$Dmg;
$target->health-=$dmgDone;
echo "Your physical strikes barely do any damage at all.";
checkDeath();
}
else
{
$Dmg=$this->strength-$target->currentdef;
$combo=rand(1,4);
$dmgDone=$combo*Dmg;
$dmgDone /2;
$target->health-=$dmgDone;
echo "You strike your opponent through their guard, doing ".$dmgDone." points of damage. ";
checkDeath();
}
}
else
{
if($this->strength >= $target->currentdef)
{
$Dmg=1;
$combo=rand(1,4);
$dmgDone=$combo*$Dmg;
$target->health-=$dmgDone;
echo "Your physical strikes barely do any damage at all.";
checkDeath();
}
else
{
$Dmg=$this->strength - $target->currentdef;
$combo=rand(1,4);
$dmgDone=$combo*Dmg;
$target->health-=$dmgDone;
echo "You strike your opponent doing ".$dmgDone." points of damage. ";
checkDeath();
}
}
}