ActionScript 3.0 :: Projectile - Get The Missile To Actual Move In The Direction The Character Is Facing

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


Similar Posts:


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 :: 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

ActionScript 3.0 :: Change The Frame In The MC Math.atan2 According To The Direction It's Facing

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

Actionscript 3 :: Move Projectile In An Arc To Mouse X,y?

Dec 23, 2011

I'm creating a game where you have a cannon at the left edge of the screen. I want to be able to fire a cannonball from the cannon in an arc so that it intersects where the mouse pointer is on the screen.

I've seen a few examples that move a projectile in an arc from point a to point b, but what I need is for the cannonball to first move along the axis of the cannon itself, it's no good if the ball leaves the end of the cannon at a different angle to which the cannon is pointing.

The only force acting on the ball will be gravity and it's starting velocity.

Also to complicate matters, I need the cannons angle to change according to how far away the mouse pointer is from the end of the cannon, so if the pointer is far away than the cannon will point upwards say at an angle of 45 degrees, but if the pointer is very close to the end of the cannon then the cannon will point directly at the pointer, this I've more or less already got working by just getting the distance between them and then dividing it by a number and subtracting it from the rotation value of the cannon, but it's a bit of a rough way of doing it.

EDIT Using the code below I've managed to the line in the screen shot below. But as you can see it's not the trajectory I need, I need something more like the red line I've put in.

And here's how I've implemented the code (probably wrongly)

public class GameTurretLine2
{
var rt:Object = null;

[Code]....

Also for some strange reason, the line created by the code flips, from how it is in the screen shot to an indented code (y flipped) just by moving the mouse a tiny amount, so as you move the mouse the line jumps everywhere.

View 1 Replies

ActionScript 3.0 :: Making A Game Character Run Like An Actual Person?

Sep 18, 2009

just wondering if anyone can help me with this I'm making a platform game and wanted to make my game character run when user press the keyboard left or right. But I want my character to run like an actual person instead of just sliding across the screen. I have no idea where to start and I can only find tutorial that teach how to make a character move by just using - or + number of pixels but that's not what I'm actually looking for. I prefer that my game character to be more lively. Does anyone know how??

View 2 Replies

ActionScript 3.0 :: Shooting In Same Direction As Character?

Feb 15, 2010

I'm making a game that is birds eye view like the old grand theft autos. anyway im currently stuck at this... I can have my character fire and have the bullet follow my mouse but I cant seem to figure out how to just make the bullet go straight off the screen in the direction my character is facing.

View 2 Replies

ActionScript 3.0 :: Shooting In Same Direction As Character

Sep 20, 2010

I'm making a game that is birds eye view like the old grand theft autos. anyway im currently stuck at this... I can have my character fire and have the bullet follow my mouse but I cant seem to figure out how to just make the bullet go straight off the screen in the direction my character is facing.

View 8 Replies

Actionscript 3 :: Make Character Face Direction?

Jan 21, 2011

I have one character which can face several directions: t, b, l, r, tl, tr, bl, br.The type of camera is top-down 2d

T stands for Top, which is when he is looking to the top of the screen

B = Bottom
L = Left
R = Right

The character can look to other directions, like the Top-Left of the screen, which is tl

How do I calculate which direction he should look to if I only have one variable, rotation?

View 1 Replies

Actionscript 3 :: Character Only Stops At Walls In One Direction?

Oct 20, 2011

I tried almost everything to make my character stop when it detects a wall. It only works for UP and RIGHT or DOWN and LEFT but not all 4 directions, so only one y movement and one x movement. So I decided to make 4 functions, one for each direction. But then it only works when the left key is pressed and hits a wall.

What do I have to do to make the collision detection stop the character from moving in all 4 directions?

var leftArrow:Boolean;
var upArrow:Boolean;
var rightArrow:Boolean;

[Code]....

View 2 Replies

ActionScript 3 :: Initiating A Bullet Changes Direction With Character

Mar 2, 2012

I'm working on a side scroller that has a character that fires a bullet every time you hit spacebar, the problem I'm having is moving the bullet in the direction the character is facing (left or right).

I have a few of boolean variables to tell me which direction my character is facing: walkingRight | walkingLeft, so if my walkingRight == true, I want the bullet to travel +=10, and walkingLeft == true, bullet -= 10.

The problem is, when I fire facing left, the bullet moves left, but as soon as I turn right, that same bullets starts moving right.

Here is a snippet of AS3 code (Every Frame):

if(gamepad.fire2.isPressed){
// initiate bullet
var bullet = new Bullet();

[Code]....

View 1 Replies

ActionScript 2.0 :: Move A MC In A Specific Direction?

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

ActionScript 3.0 :: Move Object In Direction Of Angle?

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

ActionScript 2.0 :: Ball To Move In A Random Direction 0-360?

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

IDE :: Telling MovieClip How Many Pixels To Move In 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) 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

ActionScript 2.0 :: How To Get MovieClip To Move With Mouse Direction

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

ActionScript 3.0 :: Make A Circle Turn And Move In The Direction?

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

ActionScript 3.0 :: Make An Object Move Along The X Axis In One Direction?

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

ActionScript 3.0 :: Move The Image In The Opposite Direction Of Mouse?

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

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 3.0 :: Screen To Move With The Character?

Nov 3, 2009

I have my character movement down, and now I want the create a map. I want the screen to move with the character, and eventually I will have it so that at certain spots on the map, the screen will not let you move and stop and enemies will come out.

View 0 Replies

Make Character Move Across Screen?

May 12, 2010

I've created a walk cycle using bone tool on a character but i don't know how to make it move from one part of the screen to the other. The character is made up of 6 layers, 4 of which are armatures and 2 have motion tweens.

View 1 Replies

ActionScript 3.0 :: How To Move Object With Character

May 2, 2010

I have found a ton of tutorials with code that teaches you how to move a character, or move objects with arrow keys.... but I have found nothing that teaches you the code that allows the character in a video game to move an object around. like for example a character needs to slide a block across the ground so he can jump on it to reach platform that higher up.In my platformer game, I have figured out how to jump and move the character back and forth among the platforms with gravity, and thats as far as I have got.

View 8 Replies

Screen To Move In Time With The Players Character?

Jan 20, 2010

How exactly do I cause the screen to move in time with the players character?

View 5 Replies

When Hit UP Key To Jump The Character Continues To Move Up As Hold The Key Down

Feb 3, 2010

A) When I hit the UP key to jump the character continues to move up as I hold the key down.

