PDA

View Full Version : HUD/Movement Help



Checker
August 18th, 2007, 04:45 AM
Im making a birdseye view game and to make a following camera i am moving the entire stage with something like this:


_level0._x -= (_root.guy._x+_root._x-140)/20;
_level0._y -= (_root.guy._y+_root._y-140)/20;it works fine...its all a peach.

cept i have no way of leaving things out...say...a HUD...
i cant think of a way to make it not pan with the stage...

is there anyway to leave certain movie clips out when moving the entire stage?
or is there a good way to make it move properly so those certain movie clips will stay in place?

please, any suggestions

thank you

howling shooter
August 18th, 2007, 07:23 AM
could you give an fla example, maybe i could help

skatataInc
August 19th, 2007, 08:56 PM
could you give an fla example, maybe i could help

Ok instead of moving the stage move a movieclip.
Put the 'ground' into a clip then move that



_root.groundClip._x -= (_root.guy._x+_root._x-140)/20;
_root.groundClip._y -= (_root.guy._y+_root._y-140)/20;


Don't know what the _root._x or _root._y is but if it is refering to the 'ground' clip just change the path

That way the actual screen doesn't move but the clip :)

Checker
August 19th, 2007, 10:46 PM
Ok instead of moving the stage move a movieclip.
Put the 'ground' into a clip then move that



_root.groundClip._x -= (_root.guy._x+_root._x-140)/20;
_root.groundClip._y -= (_root.guy._y+_root._y-140)/20;
Don't know what the _root._x or _root._y is but if it is refering to the 'ground' clip just change the path

That way the actual screen doesn't move but the clip :)

ah but i need the screen to move...
due to enemies, objects, bullets...even the player...
i didnt want to have to move each thing individually...i wanted something efficient
unless you're suggesting putting everything into a movieclip except the hud...but then attaching and duplicating movie clips would become a hassle..and id have to figure out all the targets...

i could add the panning script to every object in the entire game...but that would probably be the most unefficient biggest pain in the a ever...

there's is alot more that will be panning than not panning...

thanks for the suggestion

ajcates
August 20th, 2007, 04:34 AM
wouldn't the character stay in the middle? also you scroll the level and nest the bad-guys, items etc inside it, or you could just multiply the stage movement code by negative one and then move the hud that direction.

Charleh
August 20th, 2007, 05:55 AM
ah but i need the screen to move...
due to enemies, objects, bullets...even the player...
i didnt want to have to move each thing individually...i wanted something efficient
unless you're suggesting putting everything into a movieclip except the hud...but then attaching and duplicating movie clips would become a hassle..and id have to figure out all the targets...


Yes but by adding everything to the root in the 1st place you are attaching movies to another movieclip... (the _root is an mc).

You just need to move a movieclip with everything inside it - instead of using _root just pass in a reference to your 'world' movieclip and use the reference as the target for your attachments instead of _root.

for instance say you have a player class



class Player {
function Player(myWorldMC) {
myWorldMC.attachMovie("PlayerClip", "PlayerClip" + myWorldMC.getNextHighestDepth(), myWorldMC.getNextHighestDepth())
}
}


So you would get your World movieclip or Level or whatever it may be called and call



var p:Player = new Player(Level);