HOME | DD

JohnJensen — NEW Awesome Platformer Tut

Published: 2007-04-05 13:58:52 +0000 UTC; Views: 5637; Favourites: 67; Downloads: 102
Redirect to original
Description Yes...

SET YOUR FPS TO 30! (IF YOU DUNNO HOW TO CHANGE THE FPS, CHECK A TUTORIAL IN MY SCRAPS)

..Scroll with the arrows in the top right! 8D

THE CONTROLS OF IT ARE:
Right and left - Walk
Up - Jump

The script features:
- Jumping (duh)
- Walking up and down through hills and such.
- Scrolling


If you cannot copy the script for some stupid reason you can copy it here:

onClipEvent (load) {
this.stop();
speed = 6;
jumpheight = 18;
fallspeed = 2;
gravity = 10;
scale = _xscale;
}
onClipEvent (enterFrame) {
if (_root.ground.hitTest(_x, _y, true)) {
air = false;
} else {
air = true;
}
if (air) {
_y += gravity;
}
if (air && gravity>0) {
this.gotoAndStop(4);
}
if (air && gravity<0) {
this.gotoAndStop(3);
}
if (Key.isDown(Key.RIGHT)) {
_root.ground._x -= speed;
_root.tra._x -= speed;
_xscale = scale;
}
if (Key.isDown(Key.LEFT)) {
_root.ground._x += speed;
_root.tra._x += speed;
_xscale = -scale;
}
if (!air && Key.isDown(Key.RIGHT) || !air && Key.isDown(Key.LEFT)) {
this.gotoAndStop(2);
}
if (!Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT) & !air) {
this.gotoAndStop(1);
}
if (Key.isDown(Key.UP) && !air) {
_y -= 5;
gravity = -jumpheight;
}
if (gravity<10) {
gravity += fallspeed;
}
if (_root.ground.hitTest(_x, _y-5, true)) {
_y -= 5;
}
if (_root.tra.hitTest(_x, _y, true)) {
_y -= 5;
gravity = -23;
}
}

ENJOY 8D


BTW, If you are a good scripter, you'll notice that some of the stuff in the action script, is not used! Just some piece o' code which could be used, but not did!
Related content
Comments: 130

mine22mine [2012-04-10 12:13:44 +0000 UTC]

d'you have any tutorials on shooting projectiles in AS3?.. i'd love to learn some of that..haha..

👍: 0 ⏩: 0

englandsBrows [2012-02-03 00:59:49 +0000 UTC]

It keeps falling through the ground
HOW DO FIX

👍: 0 ⏩: 1

JohnJensen In reply to englandsBrows [2012-02-03 08:29:01 +0000 UTC]

Make a gameover frame and reply to me when you've done that :>

👍: 0 ⏩: 1

englandsBrows In reply to JohnJensen [2012-02-03 16:20:54 +0000 UTC]

still nothing :C

👍: 0 ⏩: 0

crysta789 [2011-11-26 23:45:50 +0000 UTC]

what do you use to make the game? you didn't explain good enough

👍: 0 ⏩: 1

JohnJensen In reply to crysta789 [2011-11-28 07:51:26 +0000 UTC]

Adobe Flash. You can download it on adobe.com

👍: 0 ⏩: 2

crysta789 In reply to JohnJensen [2011-11-28 22:56:13 +0000 UTC]

um which one do i download

👍: 0 ⏩: 1

JohnJensen In reply to crysta789 [2011-11-29 08:53:17 +0000 UTC]

Adobe Flash Professional CS5.5.

Get the 30 day free trial

👍: 0 ⏩: 1

crysta789 In reply to JohnJensen [2011-11-29 12:47:29 +0000 UTC]

kk thanks

👍: 0 ⏩: 0

crysta789 In reply to JohnJensen [2011-11-28 18:53:35 +0000 UTC]

kk thanks

👍: 0 ⏩: 0

redligot2009 [2011-07-08 09:24:03 +0000 UTC]

copy and paste the codes? why not explain the code?

👍: 0 ⏩: 1

JohnJensen In reply to redligot2009 [2011-07-08 17:35:32 +0000 UTC]

Hmm, well, since most people here are 12 year olds just wanting to get a game to work.

I guess that was the best answer for your question.

👍: 0 ⏩: 2

hamza62240 In reply to JohnJensen [2012-10-29 14:30:38 +0000 UTC]

Sorry but i'm seven, i made some game from another tut

👍: 0 ⏩: 1

JohnJensen In reply to hamza62240 [2012-10-29 15:56:23 +0000 UTC]

Are you...7? Seriously?

👍: 0 ⏩: 1

hamza62240 In reply to JohnJensen [2012-10-30 09:40:55 +0000 UTC]

Yeah, Seriously. I have no proof

👍: 0 ⏩: 1

JohnJensen In reply to hamza62240 [2012-10-30 11:57:43 +0000 UTC]

Your spelling capabilities and your artwork definitely exceed the average 7-year old, congratulations with that. This is really not to be offensive or anything, but are you diagnosed with autism or asbergers? Or are you just a young brilliant mind?

👍: 0 ⏩: 1

hamza62240 In reply to JohnJensen [2012-10-31 14:27:57 +0000 UTC]

Young, brilliant mind. and thanks, many people don't believe i'm that young....

👍: 0 ⏩: 0

redligot2009 In reply to JohnJensen [2011-07-09 05:36:52 +0000 UTC]

oh ok.

👍: 0 ⏩: 0

KiaraTheNightFury [2011-01-08 14:17:32 +0000 UTC]

OH NOES! I fell!

👍: 0 ⏩: 0

xXSchattenschmerzXx [2010-11-10 15:24:05 +0000 UTC]

