View Full Version : moving in one axes.
.soulty
February 11th, 2003, 12:34 AM
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:
.soulty
February 11th, 2003, 12:44 AM
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.
.soulty
February 11th, 2003, 09:08 AM
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.
alethos
February 12th, 2003, 07:45 AM
Well I gotta run to work, so I will explain what I changed later, if you want. Here's the working file.
-Al
.soulty
February 12th, 2003, 07:47 AM
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.
.soulty
February 14th, 2003, 11:42 AM
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:
alethos
February 14th, 2003, 06:03 PM
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
.soulty
February 14th, 2003, 07:07 PM
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.
:)
alethos
February 14th, 2003, 07:29 PM
No prob.
The xBoundary stuff was just for this, I guess...I have never had to do it before.
-Al
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.