# Moving in one axes

**URL:** <https://forum.kirupa.com/t/moving-in-one-axes/13279>\
**Category:** Uncategorized\
**Created:** [February 11, 2003, 5:34am UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279 "2003-02-11T05:34:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![soulty](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/soulty/32/105_2.png) [@soulty](https://forum.kirupa.com/u/soulty)\
**Post date:** [February 11, 2003, 5:34am UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/1 "2003-02-11T05:34:31Z")

</div>

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.

```auto

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

```

😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2003, 5:44am UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/2 "2003-02-11T05:44:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2003, 2:08pm UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/3 "2003-02-11T14:08:03Z")

</div>

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. 😏

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2003, 12:45pm UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/4 "2003-02-12T12:45:13Z")

</div>

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

-Al

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2003, 12:47pm UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/5 "2003-02-12T12:47:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 4:42pm UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/6 "2003-02-14T16:42:45Z")

</div>

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?  
😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 11:03pm UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/7 "2003-02-14T23:03:15Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 15, 2003, 12:07am UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/8 "2003-02-15T00:07:08Z")

</div>

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

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.  
🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 15, 2003, 12:29am UTC](https://forum.kirupa.com/t/moving-in-one-axes/13279/9 "2003-02-15T00:29:06Z")

</div>

No prob.

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

-Al
