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


Similar Posts:


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

MX Shooting Bullets In Any Direction?

Jun 28, 2011

I need a code in AS2 that launches a bullet ("bullet") from the character ("hero") towards wherever you clicked the mouse.For example, if I click somewhere, I want the bullet to launch straight towards where I clicked.

View 10 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 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

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 3.0 :: Character Animation - When I Press Left Or Right Key - Draw Each Frame That Makes Character Movement?

Sep 24, 2010

I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.

View 4 Replies

ActionScript 3.0 :: Shooting A Target?

Apr 24, 2009

I have a monster_mc that shoots a bullet_mc at a target_mc.When I click the Keyboard.RIGHT the bullet jumps once then hesitates or pauses then continues -=25 pixels, instead of shooting smoothly.Am I missing something here?, can I make it perform better?

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
target_mc.stop();
function keyPressed(event:KeyboardEvent):void[code].....

View 1 Replies

ActionScript 3.0 :: Shooting In Different Directions?

Sep 16, 2010

I have been googling my butt off I can not find anything about AS3 and shooting in different directions.

I just need to shoot in the direction my char is facing.

I have this so far which work flawlessly ;-)

function Shoot(event:MouseEvent):void { trace("shoot");}

oh also I can get the direction my hero is facing using trace "character_mc.rotation"

View 3 Replies

ActionScript 3.0 :: Regular Expression To Test If A Single String Character Has Both Upper And Lower Case Character?

Nov 27, 2010

Does anyone know the regular expression to test if a single string character has both upper and lower case character?

eg. All A-Z and a-z.

View 0 Replies

ActionScript 3.0 :: Shooting Game In Flash CS3?

Feb 6, 2009

Shooting game in FlashView Game - Click hereKindly check game codeProblem:1) The rabbit should be random shown in ground areaif someone can give explaination onmonster.x = Math.random() * stage.stageWidth;and why the rabbit is showing bigger size?2) Other animals should also be able to target

//----->
stop();
var monstersAlive:uint;

[code].....

View 1 Replies

Create A Shooting Style Game?

May 7, 2010

I am at uni and have a project to create an interactive game for the story Johnny Mnemonic. I would like to create a game whereby the player has a whip type weapon, there is an opponent jumping up and down and with the whip you attack them and cut off limbs -

I'm thinking it would be like a simple shooting ducks style game in terms of coding, the player has visible just a hand with the whip in it, you move the whip to your desired location click chosen button to hit, the whip then animates a flick, if it hits correct spot on bouncing opponent then an animation of the limb flying off happens, so the bouncing opponent is like the duck and the whip like the gun - if that is right at all?

View 1 Replies

ActionScript 2.0 :: Top Down Shooting Game - Boundaries

Nov 23, 2005

I've been making this space shooting game but I'm having problems getting boundaries to work. I've read tutorials and done lots of searching here and couldn't get anything to work... On the main time line, there's 2 layers. One with the ship, and one with the background (both are movie clips). Inside the background movie clip, I'd like to add boundaries, almost as complex as a maze but not so restricting.. as in, a path to fly through that'd probably be as wide as the screen itself. Here's what I'm trying to work with. Use the arrow keys to move, space to shoot, and press control to toggle between fixed camera and fixed ship modes.

View 1 Replies

ActionScript 2.0 :: Make A Movieclip Of A Character And When The Character Is Dragg?

Aug 11, 2009

i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.

View 2 Replies

ActionScript 2.0 :: Shooting Game Bullet Removal?

Feb 18, 2009

So the problem is basicly this: It all works just fine, but when the bullet hits the target it gets destroyed (this is ok) but also any bullet that was shoot before it (meaning also: with a lower y) gets destroyed aswell wich is anoying. Here's the code (left the comments so you can find your way around easier)

Code:
stop();//add a stop function too!
enemyspeed =1
life=3
var gameOver:Boolean = false;

[Code]..

View 2 Replies

ActionScript 2.0 :: CS3 Shooting Game Missile Flaw

Jul 15, 2010

I'm making a Space Invaders-type game. Y'know? Arrow keys to fly Space to shoot? Well, shooting isn't working so well. I have two .as files: Ship.as which controls the ship's ActionScript, and Missile.as which is supposed to control the missile. When I hit load it up I get the error: The class or interface 'Missile' could not be loaded.

View 2 Replies

ActionScript 1/2 :: Shooting Works Only When Jumping Not Standing?

Jan 23, 2012

I'm having trouble getting my character to fire. it seems to fire when he jumps, but not while standing. I have attached my code to the zip file below:This is the code I used:

