I have an issue with character movement. I've coded the movement so that the background scrolls instead of the character moving (top down view) and when the bg image reaches the edge of the stage it stops and the character starts to move. It does this until it reaches the centre again at which point the image scrolls again. Hope I've explained that well enough. The problem is, when I add boundary checking to stop the character from going out of the screen it works, but the bg image won't scroll anymore. I have provided the code and the fla below and if anyone could help me that would be great.
Actionscript Code:
onClipEvent(load) { //Velocity variables var vy:Number = 0; var vx:Number = 0;
var alive:Boolean = true;
//Width and height variables var playerHalfWidth:Number = (this._width/2) + 14; var playerHalfHeight:Number = (this._height/2) + 8; var bgHalfWidth:Number = _root.bgImage._width/2; var bgHalfHeight:Number = _root.bgImage._height/2;
//Inner boundaries var rightInner:Number = Stage.width; var leftInner:Number = 0; var topInner:Number = 0; var bottomInner:Number = Stage.height;
Used a lot of time trying to solve your problem, but didn't succeed in the end. My conclusion is that the code is poorly constructed as the coherence between the if/else statements is week, and you'll have to re-write your code using another approach. This is as far as I can help you.
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS