ActionScript 2.0 :: Making A Symbol Move The Direction It's Facing?
Dec 2, 2011
I want to know if there's a way to make a symbol move the direction it's facing.I have a character which rotates when you press Left/Right:
if(Key.isDown(Key.LEFT))
{
_rotation -= 15;
[code].....
View 6 Replies
Similar Posts:
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
Sep 17, 2010
I have this code to add my missile to the screen PHP Code:
[Code]...
it adds right where my character is but I cant seem to figure out how to get the missile to actual move in the direction the character is facing. heres how it looks [URL]
View 1 Replies
Dec 14, 2009
I've got a movieclip which follows a predefined path (like in those tower defense games). Normally the mc changes the direction it faces with Math.atan2 method and then rotates the movieclip, but because this game is in a tilted view( in stead of directly from the top) I need it to change the frame in the MC according to the direction it's facing.
Is it possible to read out Math.atan2 method data, and then change the frame the MC is displaying, according to this data? I used [URl]...on-and-realism as a base for this game. If Math.atan2 method
View 1 Replies
Jul 30, 2010
I have the following code which works quite nicely but in Clockwise direction. I would like the movie to rotate in a opposite direction which is Anti-Clock direction. How to resolve the problem?The following is the code:
// Adding mouse event to our movieclip!myMovieClip.addEventListener(Event.ENTER_FRAME, rotateMoveClip);
// the rotateMoveClip functionfunction rotateMoveClip(e:Event){ // e.target is the
[code].....
View 1 Replies
Oct 16, 2009
What I really want to know is how to rotate the symbol based on direction of mouse movement
View 1 Replies
Aug 5, 2011
I have a MC with a ball-movement, that I'd like to move in a specific direction, anytime on pressing A. Here's my code so far (the target is the center of the paddle); but it only does the last part and reverses the current direction.
ActionScript Code:
on (keyPress "a") {
endX = _root.pad._x;
[Code]....
View 4 Replies
Mar 21, 2012
This is a painfully simple concept and for some reason I can't get my head around it. The basic idea is I want a sprite to come down half way and then if it fails a random check, to reverse direction and move back towards the top.
Code:
private var _ReverseDirection:Boolean = (Math.random() > .5) ? true : false;
public var _Vel = 3;
public function main(){
[Code]....
So basically the the sprites created, a true/false boolean is made and the Loop function is started. As you can see though, as soon as the sprite starts moving backwards it fails the If statement and starts bouncing back and forth between passing and failing. I've toyed around with putting them in different functions, complex If statements, etc but it keeps coming back the conditions fluctuating back and forth.
View 2 Replies
Jan 19, 2010
i'm trying to work out how to get a movieclip (of an arrow) to rotate then move in the direction it is pointing, controlled using the keyboard. Below is the code i have written so far, I can't get it to move in the correct direction. I also can't get it to keep moving after only one key press.
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressDown);var stageW:uint=stage.stageWidth;var stageH:uint=stage.stageHeight;
var speed:Number = 5;
var angle:Number =45;
[Code].....
View 5 Replies
Sep 6, 2005
I would like the Ball to move in a random direction 0-360,Then i would like the Ball to richoche off of the BallBoundry in its reflected direction.
View 2 Replies
Apr 29, 2009
I'm moving a movie clip using actionscript (as2) instead of a motion tween (because I want to save file size) and 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 4 Replies
Apr 20, 2004
How do I get a movie clip to move to the mouse when it is clicked and released and have it rotate in the direction that it moves?
View 5 Replies
Oct 15, 2010
what i am trying to do is make a circle turn and act like a wheel... what code would i use to make a circle turn and move in the direction it is turning while on the ground?
View 12 Replies
Sep 7, 2011
is there a easy way to make an object move along the x axis in one direction then when it reaches that direction it moves back. with a smoove movement.
View 1 Replies
May 2, 2009
Does anyone know the algorithm used in this image panner [URL]
How to move the image in the opposite direction of mouse.
View 14 Replies
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
Dec 2, 2008
am creating a video game similar to Arakanoid butwith a small amount of moving objects instead of stationaryobjects. I am not trying to make an exact recreation but at leastsomething that is playable and fun that can be made in Di. I am just taking it one step at a time so my question is, amI able to create a border around thisportion of my picture? The black border is also part of thesame PNG. Is it possible to create a border in the code so nothingpasses that section or does my picture have to be separate from theblack border? Basically, I want all actions constrained within thatpicture frame.
View 1 Replies
Dec 4, 2011
I have a symbol which stays stationary, and another symbol that moves around when I use the arrow keys.I want to make symbol1 (stationary one) to face symbol2 (the one I move).I'm guessing using _rotation to make it face it depending on symbol2's _x and _y position?
View 4 Replies
Dec 6, 2011
I have a symbol which stays stationary, and another symbol that moves around when I use the arrow keys. I want to make symbol1 (stationary one) to face symbol2 (the one I move). I'm guessing using _rotation to make it face it depending on symbol2's _x and _y position? Also, I'm using class files.
View 1 Replies
Dec 30, 2010
I am learning AS3. How can I move a symbol? My Code
[Code]...
But when I press space the symbol is to fast. How can edit the speed of the point?
View 2 Replies
Mar 30, 2004
I have a few buttons and when I make them a symbol, they look like crap. Any trick to make symbols look as good as the imported bitmap?
View 12 Replies
Nov 17, 2009
All I'm trying to do is move one graphic (converted to symbol) from one side to another. However, when I try to put in the 'motion tween' it keeps saying "Multiple objects are selected, you must convert them to a symbol in order to tween them. Do you want to convert them and create a tween?" If I click 'Ok' it comes up with "The tween could not be applied to some of the selected frames. This could be due to the frame containing ActionScript, Multiple objects, non-tweenable objects or being on a layer that cannot be a tween layer"
View 1 Replies
Jun 27, 2010
I'm completly lost, I'm rather new to flash, and I'm trying to get a symbol to move when I press a key. The following is what my code looks like:
onClipEvent (load) {
speed = 5;
} onClipEvent (enterFrame) {
if (key.isdown(37)) {
_x -= speed;
} if (key.isdown(39)) {
_x += speed;
} if (key.isdown(40)) {
_y += speed;
} if (key.isdown(38)) {
_y -= speed;
}}
View 4 Replies
Aug 19, 2009
I'm still new to AS3, and I was wondering how to make an object point in the direction of another object and move towards it if they are a certain distance from one another. I haven't been able to find out how to do this from the Adobe devnet, so I thought I'd ask here.
View 1 Replies
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
May 4, 2009
making another symbol(object) to move around randomly like another symbol i made here is the script for the symbol
onClipEvent (load) {
this._x = random(550);
this._y = random(310)+90;[code]..........
i need to make another symbol like this one that moves around same way i think i need to make a new layer? make next script for new symbol so it will to move around the same way.or tell me what to write in the new script for the symbol .
View 8 Replies
Sep 6, 2011
I need to move an instance of the class Snowboarder from x -1.00 to x 199.99. How do I link from my actionscript of class Enter?Here is what I have class Enter [code]Is another class even needed? This "Enter" class will only be used to move a snowboarder over the screen and have a logo apear behind him.
View 2 Replies
Apr 7, 2011
I want my mc to move in a wave shape (like a very low frequency signal) as it moves horizontally accross a blood vessel. I know how to do guide tween, however, I do not want this as I want it to be random. I have a numeric stepper which generates the no of salt particles.
View 1 Replies
Nov 25, 2007
I've made a draggable menu for a flash site (menu_mc), but the buttons don't work inside the movie clip when I apply startDrag. To remedy the problem, I simply made another movie clip (menubuttons). I now want to more or less attach the two movieclips:
Code:
if (menu_mc.moveTo(x,y)) {
menubuttons.moveTo(menu_mc.x,menu_mc.y)
};
I also tried some pretty iffy statements:
Code:
menubuttons._x = menu_mc._x
That last one works initially, but when I move menu_mc, menubuttons stays put.
View 2 Replies
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