PDA

View Full Version : [AS2] Movie clip movement(rpg game)


cdrake
09-16-2004, 03:22 AM
My guy moves across the board then he hits the edge of the screen and it takes him to the next frame, which is the next section of the map which works out great. When he walks into the score I want him to go away, but you can still run the guy around.

I cant use _root.bob.unloadMovie(); because then he is removed fromt he whole game. I just want him to be off that one frame then when you click leave he comes back.

cdrake
09-16-2004, 03:26 AM
I can change his alpha to 0 but you can still move him around.

madgett
09-16-2004, 03:37 AM
Disable him, then turn him invisible:


_root.bob.enabled = false;
_root.bob._visible = false;


Then do just the opposite when the user clicks the leave button.

farafiro
09-16-2004, 08:24 AM
yup,as madgett said u r after the visibilty not the alpha

cdrake
09-16-2004, 09:26 PM
_root.bob.enabled = false;
_root.bob._visible = false;

They guy does go away, but you can still move him around.

When you click to leave it takes you back to frame 2 so I put this to bring him back, but it doesnt work.

_root.bob.enabled = true;
_root.bob._visible = true;

madgett
09-16-2004, 09:39 PM
The reason he is still moving around is because you're not destroying or locking bob's _x and _y parameters. On the store frame, put a script that locks his _x and _y example:
_root.bob._visible = false; // hide him
onEnterFrame = function() { // keep him from moving
_root.bob._x = 10; // some x number
_root.bob._y = 10; // some y number
}


If you are using mouse follow then destroy that event listener and recreate it when you need it again.

cdrake
09-16-2004, 09:53 PM
That works good, but when he leaves the store he is just stuck and the x and y coordinates and can only rotate. I can make him become visible again but I dont know how to get him moving again :p .

cdrake
09-17-2004, 12:11 AM
What exactly does "onEnterFrame = function()" do anyway?

Xeef
09-17-2004, 12:39 AM
it give you an ERROR mesage
"**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: '{' expected" :)

onEnterFrame = function(){trace("hallo")}
will execute the trace each time where you have it on enter a new frame

onEnterFrame = function(){"this will by done each Frame!"}

cdrake
09-17-2004, 12:46 AM
Thanks Xeef. Just had to change Frame to Load. He can move around while invisible if you change it to load though.

madgett
09-17-2004, 09:05 PM
That works good, but when he leaves the store he is just stuck and the x and y coordinates and can only rotate. I can make him become visible again but I dont know how to get him moving again :p .

As soon as he leaves the store call this code:

delete onEnterFrame;


That should do it.

farafiro
09-19-2004, 06:44 AM
hi cdrake
I think these links would help ya

http://www.freewebs.com/savco/site.htm
http://www.flashjava.com/tutorials/print.php?sid=195

cdrake
09-19-2004, 03:07 PM
thanks farafiro

farafiro
09-19-2004, 03:14 PM
welcome
;)