Moving in one axes

Hey all, just working on making my footer playable. got the ship shooting and moving ok, though i would like the ship to only move in the x axes. what do i have to add to this code used to replace the mouse and move the ship_mc.



onClipEvent (load) {
    this._visible = 0;
    Mouse.hide();
}
onClipEvent (enterFrame) {
    _root.ship._x = _root._xmouse;
    _root.ship._y = _root._ymouse;
}

:smirk:

ok , i tryed removing the relating y_mouse code in the action script but now , iam no longer able to shoot from my ship.

heres the fla.

there is two, one is the fla without the y axes and the other is the original with the y axes code.

anyone ?? it basically the tutorial from kirupa , crab shooting.
and i wanted to constrain the ship to the x axes. so it can only go left and right. any help will be appreciated. :smirk:

edit:: this is in flashMX, sorry about not posting that in the threadname.

Well I gotta run to work, so I will explain what I changed later, if you want. Here’s the working file.

-Al

thanx, dude i check it out 2morrow, tied, and gonna wake up early to watch australia play england in soccer (football). thanx again

:: check your PM.

sorry for not replying alethos . the fla looks fine, thanx for that, from what i can see is that you have drawn a stroke as reference and gave it a instance name

(xBoundary) and use some code to call this and tell where the mc is contrain to. if your up 2 it, i wouldnt mind if you elaborate on what u did .

:: and also just wondering why youleft frame one and placed everything on frame2?
:smirk:

Well, first of all, the file I got from you had nothing in frame1…so I just figured that’s how you wanted it. :slight_smile:

Ok, when you had the ship follow the mouse in both x and y, every click of the mouse would obviously hit the ship, which is a button that triggers the shooting.

But when you constrain to x, the mouse is not always over the ship when clicking, so the shooting is not triggered. What I did was edit the ship button by adding a hit state that covers the whole movie. That way, as long as the mouse cursor was in the movie, any click would trigger the shooting.

I used the xBoundary mc just to define how far side-to-side the ship could go.

Finally, I also editted the shots so that they start at the ship’s nose, instead of it’s tail.

-Al

kool, thanx for the explaination, i didnt even notice you make the hit state bigger. lol :smirk:

thats a nice code for xBoundary did you use this on previous account or was that just made for this?

Now time to get into random falling mcs, and need to learn some collition, getting there slowly but surely.
:slight_smile:

No prob.

The xBoundary stuff was just for this, I guess…I have never had to do it before.

-Al