Hi every1,
I have an error that is really buggin me ! You know error # 1009 - null object refernece (Somthing like that ne way!) I debugged it and the lines in quotes are the 1’s giving errors. Here is the code:
// scroll to the right or left if needed
public function scrollWithHero(){
var stagePosition:Number = gamelevel.x+hero.mc.x;
var rightEdge:Number = stage.stageWidth-edgeDistance;
var leftEdge:Number = edgeDistance;
if (stagePosition > rightEdge) {
gamelevel.x -= (stagePosition-rightEdge);
if (gamelevel.x < -(gamelevel.width-stage.stageWidth)) gamelevel.x = -(gamelevel.width-stage.stageWidth);
}
if (stagePosition < leftEdge) {
gamelevel.x += (leftEdge-stagePosition);
if (gamelevel.x > 0) gamelevel.x = 0;
}
}
And this is the other piece of code:
// perform all game tasks
public function gameLoop(event:Event) {
// get time differentce
if (lastTime == 0) lastTime = getTimer();
var timeDiff:int = getTimer()-lastTime;
lastTime += timeDiff;
// only perform tasks if in play mode
if (gameMode == “play”) {
moveCharacter(hero,timeDiff);
moveEnemies(timeDiff);
checkCollisions();
scrollWithHero();
}
}
I really dont get why its giving this as I have code so that when the character gets 90 points to goto frame 4 and this error pops up then. Ne ideas what the problem is ???
Thanks in advanve