-
Center my Player, and let it walk on the Background?
Hello,
well I am starting with Flash right now. Everything seems to be easy so far. However, I am stuck right now.
I have a fairly large background and I have a character that is able to move freely. When I move him he always goes out of the screen. What I want is that the character is moving on the background.
I have seen some solutions, but they all fix the player onto the stage and let the background move. I do not like this kind of approach, because it might bad for expanding the program.
How can I accomplish that my character is moving on the background, while the background is fixed and not moving?
To let the character move I have this so far
Code:
public function loop(e:Event):void
{
checkKeypresses(); //function that checks if a key was pressed
if(leftPressed){
x -= speed;
}else if(rightPressed){
x += speed;
}
if(upPressed){
y -= speed;
} else if(downPressed){
y += speed
}
}
Do you now what I mean?
ThankYou
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|