ActionScript 3.0 :: When Press Right Arrow Key It Goes To And Plays The Right Walk?
May 29, 2009
I am making a side scrolling game and I have all my pieces made, background, main character, enemies, wall, floor, etc. I have begun coding it with Action Script 3. I have it to where i have a main menu, and two buttons= one that goes to instructions and one that starts the game. I have my main character as a movie clip and inside the movie clip I have labels- stand, right walk, left walk, jump, duck, fire, and die.I coded it to where when I press my right arrow key it goes to and plays the right walk, down arrow key it plays the duck label.I have a trace on them and they are working. What Im trying to figure out how to do is 2 things. First, when my character gets to a certain spot on the screen, he stops walking and the screen moves, and second how to make the enemies move. Im scripting everything internally and not using any classes for this game.
View 1 Replies
Similar Posts:
Aug 9, 2011
I have made my character and inside of its symbol I created its stand still - stop(); - frame before its left and right walking cycles which are both 5 frames long. Now my question is what action script do I use to move both left and right while activating my walk cycle when the arrow is down. Would someone please write out the script for me?
View 2 Replies
Feb 4, 2010
I am making a walk and jump game. My game would work by the character standing in a fixed place and when I press the left key he would appear to walk left but the background actually is moving right. And when I press the right key the background would move left making the character appear to move right. Now I would also like the character to jump when I press the up key. Now I have created a walk cycle in a movie clip and have a jump cycle that I could also use for the jump.
View 6 Replies
Mar 19, 2004
I have 3 movie clips lined up as buttons. When you rollover one, the others fade out to an alpha of 20. I also added an arrow that is called when I click on a mc to align it self to the top center of the mc. When I added the arrow I lost my fading. Somewhere in the actions is messing this up.Here is a fla file. I am using Flash MX actionscriptI also have Flash MX 2004 but I dont like it.
View 10 Replies
Oct 22, 2010
I have an arrow which I can control with the UP and DOWN keys. They move to a specific y coordinate when I press the arrow keys. What I want is when the "play" text is "selected" by the arrow to go to a frame called "levelone". But I can't make it work This is my current code:
Code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
[code].....
View 2 Replies
Feb 5, 2005
i want a my_mc to move when i press the < LEFT> arrow but also to fire and onEnterFrame event so it will move.. and also to delete the onEnterFrame when the key is not pressed so the onENterFrame is not going on in the background
View 4 Replies
Jul 4, 2011
Ive used mediaplayback component on a webpage and it works fine except the playhead pointy thing doesnt move as the video plays. Isnt it supposed to do that ? It just stays at the start while the video is actually playing.If i drag the pointer to a different part of the streaming bar then it does what its supposed to do but that doesnt look right.
View 2 Replies
Apr 26, 2009
i'm habing abit of problem with this code, its supposed to play pause and stop, the problem being that when i press stop then play it only plays from the last pause and not the beggining how to get it to play from the start after the stop button is pressed
[Code]...
View 1 Replies
Jan 3, 2003
Ok when you press link one it olads great! when i press link 2, it plays the closing animation, but not the entire animation, thats the problem.My closing animation is a red square going from one end to another ( for the hell of it).But you see content number two will load b4 the red square gets all the way across!!
View 2 Replies
Dec 11, 2011
I want my flash file plays one and stops in the end and only plays again if play again button is pressed.How do i do it?
View 1 Replies
Jan 17, 2012
I make 3d models with away3d and import them into flash builder.I can rotate the models like this:
[Code]...
View 4 Replies
Oct 16, 2009
I have my movie clip walk off the left side of stage and come back on the right of the stage. but I cant get it to walk off the right and come back on the left can any one give advise please. this is what I have so far
onClipEvent(load) {
var direction = "left";
var speed = 10 ;
}
[Code]...
View 2 Replies
Apr 25, 2011
8-frame walk cycle in flash?I wanted it as a template as I had several attempts to make it ...unsuccessfully unfortunately...
View 1 Replies
Oct 16, 2009
I have code that I wrote(myown and tutorials) and I am having some issues. The object is to make the ball walk to the box and pick up the item. When the pick up occurs the item(box) needs to disappear.
mcMain is the character(ball)
mcCoin is the item(square)
Code:
Variables for key downs
var leftKeyDown:Boolean = false; //left key down false
var upKeyDown:Boolean = false; //up key down false
var rightKeyDown:Boolean = false; //right key down false
var downKeyDown:Boolean = false; //down key down false
var mainSpeed:Number = 7; // speed of character
[Code] .....
View 1 Replies
Sep 16, 2011
I'm trying to animate a walk cycle but I fail miserably. Here's a link to the feet portion of the walking.
View 1 Replies
Nov 6, 2010
xml stuff in action script is so... non-intuitive.. cubersome I can compare it to the xml libs that I used in playground sdk, popcap and other .. tinyxml.. ....
I' m trying to make that simpliest thing for about 2-3 hours.. + reading books.. and still can't do it..
what I want to do is:
<xml>
<Weapons>
<Weapon id="canon" rechargeTime="200" impulse="30">
[Code].....
how do I read the all "Weapon" objects listed inside Weapons.. NOTE: I dont want to use the method.. that returns "Weapon" from all over the xml... cause I probably want to list weapons in other sections for other purposes
View 2 Replies
Apr 13, 2008
im having a bit of an issue with making a character walk to a position when the area is clicked (but i dont want them to move on the y scale, just the x). i dont want them to instantly move, i want them to (flip over if necessary) and play their walking animation as they walk to the clicked position.
View 1 Replies
Jan 13, 2009
How can i make it so a when you press a button it starts a countdown but every other press dosent reset it?
View 14 Replies
Aug 6, 2004
I want to animate the human walk in flash from plain walking to running. Is there any location from where I could pick up the animation sequence either directly or for modification in photoshop etc.?
View 1 Replies
Jun 26, 2008
Using AS2, how can I have a character movie clip walk along a line/curve without falling through it? By this I mean the character could say, walk over a hill whilst jumping (falling back down due to gravity physics) but would not fall through the curve that represents the hill.An example of this would be BMX star or BMX backflips and any game that is a side-on view of a character walking.
View 1 Replies
Mar 13, 2010
I have a problem when I making a game Flash with action script 3,. I want tomake my character move when the key helding and I want my character attackwith one tab press either
View 3 Replies
Aug 29, 2011
I have text field which is 0 by default (score_txt)Two buttons +1 and -1 (plus_btn and minus_btn) When I press +1 text increases by one, and when i press -1 it decreses
View 4 Replies
Aug 30, 2011
I want my movie to loop. Would prefer an If/Else loop so that the movie plays a certain number of times then plays the opening of a screen then stops. This is a simple 4 screen ad I am doing for a school project. Can't get it to work. I tried containing my code in the proper loop syntax, didn't work. Then wrapping the loop in a function and calling that with a timer event, didn't work. My final solution was to call my whole movie in a timer event set to play once. Then calling the entire movie again in a second timer event set to play 20 times and set to start at an interval when the first movie ended. This did work but each time the movie plays thru function calls drop off making the movie degrade.
[Code]....
View 5 Replies
Apr 13, 2012
i want my character to walk down the screen and hit the objectWall and then a movieclip then gets added to the stage and plays but it doesnt seem to work and ii dont know why.
[Code]...
View 1 Replies
Jun 17, 2005
i have an object that i want to drag and drop with the same event.Something like on press start drag and on press again stop drag. I'm sure it's pretty simple with and if and else statment but i can't find how to do that...The best i have done so far was this:
[Code]...
View 4 Replies
Mar 5, 2011
I have been working on a tutorial in Flash on the topic of Flash () for two days, and I am just finishing up on a template. I have fixed five bugs, but I cannot think of how to fix this last one. I'd rather actually fix the problem this time, instead of improvising . So, here is what is going on:
I have this thing at the end where you have to enter in the code that I taught the viewer to proceed, then hit the continue button to finish the tutorial. But for some reason, whenever I try to go back with the back arrow, it does, but then I can't go forward with the forward arrow until I reach the first frame that contains actual tutorial ("page" 2). Then it works again. It seems really random, but there is [obviously] a good explanation for it. I thought it might have something to do with the fact that all of the arrows up to the "test" part, excluding the back arrow there, have the exact same instance name. However, "page" 2 is the 2nd time it is used (introduction, then the "page" 2, then 3, 4, 5, and 6, then the test part thing), so it makes less sense that it would work the 2nd time, but not the third, fourth, fifth, or sixth. And I know there's nothing wrong with the code itself:
[Code]...
View 3 Replies
Sep 13, 2009
It lets you move a Cube, with the arrow keys on the keyboard. This is the code.
Code:
function hearKey(yourEvent:KeyboardEvent):void{
if (yourEvent.keyCode==Keyboard.RIGHT){
cube_mc.x+=5
[Code]....
I keep pressing the down key down and also press the left key down...
now it moves left...(not so good, i want it to move both left and down, how do i do that?)
now i release the left key but am still on the down key....
View 1 Replies
Jul 14, 2009
The objective is to get the fox - by using the arrow keys - to move around on the stage and when he touches a duck the duck should disappear of the stage. The duck has a motion tween on it, to make it fly.Also if the fox touches one of the traps he should make a sound - using the redfox.wav sound in the library and disappear off the stage.I have this code on the actionscript timeline //Program to generate a set number of traps
//Declaring Variables var numOfTraps:Number; var movieWidth:Number; var movieHeight:Number; var counter:Number; //setting variables values for traps numOfTraps = 6 movieWidth = Stage.width; movieHeight = Stage.height; //Program to generate a set number of traps //Declaring Variables for (counter = 7; counter <= 13; counter++){ //Place 6 traps on the stage [code]....
View 11 Replies
Nov 9, 2009
Is there a quick way to draw an arrow in Flash? I have seen postings from 2006 which say there isn't, but I wondered if there is a way in CS4?
View 1 Replies
Jan 8, 2012
I'm trying to program an arrow flying in the air, but the speed doesn't look well. But now the arrow moves very slow, here's a sample. (I know the arrow and the trajectory doesn't match 100%, it's just a sample.)
[Code]...
And now it looks good, but can someone tell me why I need to do this while in physics it normally would fly 15 times too fast?
View 1 Replies