ActionScript 3.0 :: Character Movement And Shoot Not Working?

Nov 8, 2009

I'm doing a simple game where you move the character using the arrow keys and shoot using the Mouse. The character rotates based on the Mouse angle. I have two problems: when I move the character, he moves once, then stops then moves again as normal. My other problem is that when I click over a MovieClip, the bullet goes to the wrong angle.My moving function:

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
function keyHandler(event:KeyboardEvent):void {

[code]....

View 2 Replies


Similar Posts:


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 :: 2D Character Movement With Camera Movement

Jun 10, 2011

how to get the camera to move with a character? At the minute he just moves off screen when i press right rather than the camera following him.

View 3 Replies

ActionScript 2.0 :: 8-way Character Movement?

Mar 14, 2011

Right now I have all the animations for each direction in a movieclip within one movieclip.However, when I use the arrow keys to move the walking animations don't playWhen I stop, the appropriate animations play, however. Here is my code:

Code:
onClipEvent (load) {
facing = 1;

[code]....

View 1 Replies

ActionScript 2.0 :: Character Movement Flash Mx?

Jun 11, 2005

i have made the movie clips for my character walking in 4 different directions but i have no idea how to make it so when the up arrow key is pressed, for instance, the movie clip of my character walking up is played.

View 7 Replies

ActionScript 2.0 :: Character Movement Script

Dec 17, 2011

my movement script looks like thisActionScript2.0)

[Code]....

View 1 Replies

ActionScript 2.0 :: Character Movement Script For A Game?

Apr 15, 2010

I'm sorry if this is the wrong section. But I'm looking for help with my actionscript coding. I'm fairly new to Flash. I've only scripted some simple websites so far and this is the first time I try to make a flash game. I started yesterday but I'm already having problems with my script.

I have a scene with 2 layers: one with my character and one with the bounds (ground, ceiling and walls).

Inside my character movie clip, I have this: Which is basically a bunch of frames labeled and with the action to stop();. Each one containing another movie clip with the respective animations. So the idea was, when I press "A", jump to "walk left". And it kinda worked, but I have some problems and I'm not really sure how to solve them.

[Code]...

View 2 Replies

ActionScript 3.0 :: Making Iphone App Character Movement?

Aug 24, 2010

1. Character Movement: as you know the iPhone/iPod touch doesnt have any sort of keypad and so when creating a game that has character movements onscreen buttons need to be used. My question is this; how exactly do i make it so that when the player taps/holds down a button (is the same as mouse clicking it) my character moves.
 
2. adding a physics style fall: once i have created this movement using on screen buttons i now need to create a jump, so what i need is something so that when the player clicks the "jump" button the sprite moves up a certain amount and then stops moving up and falls down.

View 2 Replies

ActionScript 3.0 :: Floor Not Recognised By Character Movement?

Feb 8, 2010

I am designing a character to move right and left but the character is not recognising the floor movieclip and is falling straight threw the floor.I have attached a zip file with the flash document sample and associated Actionscript file.

View 2 Replies

ActionScript 2.0 :: Restricting Game Character's Movement?

Aug 9, 2010

1. How do I prevent my scuba diver from leaving the screen? As when i hold either up, down, left or right long enough he will leave the stage entirely.2. How can I make my sharks enter the screen at random rather than having them enter from the same position each time? Here is my code:

(FOR MY SCUBA)
onClipEvent (load) {
xspeed = 10;

[code].....

View 3 Replies

ActionScript 3.0 :: Flash Character Random Movement?

Feb 24, 2011

I want to make my character moves randomly that is character will base on random numbers(for example generate 4 random numbers) and character's favorite(for example fast food, west food, Chinese food) to move. The character will move randomly with 4 direction that is move up, move down, move right and move left(any speed will do). Should i have four function with four movement.

View 1 Replies

ActionScript 2.0 :: Play To And Stop (character Movement MC)?

Jul 16, 2004

I have a MC which is a lady that raises her arms up and down. From the main timeline i want to tell that "ladyMC" (also sitting on the main timeline) to play to and stop on specific frames. I have tried it two different ways but am obviously missing something. The first way i tried just using an if/else and getting the current frame #.

Code:
if(lady._currentframe < 22){
lady.play();

[code]....

View 2 Replies

ActionScript 2.0 :: Character Movement Though Rotating Round Surface?

Feb 10, 2008

i want a character to move on a globe. the movement of the character is shown though not by shifting the positions of the caharcter but by the rotation of the surface of the globe. buttons are used to move leftward and rightward.

Also, there are three layers of the globe to show depth. how would i script it so that the layers of the globe rotate at different speed?

i've uploaded a zipped of a fla file.

View 3 Replies

ActionScript 3.0 :: Character And Background - Creating Illusion Of Movement

Mar 12, 2009

Right basically I have a character and a background. The background scrolls as you press left or right on keyboard to create the illusion of movement. I want the character to flip when you change from holding down left to right and vice versa, but when I do the following code it doubles the size of the character once and then it stays. It flips fine but in the transformed fat size.

Here's the code:
var mySpeed:Number = 10;
function keyIsDown(evt:KeyboardEvent):void{
if(evt.keyCode==Keyboard.RIGHT){
walkingPlane_mc.x+=mySpeed;
greyCharacter_mc.scaleX=-1;
[Code] .....

View 4 Replies

ActionScript 3.0 :: Running Movement Of The Character And The Second Frame Is On Standing Position

Dec 20, 2010

RIGHTNOW, Im doing my game development but I have problem based on my game control.this is my question..
 
I have two frames. the first frame is on running movement of the character and the second frame is on standing position.This two frames has only one kind of character,but I seperated the two movement in two frames witch are running and standing positon.my problem is how can I do the mouseEvent,if onclick the character will continue on running and if on release the character will do is to standing position.

View 2 Replies

ActionScript 2.0 :: Collision - Character Shall Stop Movement If He Hits A Geometry

Aug 7, 2008

am pretty new to Kirupa and Flash. I have a little problem, concerning a character hitting a wall. What i have: a char that can jump and move around by the arrow keys. What i need: character shall stop movement if he hits a geometry. But being able to start movement again, besides through the geometry. I'd like to reach this with gskinners CheckForCollision class. Have a look here: [URl] But i didnt manage my code to get it work. So maybe you could leak me some information on how to get this done. Heres my code so far:

[Code]...

edit admits: so far i have a character mc called "player" and one called "level". i would apply the code to the player, and it would be cool to have the possibility to check collision of the player with multiple MCs, not only the level.

View 2 Replies

ActionScript 3.0 :: Codes They Are Using A VerticalChange Variable For The Time-based Character Movement?

Jun 2, 2009

sample codes. In those codes they are using a verticalChange variable for the time-based character movement.But I can't figure out how this code works and why we needthose calculations - char.dy*timeDiff + timeDiff*gravity?So here is the code:

Code:
// assume character pulled down by gravity
var verticalChange:Number = char.dy*timeDiff + timeDiff*gravity;

[code]....

View 4 Replies

Professional :: Character Amimation- Stop(); Not Working?

Apr 2, 2011

I am trying to write code for my char animation. in the scene I have 4 layers: character, sky, ground and actions. all are to symbols(except actions of course) .For my character symbol(movieclip) I have one still frame as default, 2 walk cycles, and a jump. all done on a timeline. the main problem im having is that it doesnt stop, as it is supposed to, on the first default frame.

i put stop(); in the first frame of the movieclip and wanted to do my code in the actions layers in my scene but this stubborn character will not stop and I dont know what to do.....

View 3 Replies

ActionScript 3.0 :: MC On Main Timeline - Movement Function Not Working

Mar 20, 2011

Code:
package {
import flash.display.MovieClip
import flash.events.Event
import flash.events.*
public class Main extends MovieClip{
Main is my document class, and player is a MC on the main timeline.

View 1 Replies

Flash - YouTube Player Not Working Without Continuous Mouse Movement Over It?

Oct 15, 2010

What can be the cause of the YouTube player not working (playing, buffering, firing api events) if I don't continuously move the cursor over the player?

View 1 Replies

ActionScript 1/2 :: Bullets Only Shoot 1 Way?

Mar 4, 2012

this is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.

View 7 Replies

ActionScript 3.0 :: Shoot An Moving Object Exactly In The Center?

Dec 5, 2011

I have a TargetCirlce_mc which moves on "y" axis from top to bottom. And I have an arrow_mc which is on x:100 & y:200. How can I shoot an arrow exactly on the registration point of the TargetCircle_mc (automatically) while it is exactly opposite to the arrow_mc?

View 1 Replies

Flash :: Event Flow In AS3 - Shoot A Bullet?

Aug 11, 2011

My goal is to shoot a bullet everytime I click on ship. What happens, in fact, is that If I click on it once, the bullet is shot, but if I click on it twice before the first bullet is off the screen, the first bullet literally stops(it does not disappear, only stops) and the second bullet is shot.

public var ship:Ship = new Ship();
public var bullet:Bullet = new Bullet();
stage.addChild(ship);[code]...

View 2 Replies

ActionScript 2.0 :: Make A MC Like Shoot A Gun / Something When You Press Spacebar?

Aug 13, 2004

How do you make a MC like shoot a gun or something when you press the spacebar?

View 1 Replies

ActionScript 1/2 :: Get To A Certain Distance Of The Enemy It Should Trace (shoot) - Won't Work

Aug 5, 2011

what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).

[CODE]...

View 6 Replies

ActionScript 2.0 :: [mx] Create Shoot Lasers From The Nose Of The Plane?

Feb 8, 2003

I'm working on a new project, its a side scrolling game where an airplane (user) has to shoot down a bunch of other enemy planes. how to create an AS to shoot lasers from the nose of the plane

View 6 Replies

ActionScript 2.0 :: Making A Movie Clip Shoot A Bullet From It?

Dec 25, 2006

How would you go about making a movie clip shoot a bullet from it, but have the movieclip able to move around, like a sidescroller game...

View 2 Replies

ActionScript 3.0 :: Shoot An Object And Create An Arc Based On An Angle

Sep 21, 2009

I found a basic example of how to create something that'll shoot an object and create an arc based on an angle. I added a power Bar to it, but I noticed something bad about it.

The way it works the higher the speed is the further it goes and the faster it moves across the screen. This doesn't give me enough control. Because essentially I want fast moving projectiles but I want to also be able to shoot both near and far.

With this current system that's an impossibility.. Can anyone shed some light on how I can do this better? Here's the current way it's being done (important parts):

Code:
bullet = new Bullet;
this.stage.addChild(bullet);
bullet.speed = 1 + powerBar.scaleX * 20;

[Code].....

View 2 Replies

ActionScript 3.0 :: Mouseclick Event - Shoot The Zombies, None Of Them Are Clickable?

Oct 11, 2010

When I run the file and try to shoot the zombies, none of them are clickable. I really can't tell what I have done wrong here. Here is my code:

stage.addEventListener(Event.ENTER_FRAME, moveBullseye);
function moveBullseye(event:Event) {
bullseye_mc.x=mouseX;[code].....

View 2 Replies

ActionScript 3.0 :: Undefined Addchild - Make A (missile) Upon Shoot?

Nov 23, 2011

THIS THREAD IS SOLVED.. Answer lies upon a website tutorial. Final Page on this Thread.So far so good, i've gotten most my as2 to as3.. And coming out good Buttons are working, The only last part im working on is upon shooting, it'll bring in the calls to Fire the missle.. (tracein the button works great).

[Code]...

This is what im trying.. But it says undefined use for addchild.. so im taking im missing somthing..

(the missile is a animation graphic i created).I have made a Missile.as to control what the missle does when its addchild is placed on stage. Problem is, (addchild isnt doing it) and im not sure if its going to shoot out the nose of the hero..

View 14 Replies







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