Awesome!

👍: 0 ⏩: 1

JohnJensen In reply to xXSchattenschmerzXx [2010-11-13 15:40:27 +0000 UTC]

Haha, thanks, I hope you found it useful for your video game development dreams. ;)

👍: 0 ⏩: 1

xXSchattenschmerzXx In reply to JohnJensen [2010-11-13 15:53:19 +0000 UTC]

You're welcome!
And it's very useful!

👍: 0 ⏩: 0

Leafscatter [2010-10-24 15:07:23 +0000 UTC]

awesome! the onlyu problewm i have is that it keeps playing the 'jumping' animation when he is standingstill - any ideas?

👍: 0 ⏩: 1

JohnJensen In reply to Leafscatter [2010-11-13 15:43:41 +0000 UTC]

Did you remember to put a stop() on each frame inside the movieclip? ;)

👍: 0 ⏩: 1

Leafscatter In reply to JohnJensen [2010-11-15 17:15:25 +0000 UTC]

probably not - thanxs!

👍: 0 ⏩: 0

Gungeophrenia [2010-04-28 06:27:42 +0000 UTC]

Wait what? How do you make an animation in one frame? X.X

👍: 0 ⏩: 1

Narusim1 In reply to Gungeophrenia [2010-06-17 02:33:59 +0000 UTC]

Movieclips.

👍: 0 ⏩: 0

Cynderforever [2010-03-20 01:13:46 +0000 UTC]

How do you add color? And What program?

👍: 0 ⏩: 0

Cynderforever [2010-03-20 01:12:34 +0000 UTC]

Cool!!! The game looks fun, exept, I just fell off... gotta comment to fix it.

👍: 0 ⏩: 0

rboyz [2009-12-23 08:21:31 +0000 UTC]

Thanks for the nice platformer script! It works very well .. I'll use it as the base script for my game

👍: 0 ⏩: 1

JohnJensen In reply to rboyz [2009-12-23 19:12:21 +0000 UTC]

You're welcome (;

👍: 0 ⏩: 0

KnebulaNight [2009-11-21 03:19:12 +0000 UTC]

Hohoho, while this isnt exactly what I wanted for my game, it's the best I could find. Just letting ya know I'm usin this script for my flash :3

this is the prototype preview: [link]

👍: 0 ⏩: 0

Salioka-chan [2009-08-20 19:55:18 +0000 UTC]

Excuse me,

I know you made this a very long time ago but I would like to ask a question.

When you say when inside the movie clip make another frame, it being the second frame you make the character run in it. But if you make that a full animation then it would take up more than the third and forth frames too.

So my question is this,
is there a way to confine animations inside the movieclip to one frame while not chopping it?

Well my main reason for asking is that I can't seem to make it work.

Thank you very much for your time.

👍: 0 ⏩: 0

Thundaboom [2009-07-05 17:02:55 +0000 UTC]

THANK YOU

THANK YOU


THANK YOU

👍: 0 ⏩: 0

YoshiOG1 [2009-04-17 20:13:47 +0000 UTC]

thanks for the tutorial! i made my game so that there's an elevator you can jump in to get to the top.

👍: 0 ⏩: 0

Dumb2Wise [2009-03-23 20:51:19 +0000 UTC]

I keep falling through the ground >.<

👍: 0 ⏩: 0

Orangerad2 [2008-12-28 21:41:24 +0000 UTC]

sorry but i dont get where exactly do you put the ground movie clip like what frame or wutever

👍: 0 ⏩: 1

JohnJensen In reply to Orangerad2 [2009-01-06 11:11:02 +0000 UTC]

On the frame the player movie clip is on

👍: 0 ⏩: 0

bl00db47h [2008-11-08 17:39:25 +0000 UTC]

how do you make the animation within the keyframes? do you just draw still pics?

👍: 0 ⏩: 0

blibbybot [2008-09-20 11:15:47 +0000 UTC]

how can i make the cam always follow the character centered, even when they fall of the ground?

👍: 0 ⏩: 1

JohnJensen In reply to blibbybot [2008-09-20 20:46:28 +0000 UTC]

I'd make a few adjustmens to the programming, but I always have some issues with the ground and keeping the character centered when the ground also moves up and down.

👍: 0 ⏩: 0

CruxisWarrior [2008-02-20 23:16:14 +0000 UTC]

Is this THE PP Jensen?
=o

👍: 0 ⏩: 1

JohnJensen In reply to CruxisWarrior [2008-02-21 17:18:38 +0000 UTC]

Who?

👍: 0 ⏩: 0

icallyoulemon [2008-01-07 02:34:07 +0000 UTC]

On each fram, does it mean make a seperate symbol for the animation?

👍: 0 ⏩: 1

JohnJensen In reply to icallyoulemon [2008-01-07 15:52:39 +0000 UTC]

Yup.

👍: 0 ⏩: 0

PaggosIchor [2007-10-29 21:37:21 +0000 UTC]

where did you learn this stuff?

👍: 0 ⏩: 1

JohnJensen In reply to PaggosIchor [2007-10-30 13:23:47 +0000 UTC]

I dunno

👍: 0 ⏩: 0

silent908 [2007-10-27 11:13:46 +0000 UTC]

Oh, can you change the code? Cuz if you go into a block of ground you float ALL the way up.

👍: 0 ⏩: 0

silent908 [2007-10-27 11:10:15 +0000 UTC]

Kinda lame, but amusing!

👍: 0 ⏩: 0

silent908 [2007-10-27 11:06:06 +0000 UTC]

I made this : [link]
with your tutorial. I just added Tweens!

👍: 0 ⏩: 0


| Next =>