ActionScript 2.0 :: Constantly Moving Forward In The Direction It Faces?

Sep 3, 2009

I have recently been developing a sailing game and my boat turns with the arrow keys. On the turn i would like to keep the boat constantly moving forward in the direction it faces. What is the simplest way to do this?

(When i rotate the boat to the right/left, i want the boat to move that direction)

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Tweenlite Transition - Moving MovieClip Constantly

Jul 4, 2009

I've tried using tweenlite as a replacement for tweener. In one use I have a mc that I want to constantly move left or right when the mouse is hovering over it depending on position. With tweener I set the x for the tween to be mc.x-20. Using this with tweenlite 'to' just does it once rather then a smooth constant movement(this tween is being repeated through an event listener with mouse_over), 'from' will do what I want, however when the mouse leaves the mc, the mc comes to a halt and performs a tween in the opposite direction by 20 pixels...

I am not sure how to prevent the tween in the opposite direction or have 'to' continue to tween the mc without me having to rehover over the mc again for another tween of 20 pixels... So is it possible to use tweenlite like I had tweener working?
Code:
imageHolder.addEventListener(Event.ENTER_FRAME, updateScroll);
imageHolder.addEventListener(MouseEvent.MOUSE_OVER, rollover);
function rollover(e:MouseEvent):void {
if(scrollc.mouseX>containerWidth/2) {
scrolling="right";
[Code] .....

View 5 Replies

ActionScript 2.0 :: Move Objects Forward In E Direction That It's Facing?

Feb 3, 2009

Basically after adding an object on stage (using actionscript), it will be situated at a random rotation angle using:

this._rotation = Math.random()* 360;

After that, I want my object to move in the direction that it is facing, (using onEnterFrame?). How do I do that?

View 0 Replies

ActionScript 2.0 :: Get Movie Clip To Play Forward When Move The Mouse In One Direction

Nov 15, 2004

[URL] i assume it's a series of frames with slightly different photos of the razor. when you play the movie it looks like it is spinning. my question is, how do they get the movie clip it to play forward when you move the mouse in one direction, and backward in the other? is it something like mouse over to the right and left (i'm bad with the direction code)??

right now i have a version that will play the movie clip (it's a button w/ only a hotspot) on mouse over and it will stop when the mouse os off the hotspot, but i can't get it to work like the headblade example. because i don't know the right code to play forward and back etc on mouse moves.

View 2 Replies

ActionScript 2.0 :: [FMX] Moving Forward And Back?

Feb 27, 2004

I would like to let a MovieClip to move from lets say _x 200 to _x 800. When the mc reach the _x 800 it should return to _ 200 and visa versa. I like to do this with AS instead of with motion tween.

View 2 Replies

ActionScript 3.0 :: Mouse On / Off - When The Mouse Is Moving On The Stage The Counter Is Constantly Set To 0

Aug 24, 2009

[URL] when you have not clicked on all five dots, and you take the mouse of the stage, the interactive line should be deleted(graphics.clear(); ), and the little animation from the start should come back. my idea is to have a counter that ++ every frame, but when the mouse is moving on the stage the counter is constantly sett to 0. when the counter is, for example, 50 the animation i visible. do anyone have any methods that don't give the 50(for example) frame wait? and i would also like criticism and ideas on the rest.

View 7 Replies

ActionScript 2.0 :: Moving MovieClip To X Direction

Apr 29, 2009

I'm moving a movie clip using actionscript (as2) instead of a motion tween (because I want to save file size). I have this code on the first frame of the main timeline ("stone" is the movieclip instance name) and it tells the movie clip how many pixels to move in the x direction:
Code:
xTargetstone = 600;

I have this code on the movie clip itself ("stone" is the mc instance name) to handle the actual moving of the movie clip:
Code:
onClipEvent (enterFrame) {
xstone = getProperty(_root.stone, _x);
movestone = _root.xTargetstone - xstone;
setProperty(_root.stone, _x, xstone + (movestone/5));
}

The movement works fine, but the issue is that it starts out fast and then slows down over time (even though that amount of time is small). The result is that the movie clip seems to wiggle and vibrate before it stops. Is there a way for me to change the code so that it doesn't wiggle and vibrate? perhaps something with the math I'm just not totally understanding? I would like a nice consistent motion from start to finish, while being able to set the time it takes to move etc.

View 1 Replies

ActionScript 2.0 :: Moving An Object Forward (by Rotation)?

Mar 18, 2011

I have a script that rotates my character using left and right keys. I want the character to move forward to the direction he is pointing at when I press up key.How can I calculate the needed X and Y amounts from the rotation?

View 0 Replies

ActionScript 3.0 :: Moving Forward Only After Certain Frames Viewed?

Jun 21, 2011

I have a Flash Movie that is using Actionscript 3.0 and I have a part of it, where the user has three choices of where to go. Once they go to one, it takes them to a certain frame, then returns to the choice frame. There are three choices here, and what I want to happen is have a button appear to move them past this section, only after they have viewed all three choices.

View 9 Replies

ActionScript 3.0 :: Move Images Moving Forward?

Jan 18, 2011

How can I do the same effect (moving continuously) as in the following link using images?URL...

View 1 Replies

ActionScript 3.0 :: Require Visiting Certain Frames Before Moving Forward?

Sep 1, 2011

I have a site where I want to restrict the user from moving forward unless they have visited certain pages. So if you visit page 1, 2, & 3, then a button appears that lets you move forward. I have this working using buttons. See Example: boolean.zip

However what I need to have happen, is instead of having it check to see if you visited the page by clicking a button, I would like it to check if you visited a frame just be going to that frame. I am not sure how to do that.

View 2 Replies

ActionScript 2.0 :: Complete Animation Before Moving Forward In The Movie?

Mar 13, 2005

[URL].. The preloader on this site seems to run through a complete animation before moving forward in the movie.

I am curious if there is something to how preloaders like this work. Does each animation happen after a certain precent is loaded (in this example, when the squares turn green) or are they just animations that have nothing to do with the actual preloading?

View 1 Replies

ActionScript 3.0 :: Rotate Slowly Based On The Direction Hes Moving?

Nov 13, 2010

currently I have a movieclip that follows my mouse cursor simply using

char.x = mouseX
char.y = mouseY

the movie clip is always upright, how do i add rotation so the char will rotate slowly based on the direction hes moving?

View 2 Replies

Creating A Background Which Moves In The Direction That Cursor Is Moving?

Sep 8, 2009

so i have a project where i will be making a website. I will be using flash to make it interactive and visually appealing. I found a website with a really cool entrance page,please view it he mouse moves, the background looks like its moving.

View 3 Replies

ActionScript 3.0 :: HitTestPoint To Change Direction Of Moving Object

Jan 5, 2011

I'm having a problem changing the direction of a movieclip using hitTestPoint. I have some balls on the screen that only move left, right, up and down. and pending the way they are moving they have to change direction. if they're moving right they have to change to up. left to down, up to right and down to left. I tried the following code for getting a ball moving moving right to change to up. note: movingDir is just a string i use to keep track of how the ball is moving and is defined initially in another class. here is a snippet from the ball class:

[Code]...

View 8 Replies

Flash :: Moving Layers In X & Y Direction With Depth By Mouse

Aug 30, 2011

Could you take a look at this site , it's official web site of Coraline animated movie , is there any related article or tutorial to do such navigation technique [URL] If not i will try to explain , layers of movieclips are ordered in z direction when you move your mouse in x & y they move based on depth like semi 3d side walk games

View 1 Replies

Actionscript 3.0 :: HitTestPoint To Change Direction Of Moving Object?

Jan 5, 2011

I'm having a problem changing the direction of a movieclip using hitTestPoint. I have some balls on the screen that only move left, right, up and down. and pending the way they are moving they have to change direction. if they're moving right they have to change to up. left to down, up to right and down to left. I tried the following code for getting a ball moving moving right to change to up.

note: movingDir is just a string i use to keep track of how the ball is moving and is defined initially in another class.

here is a snippet from the ball class:

Code: Select allthis._movingDir = "right";
this._speedR = 5;
this.x += this._speedR; 

[Code]....

View 1 Replies

ActionScript 3.0 :: RollOver Interaction - Moving Animations Forward And Backward

May 19, 2010

I've got these 3 separate animations moving forward and backward based on simple rollover interaction. It all works and all is well with the world, but I know this can be done in a more efficient manner. Instead of duplicating all the functions with different numbered versions of their name, how can I group this stuff together and call it once? Just curious as I'd like to be more efficient with things like this moving forward.

ActionScript Code:
//CLIP ONE CONTROL
function loopback(event:Event):void {
this.celebration_mc.prevFrame();
this.light_mc.prevFrame();
} function backwards() {
[Code] .....

View 2 Replies

ActionScript 2.0 :: OnEnterFrame - Moving Object On Stage And Change Direction

Mar 22, 2006

I'm trying to set up a script which would force an object to move through the stage until a particular point and than change direction. I wrote something like that:

onClipEvent (enterFrame) {
moveUp = function () {
this._y -= 1;
if (this._y<-30) {
this.onEnterFrame = moveDown;
}};
moveDown = function () {
this._y += 1;
if (this._y>600) {
this.onEnterFrame = moveUp;
}};
this.onEnterFrame = moveUp;
}

But it doesn't work. the object moves only one direction and does not change it.

View 1 Replies

ActionScript 2.0 :: Moving Movieclip In Opposite Direction Of Mouse Movement?

Jan 3, 2010

I am about to make a gallery where all the pictures are ligned up, in a vertical row collum.I wan to make the Movieclip move in the opposite direction of my mouse movement

View 2 Replies

ActionScript 2.0 :: [flash 5] Random Motion - Object To Flip Horizontally Depending On The Direction It Is Moving

May 9, 2006

i'm using the an actionscript for random movement that i found here... [URL] but my problem is that i need the object to flip horizontally depending on the direction it is moving... the object that is moving around is a bug, and i need it to face left if it's moving left or face right if it's moving right.

View 1 Replies

ActionScript 2.0 :: Calculate The Direction And Speed A Circle Has After Colliding With A Static (non-moving) Circle?

Mar 8, 2005

I'm developing a game atm, and I need some help on the mathematics/coding of colliding circles (and their change in x/y speed). What i need to know is how to calculate the direction and speed a circle has after colliding with a static (non-moving) circle. I know how to detect a collision between the two, but I'm not sure about the maths I need to give the circle the right speed and direction after the collision

If i do know how far away the two circle-points (in the middle of each) are to each other (in both x and y coords) would it be easy for me to find the new speed and direction of the large circle in the example above? I know that I somehow should use the angles to pretend the circle hits a flat "wall" (as it only hits one point), and then calculate the new speed/direction. My only problem is that I'm not sure how to decide the angle of this flat "wall" and how x and y speeds should change when colliding with a wall that is angled. Does anyone here have any insight, links or tips on how I can du this?

View 6 Replies

ActionScript 3.0 :: How Does One "detect" If The Object Is Currently Moving To Its Own Left Or Right Direction

Sep 29, 2010

using trig, when moving an object based on its current rotation, how does one "detect" if the object is currently moving to its own left or right direction? example: right side up: left moves the car to its left, which is left. upside down(180 rotation): left moves it the car to its left, which is right. based on movement alone, how can i say its moving to its own oriented left or its right?

[Code]....

View 7 Replies

ActionScript 2.0 :: Scrolls Continuously In A Direction Until The Direction Of The Mouse Is Changed?

Feb 24, 2009

i have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??

View 1 Replies

ActionScript 3.0 :: Direction Of The Ball In The Direction Of The Mouse

Mar 17, 2011

have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..

ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;

[Code]....

how to make that first ball did not change its direction and continued to fly in the direction of the shot?

View 5 Replies

ActionScript 1/2 :: Faces Disappear When Have Over 3 Of Them?

Oct 3, 2009

I made a game and i had 3 faces on it. Now i added one more and when i play it, i see only two.

[Code]....

View 5 Replies

ActionScript 3.0 :: Movieclip On Each Of The 6 Faces On The Cube?

Feb 8, 2012

Does 3d work in flash? If so, links to a quick tutorial? All I want to figure out is how would one draw a block on stage. Bonus points if you can tell me how I can have 6 movieclip on each of the 6 faces on the cube.

View 2 Replies

ActionScript 2.0 :: Add/attach A Different Link To Each Faces?

May 12, 2004

I DL the kirupa source code 3D ButtonCube and i am wondering how can add/attach a different link to each faces? Basically i want to make this 3D cube function like a menu.

View 1 Replies

Save Faces Messages After Redirection Due To ViewExpiredException?

Jul 9, 2011

I followed the following article to deal with ViewExpiredException -

It does what it is supposed to do. But I wanted to have some FacesMessage displayed on view if the user was redirected to it due to ViewExpiredException. So, I added a FacesMessage before redirection using NH.handlenaviage(). But it didn't work, and the reason was that the FacesMessage survived only one Request Processing Cycle.

At first my solution was to save the message in the session and retrieve it before Restore View phase of next cycle.

Even though it worked, I started looking for some standard solution and the first thing that I came across was the following article -

Persist and pass FacesMessages over multiple page redirects

But it didn't work. I think it's because the PhaseListeners are executed before ExceptionHandlers. So, in this case it was useless.[code]...

View 1 Replies

ActionScript 2.0 :: Click To Move - Faces Towards The Mouse

Jul 12, 2009

I've got a game were you click and a plane moves towards that spot, the problem is making it face were you clicked. i can get it so that the plane faces towards the mouse but thats not really what i want.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved