|
-
Taking on the world and losing
One problem (of many to come)
Alright, here's the deal:
I'm making a 2d side-scroller type game on flash 8 so I needed to impliment some form of moving camera. It works like this:
___________________
|111111111111111111|
|11111_______11111|
|1111|1111111|11111|
|1111|1110111|11111|
|1111 ---------11111|
----------------------
The 0 represent the player.
1 is blank space
The big square represents the background movieclip (its huge so i can pan it) and the small square is what can be seen when you preview the program (Where the white square is when you being a blank project).
The small square is bordered on each side by black rectangel movieclips which, when in contact with the player when its moving (aka, hitTest and a variable condition), will launch a function.
This function moves the background in the opposite dierection of the player at the same speed as the player so that it appears to be panning.
THe panning works perfectly, but if the background and the player move then, when I change game levels, the focus is lost.
basically this is what happens (using the previous example):
___________________
|111111111111111111|
|11111_______11111|
|1111|1111111|11111|
|1111|1110111|11111|
|1111 ---------11111|
----------------------
before
___________________
|111111111111111111|
|11111111________1|
|11111111|1111111|1|
|11111110|1111111|1|
|11111111----------1|
----------------------
after
So how do I get the camera to snap back to the middle (Where the white square is when you being a blank project)?
P.S: sorry for the complicated model, but it's a complicated problem. Ask me for further clarification if needed.
Last edited by rangast; 10-30-2006 at 06:35 PM.
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
|