First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Jesse
function checkForKeys(){
			char.xSpeed = 0
		char.xSpeed += .5
		char._xscale = -100
	} else if(Key.isDown(Key.RIGHT)){
			char.xSpeed = 0
		char.xSpeed -= .5
		char._xscale = 100
	} else {
		char.xSpeed = 0
	if(Key.isDown(Key.UP) && char.jump!=true && char.falling==false){
		char.ySpeed = 12.5
		char.jump = true
		char.ySpeed -= .5
		char.ySpeed = 0
		char.jump = false
	char._y -= char.ySpeed
	world._x += char.xSpeed

This is pretty long, but it’s something that’s easy to remember, if you think about all the variables. First, we change the character’s xSpeed if the left or right keys are pressed. The character’s _xscale property changes to add more of a feel to it. Note that in the character movie clip, his x position is -25. This is because otherwise, his position would change when the left key was pressed. If his xSpeed is in the other direction, it is set equal to zero, so you can go in the other direction quicker. If neither key is down, the character’s position stays the same. Then, if the up key is pressed, and the character isn’t jumping and isn’t falling.(we’ll use these variables later) His ySpeed variable is set to 12.5(normally this wouldn’t be so high but we want our character to go really high so people will be amazed) Also, the jump variable is set to true, so he can’t jump again. We will use this variable later. Then, if jump is set to true, the character’s ySpeed will gradually go down, then we make it so that when it’s the opposite of what it started as, it goes back to 0, and jump is set to false. Finally, we make the character move according to it’s variables. Note that in this game, the world moves according to the character’s xSpeed. In some games, this won’t happen. On the next page, we’ll check for collisions. This will include the falling variable we used earlier. Take note because collision checking in these games is much more complicated than in my other tutorial

» Level Intermediate

Added: 2004-12-29
Rating: 6 Votes: 14
(10 being the highest)
» Author
I love making flash games but it's really annoying when Flash doesn't work!
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.