B) When I stop moving forward the frame of the stickman symbol for walking keeps playing and I want it so the frame labeled "idle" will play when I release right or left.

C) Is it possible to have an action for holding 2 keys at once? I want to have it so i can hold SPACE and RIGHT/LEFT to run.

[Code]...

View 2 Replies

ActionScript 3.0 :: Character Won't Move With Arrow Keys In It

Jun 8, 2010

My character's name is character. When left and right are pressed it tells me what's being pressed when I run it - it says there's no errors with the code. My character doesn't do anything though! [code]...

View 5 Replies

Move Text From One Column To Another Depending On Character Count?

Oct 26, 2009

I am trying to find a way to have text start in a specific column depending on the character count.

Basically our site will have 3 columns. For example if the text only has about 300 Characters - it would start in the right column. If it had between 301 & 600 characters - it would start in the middle column and run to the right column. If it had more than 601 characters - it would start in the left column and run to the middle then right column.

View 1 Replies

ActionScript 3.0 :: Make A Character Move Its Legs When It Walks?

Mar 18, 2012

I want to make a character move its legs when it walks but I don't know how to do this.

Not necessarily just move this character, but general movement in general.

View 4 Replies

ActionScript 2.0 :: Move The Character To A Button Then Press Spacebar On It?

Feb 1, 2004

I got a character to move. I want the player to be able to move the character to a button then press spacebar on it. Which will take them to another frame.

This is the code I got for the button but the trouble is u can press spacebar anywhere to go to the next frame.

on (keyPress "<Space>") {
_root.gotoAndPlay(23);
}

View 2 Replies

ActionScript 3.0 :: Unable To Assign Buttons To Move Character?

May 12, 2010

I am trying to assign buttons my on my 'gameScreen' to move my character. though I am receiving an error msg saying: Error #1010: A term is undefined and has no properties.at Mainas()

package{
import flash.display.MovieClip;
import flash.events.MouseEvent;[code]....

View 3 Replies







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