Hi All,
I'm building a game using the joomla and mootools frameworks.
I was originally using the following php script to parse values into
javascript and it worked fine for the past year. But now I've decided to
tidy things up and catch the 8*8 grid via a json call instead. The code is
here http://jsfiddle.net/Techbot/3TVfb/1/
My problem is MoveRight() won't run unless MoveLeft() is called first. This
doesn't make sense - both functions are identical except for increments
instead of decrements. I get cell[PosX +1] is not defined (why not
cell[PosX + 1][PosY]??) if I call MoveRight() first, but if I call
MoveLeft() then MoveRight() everything gets defined. I've been stuck on
this for days now.
<?php
for ($y=0; $y <= 7 ; $y++) {
$name='row'.$y;
$arr[$y] = explode(",",($this->row->$name));
$x = 0;
foreach ($arr[$y] as $row){
?>
<script type='text/javascript'>
cell[<?php echo $x ;?>][<?php echo $y ;?>]=<?php echo $row ; ?>;
</script>
<?php
$x= $x+1;
}
}
?>
Any ideas as to what I am missing?
--
Rob & Lisa - EMC23
083 416 0618
<http://goog_1827821969>[email protected]
www.emc23.com