Movement while jumping help

Hello! I am very new to the use of flash/actionscript 3 and I started to create a very simple game, but I'm really stuck on getting my character to move by jumping. For the moment, she can move and jump, but not at the same time. I tried to look into this but I can't seem to get anything to work. Again, I am new so any help would be great appreciated! This is the encoding that I stripped to any movement of character so far.

Stop();

Gravity 'weight '.

var gravity: Number = 10;

skip the 'power '.

var jumpPower:Number = 10;

is the drive already jumpting?

var isJumping:Boolean = false;

placement of the ground

var field: Number = 377 - thief_mc.height;

Listening on a button

stage.addEventListener (KeyboardEvent.KEY_DOWN, onKeyPress);

Wait for the unlock key

stage.addEventListener (KeyboardEvent.KEY_UP, onKeyRelease);

stage of the update

stage.addEventListener (Event.ENTER_FRAME, update);

on key press

function onKeyPress(evt:KeyboardEvent):void {}

If you press left, walking to the left

{if(evt.keycode==Keyboard.Left)}

thief_mc.gotoAndStop ("walkleft");

thief_mc.x-= 10;

}

If you press right, walking straight

else {if(evt.keyCode==Keyboard.RIGHT)

thief_mc.gotoAndStop ("walkright");

thief_mc.x += 10;

isJumping = true;

}

Press space to jump

{if(evt.keycode==Keyboard.Space)}

{if(!isJumping)}

jumpPower = 30;

isJumping = true;

}

}

}

on the unlock key

function onKeyRelease(evt:KeyboardEvent):void {}

If the arrow to exit left side forward

{if(evt.keycode==Keyboard.Left)}

thief_mc.gotoAndPlay ("Idle");

}

If release straight facing forward

else {if(evt.keyCode==Keyboard.RIGHT)

thief_mc.gotoAndPlay ("Idle");

}

}

calculation on how thief_mc high jump and where he jumps too.

function update(evt:Event):void {}

{if (isJumping)}

thief_mc.y = jumpPower;

jumpPower-= 2;

}

If (thief_mc.y + gravity < ground)

thief_mc.y += gravity;

else {}

thief_mc.y = Earth;

isJumping = false;

}

}

If you treat the market in the same way as you d the jumping, it should be easier to manage.  Something like...

Gravity 'weight '.

var gravity: Number = 10;

skip the 'power '.

var jumpPower:Number = 10;

is the drive already jumpting?

var isJumping:Boolean = false;

placement of the ground

var field: Number = 377 - thief_mc.height;

var isWalking:Boolean = false;

var direction: Number = 1;

Listening on a button

stage.addEventListener (KeyboardEvent.KEY_DOWN, onKeyPress);

Wait for the unlock key

stage.addEventListener (KeyboardEvent.KEY_UP, onKeyRelease);

stage of the update

stage.addEventListener (Event.ENTER_FRAME, update);

on key press

function onKeyPress(evt:KeyboardEvent):void {}

If you press left, walking to the left

{if(evt.keycode==Keyboard.Left)}

thief_mc.gotoAndStop ("walkleft");

direction = - 1;
isWalking = true;

}

If you press right, walking straight

else {if(evt.keyCode==Keyboard.RIGHT)

thief_mc.gotoAndStop ("walkright");

direction = 1;
isWalking = true;

}

Press space to jump

{if(evt.keycode==Keyboard.Space)}

{if(!isJumping)}

jumpPower = 30;

isJumping = true;

}

}

}

on the unlock key

function onKeyRelease(evt:KeyboardEvent):void {}

If the arrow to exit left side forward

{if(evt.keycode==Keyboard.Left)}

thief_mc.gotoAndPlay ("Idle");
isWalking = false;
}

If release straight facing forward

else {if(evt.keyCode==Keyboard.RIGHT)

thief_mc.gotoAndPlay ("Idle");
isWalking = false;
}

}

calculation on how thief_mc high jump and where he jumps too.

function update(evt:Event):void {}

{if (isWalking)}
thief_mc.x += direction * 10;
}

{if (isJumping)}

thief_mc.y = jumpPower;

jumpPower-= 2;

}

If (thief_mc.y + Gravity<>

thief_mc.y += gravity;

else {}

thief_mc.y = Earth;

isJumping = false;

}

}

