|
|
|
#1 |
|
Junior Member
Join Date: Apr 2007
Posts: 4
|
[Flash 8] Moving the stage possible?
Hi,
Simplified version: Is there a way to move the stage? Long version: I'm working on a vertical scrolling game for a class. It's actually pretty much done (and due soon), so I don't have a lot of time left to work on it, but I do still have a few things to fix and tune. Essentially, we have a tall image that serves as our background, with only a small amount visible at a time. I could only think of 2 ways to achieve this: 1. The stage moves when appropriate, and all other non-stationary objects move independently. 2. The stage doesn't move, but instead the background image and everything other than the main character move in the direction opposite to that which the stage would otherwise move. Now, I think the first option would have been ideal. However, when starting to work on this game, I couldn't find any way to actually move the screen. I googled, I searched on here, and I asked a couple of people who had some (minimal) experience with Flash and Action Script. So I ended up using the second method. It works, but it is a bit sluggish. I couldn't imagine how slow it would be if the levels were twice as long or there were twice as many objects! So, I wish I'd asked this here much earlier, but is there a way to move the stage? It will probably require me to redo quite a few things and is not a make/break thing, so this will be low on my priority list, but I would really like to know for future reference. Oh, and a second question. Is there a way that I can preventing the image of a movieclip from actually rendering (not sure if this is the right terminology)? That is, I want the object to always exist and the object's variables to consistently be accessible (including _x and _y), but when it's not visible (off the stage), there's no point in the object's image actually being there. I imagine I could make things more efficient by doing this. This one I haven't really looked into, but I figured I should ask while I'm posting the other question. Thanks in advance! |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Apr 2007
Posts: 292
|
I think the easiest way would be to put everything except your main character into an array and then adjust the ._x values that way, I think that should work. The other option that I can think of would be to put everything into a seperate movie clip the size of the entire stage, then adjust that movie clip's _x.
Maybe someone else could come up with a better way to do that part, but for your 2nd question, easy. You want the movie clip to be on the stage but not visible right? Just use moveClip._visible = false. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2007
Posts: 4
|
Yeah, that's effectively how it works now. Well, I didn't use an array. It's just a for loop on all objects except the main character. Putting it all into one movieclip is an interesting idea though, I wish I'd thought of that.
Ok, thanks. I figured it would be something simple like that, but will that likely speed things for me? |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Apr 2007
Posts: 292
|
Well if you did that now I'm not sure if it would help later or not since you already have it set up. It all depends on whether you want to add different functions to the game later. Like say a pause or changing difficulty by changing the speed of movement. The only slight problem with this is you'd have to go change your code to suit everything being inside the movie clip.
But anyways, I hope I helped. |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|