onClipEvent (load) {
var gravity:Number = 0;
var speed:Number = 5;

[code]....

View 1 Replies

Flash :: Shooting One Arrow Per Click Towards The Mouse

Aug 23, 2011

i am looking for a tutorial to help me with shooting one arrow per click towards the mouse. this is my code:

[Code]...

View 1 Replies

Actionscript 3 :: Shooting Projectiles Given An Angle And Power?

Dec 31, 2011

I'm doing a prototype game like Worms and I would like not only to shot, but also see the whole projection curve where my shot will travel before it hit the ground. The only information given by the player is an angle and a power. There is also some level elements like wind and gravity.

Can I have a code for the projection curve? its like a parabola I think. I research about parabola but I had some difficult to apply these math formulas into the programming code.

View 1 Replies

ActionScript 2.0 :: Create 2d Platform Shooting Game?

Feb 13, 2011

I am creating a 2d platform shooting game. Currently I have my main character walking around left and right and the stage background also moves left and right.

The problem I am having is that if I go to far left the charater just walks 'off stage' and into nothingness but the stage still follows. How can I make it so if the character hits a certain point he just 'stops' and cant go left no more but can go right no problem. I have tried using hitTest with another movieclip but couldnt get it working.[code]...

View 1 Replies

ActionScript 2.0 :: Shooting In A Game-megaman Style

Apr 4, 2002

Ok I am creating a 2d game similar to the original mega mans and mario for nintendo. The character moves back and forth using the left and right arrow keys on the screen and has a walk animation and all. The next step is to get him to shoot his laser gun. I want this to be done using the space bar key. What I have right now is identical to Kirupa's movement using X and Y values tutorial but it only moves one direction of course. How can I make it so that it will continue to move automatically after pressing space instead of having to hit the space bar each time I want it to move 10 units over etc.?

View 12 Replies

ActionScript 3.0 :: Target Shooting Game - HitTestObject Not Working

Mar 22, 2011

I'm making target shooting game and the hitTestObject not working its located in the function collision detection below in my code:
import fl.motion.MotionEvent;
import flash.events.MouseEvent;
var xSwitch:Array = new Array ;
var count:Number = 120;
var seconds:Number = 0;
var minutes:Number = 0;
[Code] .....

View 1 Replies

ActionScript 3 :: Object Flying Around And Shooting - Rotation Values?

Apr 6, 2012

I got an object (called tempEnemy) which is flying around and shooting. The problem is that I can't keep the value tempEnemy.rotateTo positive, i.e. It shall be between 0 and 359 degrees. Currently rotateTo ranges from:
rotateTo < 0 (bug) && rotateTo > 0 && rotateTo > 359 (bug).
tempEnemy.dX = tempEnemy.destX - tempEnemy.x;
tempEnemy.dY = tempEnemy.destY - tempEnemy.y;

//I added 180 because my tempEnemy object was looking and shooting to the wrong direction
tempEnemy.rotateTo = (toDegrees(getRadians(tempEnemy.dX, tempEnemy.dY))) + 180;
if (tempEnemy.rotateTo > tempEnemy.frame + 180) tempEnemy.rotateTo -= 360;
if (tempEnemy.rotateTo < tempEnemy.frame - 180) tempEnemy.rotateTo += 360;
tempEnemy.incFrame = int((tempEnemy.rotateTo - tempEnemy.frame) / tempEnemy.rotateSpeed);

View 2 Replies

ActionScript 2.0 :: Bullet Shooting Thing Which Shoots Bullets

Apr 2, 2007

I have like a bullet shooting thing which shoots bullets (obviously), and it sorta rotates around a point and fires at a movie clip. At the moment the bullets move outwards because of a animation in side the bullet movie clip, but how can I make them move outwards and away from the thing that fired them using actionscript?

View 8 Replies

ActionScript 2.0 :: Making A Shooting Game, Would Like The Gun To Flip _xscale?

Jun 2, 2008

I'm making a shooting game, would like the gun to flip _xscale when you move the gun past half the width of the stage. Here's the script I made which doesn't work and is probably not written correctly:

if(_xmouse >= Stage.width/2){
_root.gun_mc._xscale * -1;
}

View 4 Replies

ActionScript 3.0 :: Passing Function Parameters: Shooting Game 85% Done?

Dec 2, 2009

I have benn programming in AS2 for a while, but I'm moving to AS3, and I'm having some trouble with syntax and mostly with management of parameters and variables (actually I tried to work with functions in packages without good results T.T). The game has four different types of shooters, and all of them use the same bullet (shoot function). I have succeeded on disappearing the target (a coin in this case) when it is hit by the bullet, but the problem is that I can't quite find the way to dissapear the bullet properly. I keep receiving this message:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at eco_adm9_fla::MainTimeline/moveBullet()

[code].....

View 3 Replies

ActionScript 3.0 :: Flash Background Movement For Shooting Game?

Aug 30, 2011

I'm doing the shooting game. In that character should move left and right by using the arrow keys. The background is movieClip with image. The character is walking very slow sometimes. And the zombies will come automatically. Why the movement is very slow sometimes?

View 4 Replies







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