Tags: Adobe Animate

Similar Questions

  • Satellite L350D - 20 d - movie playback jumps only if disconnected from headset

    welll I got another but a very weird problem with my laptop speakers... its starts when I saw my last movie HD maded... its just 720 p but... when I plugged in the headphones to the laptop everythink is fine.

    BUT when I disconnect head portable phones and I use laptop speakers, as in CLOCK with perfection synhroniation, my movie beginning to have problems with mininova on WinMediaPlayer.

    All felling in the same places executives jump and the whole system is overloaded... From the CPU to 100% USAGE is even one vid HD 720 p. What is weird movie still jump and make stops in same place ALWYAS BUT WHEN I DISCONNECT HEADPHONES! weird... cuz film is perectly smooth and error-free or jump or framing problems when I watch the same movie using connected headset for laptop.

    I was simply not done posting on forum abuts this cuz its sounds makes no sense, but it happened today.
    Which, in my view, it may be some vibration Toshiba speakers which are serious problems on the motherboard or processor am not completely sure... but defenytly its weird...

    When I watch this movie with head phones and sounds through everythink pregnant headset is fine but only I disconect head phones films had serious problem in the game... This is for some disturbrance of Toshiba speakers... or right speakers are bad for this laptop?
    Maybe to big magnezium? What making magnetic disturbrance on the motherboard? not sure, but it still happens

    Hello

    I think your problem has nothing to do with the speakers
    You said that the CPU usage increases and that the system is overloaded
    This is the reason why the movie does not run smoothly

    Now, you should check what system process the cause
    If this problem would appear, start the Task Manager and check under the processes tab.
    You can see the process that stresses the CPU and verrouillerait material resources close this process would be useful

    In your case I would google for more details on the background process and possibly one of the installed 3rd party software and tools cause it

  • Microsoft mouse 3000 - cursor wont move it please help

    original title: I have a mouse microsoft 3000 green light is on ive fact battery but the cursor doesn't move it please help

    I have a microsoft mouse 3000 it simply stopped working Ive changed the battery, the green light is on the Red usb port is on the mouse, but the mouse will not move the cursor

    Hello

    ·          Were there any changes made to the computer until the problem occurred?

    Try the steps in the below article data and check if this is useful.

    http://support.Microsoft.com/kb/838398

    Hope that information was useful

    Amrita M

    Microsoft Answers Support Engineer

  • Resize a movie FLA &amp; jump button (help)

    Hello

    I want to resize an animation Flash (full movie) which had a dimension 448 * 280 pixels size.
    and need to play automatically instead of click the button START INTRO

    someone help me please on this issue,.
    Thank you
    concerning
    zains

    The extent of resizing goes.  If you want to resize the source file then you need to go change the dimensions of the document and then change everything piece by piece to fit into the new dimensions.  The alternative is to simply change the dimensions specified in the html page that includes the file.  This may affect the quality of any bitmap image in the file.

    As regards to the beginning question goes, it is that there is a stop(); command at the beginning of the timeline that you need to remove so that the file is not stopped at the beginning of the year.

  • Movement of jump

    I was not able to get the Motion Leap starts when I turn on my laptop.

    Hello

    You can try all the steps mentioned in the link below and check if it helps...

    Troubleshooting jump movement

    As this is a new laptop, if the problem persists then I recommend you to call the HP Technical Support immediately.

  • movement of jump software

    Just bought hp envy 15 x 360 touchsmart. I play the piano and put sheets of music on my laptop and found out there is no software on my laptop to turn the pages of music without actually in contact with the screen. I was wondering if it is possible to load software of jump movement and what so where can I get this. Or did anyone know of software motion that focus on my hp envy 15?

    Thank you

    wrk17

    Hello

    Your machine has sensor Leap? If not, then No, the software will not work. The sensor will be BREAK under him.

    Kind regards.

  • MOVIES with the HELP of hp DVD CANNOT BURN a DH16AAL SCSI CdRom Device

    I can burn music and play music CDs, but can play any dvd any help please it tells me to insert the disc

    Besides the fact that you have posted in the wrong forum.  (A mod will be soon along move this thread).

    You describe the device as a DVD and CDRom.

    If the drive is a CD player, then the symptoms you describe to wait.  CD player will only recognize the DVD.

    However, your drive may not be a CDRom drive as you say you can burn CDs - a CDRom is unable to burn anything.

    It seems that you have a CD burner, which means that it won't recognize DVD.

    (A DVD burner can read/write CDs, but a CD burner can't read/write DVD)

  • Movie Maker Import help

    Hello

    I keep trying to import my Panasonic camcorder .mpg files in Windows Movie Maker for editing and I get the following error message:

    C:\Documents and Settings\apaulitsch\Desktop\New Folder\20101213\20100101_000000 .mpg (1) could not be imported. An interface has too many methods to fire events from

    Help, please!

    Hello

    I keep trying to import my Panasonic camcorder .mpg files in Windows Movie Maker for editing and I get the following error message:

    C:\Documents and Settings\apaulitsch\Desktop\New Folder\20101213\20100101_000000 .mpg (1) could not be imported. An interface has too many methods to fire events from

    Help, please!

    ================================
    The files that you import are not compatible
    with Movie Maker... their conversion to a compatible
    before importing WMV format is the solution.

    Maybe these articles will propose a few ideas:

    Movie Maker 2 - Import MPEG files
    http://www.Papajohn.org/mm2-importing-video-MPEG2.html

    Type of file with Movie Maker compatibility
    http://www.myvideoproblems.com/tutorials/MovieMaker/File_type_compatibility.htm

    What file type should I use in Movie Maker?
    http://www.myvideoproblems.com/tutorials/MovieMaker/WhichFileTypeInMovieMaker.htm

    Also:

    How to convert an mpeg to WMV
    with Windows Media Encoder?
    http://www.myvideoproblems.com/tutorials/ConvertMpeg2wmv.html

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • How to make a movie for a help file?

    All Howdee.

    Over the years, I've seen blogs, online Web pages, etc. that animated or movie files to demonstrate how to perform account operations in a program window - such as office, etc...

    As I thought about it, it seems that it would be necessary to use movie maker, or some other utility.

    I can see where using a camera may be necessary, but many of the films simply appear as if they were actually an animated screen capture. Or some kind of movie as activity of what is happening directly on/in from the screen.

    Anyone knows how this is done? The help files that describe the processes and programs/tools required to make these?

    TYIA...

    All Howdee.

    Over the years, I've seen blogs, online Web pages, etc. that animated or movie files to demonstrate how to perform account operations in a program window - such as office, etc...

    As I thought about it, it seems that it would be necessary to use movie maker, or some other utility.

    I can see where using a camera may be necessary, but many of the films simply appear as if they were actually an animated screen capture. Or some kind of movie as activity of what is happening directly on/in from the screen.

    Anyone knows how this is done? The help files that describe the processes and programs/tools required to make these?

    TYIA...

    ==========================================
    I suspect that some of the tutorials that you saw were created with
    Camtasia Studio... but it's a bit expensive, then you might find the
    free Windows Media Encoder to be a good place to start.

    Camtasia Studio:
    http://www.techsmith.com/Camtasia.asp

    Windows Media Encoder 9 Series
    http://www.Microsoft.com/downloads/details.aspx?FamilyID=5691ba02-e496-465a-bba9-b2f1182cdf24&displaylang=en

    First steps with screenshot
    Using Windows Media Encoder
    http://www.Microsoft.com/windows/windowsmedia/HOWTO/articles/ScreenCap.aspx

    Using the Windows Media Encoder to record speech
    http://online.Worcester.edu/external/it/guides/Shared%20Documents/mediaservices/InstructionsforrecordingspeechwithWindowsMediaEncoder.PDF

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Problems of movie maker, need help ASAP!

    Whenever I have publish a movie the percentage stops and the time remaining to post increases. The projects are not yet as long and this prolem was source of delays so :(
    Can someone help me please! It is very often!

    See this page of my website for lots of info on not being able to record a movie... MovieMaker-questions - CantSaveMovie.html

    most common questions using source files which are types of files Movie Maker does work well with... and make the project that is so complex that your computer does not have enough memory to make it. But there are other possible reasons.
  • The arrow keys causing window to move while playing facebook games

    When I play a tetris game in Facebook, if I use the arrow keys on my keyboard to try to move game pieces, it rises and falls throughout the window.  Y at - it a setting I have to use to leave the keys to work within the window?

    Hi 2Warped757,

    A. If it works well before?
    B. you play this game for the first time?
    C. is this game using the arrow keys support?

    Try to select the song with the mouse and then use the arrow key to move. Also check the game settings.

    Bindu S - Microsoft Support

    [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • my Start button is moved to the side and I can't it back in the lower corner have tried dragging, but it won't move anyone can help

    How can I get my Start button to the corner have tried dragging, but does not work can you help me

    Hello

    see if that helps

    http://Windows.Microsoft.com/en-us/Windows-Vista/unlock-and-move-the-taskbar

    Unlock and move the taskbar

    Once you unlock the taskbar, it is ready to move to any horizontal or vertical office edge.

    Taskbar

    View all

    To unlock the taskbar
    • Right click on a space empty in the taskbar. If a checkmark beside him doesn't lock the taskbar, the taskbar is locked. You can unlock it by clicking on lock the taskbar, which removes the check mark.

      Note

      To lock the taskbar into place, right-click an empty space in the task bar, then click on lock the taskbar, so that the box is displayed.

    • Click on an empty space on the taskbar, and then hold down the mouse button, dragging the taskbar to one of the four sides of the office. Once the taskbar where you want, release the mouse button.

  • Cursor move while typing

    I've seen many, many comments on this issue, but none of the suggestions have solved my problem. I just bought this HP EliteBook with Windows 7 and MS Office 2013. It doesn't have a touch screen. The problem occurred in my other computer laptop with Windows 7, but not nearly as bad as on the new. I've updated the keyboard and mouse. I ticked the box "hide the mouse pointer when you type. The Ctrl key is not near the space bar, so I'm not accidentally hit instead of the space bar. This seems to be a problem specific to laptops. Is there a solution? It is almost impossible to use this laptop.

    I chose "Email and Communications" as the topic, but this applies to any that I type.

    Hello

    You can refer to the suggestions of Vinod N replied on 12 May 2011 and check if it works.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-hardware/how-can-i-stop-my-cursor-from-jumping-around-when/4815b646-db7b-E011-9b4b-68b599b31bf5

    Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.

  • external hard drive move... help me I am old and weak

    I bought the new iMac, huge screen... xcant waiting.  in any case, all the files migrated from old macbook to the new iMac. Images of presets etc. ext HD... LR does not see HD says I don't have any pictures. Hehe SUSPECT IT IS A MYSTERY BUTTON SOMEWHERE  help me to reconnect.  you want to use new computer!  waaaaaa

    You transfer the catalog to the new computer file and then open it?

    If so, please read this document:

    Adobe Lightroom - find moved or missing folders and files

    If this isn't the case, then it's what you need to do. More details: How can I move Lightroom to a new computer? Lightroom Queen

  • First cc only import audio .mov file, please help

    My friend sent me a .mov file, it has a mac, I have a PC, when I import it to the first cc, there is sound. I can see the video on VLC Player. I'm not very technical. Help, please! Any suggestions? Thank you

    If you're on a PC, you have installed QuickTime?

Maybe you are looking for

  • Satellite P300 - how to install Windows 7 64 bit?

    Hello I had a Toshiba Windows 7 upgrade for my P300 which was under Vista 32 bit. During installation, asked me if I wanted to install 32-bit or 64-bit Windows 7 and I chose 32-bit. Installation worked fine. Now (moths later) I decided that I would l

  • photos extensions option says not activated pictures

    After opening photos on my mac and will amend, extensions, more a box appears saying that pictures do not activated and no extensions appear in the corresponding box.

  • Fastest time expected update - NI 9265 current of output

    I use an output module current 9265 with 9174 chassis.  Basically, I want to read in a text file, analyze a value to a certain dt (at the present time, I am 20 Hz) and writing a value to the card, which will control a valve.  Break down: adjustment p

  • stuck at 'installation of 28 of the 32' updates Windows 7 64 bit

    I read all the discussions on this issue without a bit of luck.  Updates are automatic, so I don't know isn't including a "28" and he has been blocked all day.  I turned off the computer with the power button / stop since I can't access at the start

  • Make CD covers and inserts for boxes

    HelloI want to a CD and insert for a green jacket. I have the images and the ready text, currently in a mixture of PowerPoint and Word. What is the best way to create something that looks good and is the right size, please? My group has just complete