PDA

View Full Version : PLatform tutorial in 7 steps



Pablo123456789
July 3rd, 2005, 10:09 PM
I made this tutorial for all you noobs its how to make a platform game in 7 steps
Step 1.create character movie clip

Step 2.Inside Character_mc create 3 frames

step 3 name frame 1 Idle frame 2 walking frame 3 jump

Step 4 in frame 1 just put the hero standing

step 5 frame 2 make a movie clip of the character walking in the same place

step 6 in frame 3 draw how the character will look when he jumps

step 7 go to main timeline in the m_c put these actions

onClipEvent (load) {

gravity = 10;

scale = _xscale;

walkSpeed = 6;

maxjump = 6;

}

onClipEvent (enterFrame) {

if (air == true) {

_y += gravity;

state = 3;

}

if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {

_x -= walkSpeed;

_xscale = -scale;

}

if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {

_x += walkSpeed;

_xscale = scale;

}

if (_root.platforms.hitTest(_x, _y, true)) {

air = false;

} else {

air = true;

}

if (Key.isDown(Key.SPACE) && jump == true) {

_y -= jumpSpeed;

}

if (air == false) {

jump = true;

jumpcount = 0;

jumpSpeed = 22;

}

if (Key.isDown(Key.SPACE)) {

jumpcount += 1;

}

if (jumpcount> maxjump && jumpSpeed> -2) {

jumpSpeed -= 2;

}

if (air == false && !Key.isDown(Key.LEFT) && !Key.isDown(65) && _currentframe <4 or air == false && !Key.isDown(Key.RIGHT) && !Key.isDown(65) && _currentframe <4) {

state = 1;

}

if (Key.isDown(Key.LEFT) && air == false && !Key.isDown(65) && _currentframe <4 or Key.isDown(Key.RIGHT) && air == false && !Key.isDown(65) && _currentframe <4) {

state = 2;

}

if (!Key.isDown(65)) {

gotoAndStop(state);

}

_root.statetxt = state;

}

onClipEvent (keyUp) {

if (Key.getCode() == 83) {

jump = false;

}

}
if there are any problems email me at josjvr6@aol.com

dinner dog
July 4th, 2005, 12:38 AM
I don't know if you realise it, but you never told them to create the platforms you are hittesting for... nor anything about right or left bounds. but other than that it looks alright.

nathan99
July 4th, 2005, 02:08 AM
yer i realised that to, and you should you [ as] tags so;


onClipEvent (load) {
gravity = 10;
scale = _xscale;
walkSpeed = 6;
maxjump = 6;
}
onClipEvent (enterFrame) {
if (air == true) {
_y += gravity;
state = 3;
}
if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
_x -= walkSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {
_x += walkSpeed;
_xscale = scale;
}
if (_root.platforms.hitTest(_x, _y, true)) {
air = false;
} else {
air = true;
}
if (Key.isDown(Key.SPACE) && jump == true) {
_y -= jumpSpeed;
}
if (air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.SPACE)) {
jumpcount += 1;
}
if (jumpcount> maxjump && jumpSpeed> -2) {
jumpSpeed -= 2;
}
if (air == false && !Key.isDown(Key.LEFT) && !Key.isDown(65) && _currentframe <4 or air == false && !Key.isDown(Key.RIGHT) && !Key.isDown(65) && _currentframe <4) {
state = 1;
}
if (Key.isDown(Key.LEFT) && air == false && !Key.isDown(65) && _currentframe <4 or Key.isDown(Key.RIGHT) && air == false && !Key.isDown(65) && _currentframe <4) {
state = 2;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}

Pablo123456789
July 4th, 2005, 07:15 AM
i did the tut too fast i didn't realize thanks for pointing that out

hybrid101
July 4th, 2005, 07:31 AM
got that from flashkit,am i right?? that's the same engine i'm using:)

Skribble
July 4th, 2005, 09:53 AM
Its funny that you are calling other people noobs, considering thats a noobish platform setup.

Also, this isnt a tutorial at all. You are basically handing "noobs" a script that they have no idea how to use. You need to explain what the code does, why you used it, possible alternatives, blah blah blah.

Im going home....stupid overtime.

Pablo123456789
July 4th, 2005, 03:49 PM
Im noob you haven't seen my work ok so shut up

Skribble
July 4th, 2005, 09:00 PM
I can see your work right here in this thread and im telling you, its dodgey.

nathan99
July 4th, 2005, 10:05 PM
LoL easy skribble man, back off:P deep breathes counting to 10 :P

Skribble
July 5th, 2005, 12:41 AM
eh?

He's the one whos being hostile, telling me to shutup and all. I was telling him what I saw. A dodgey, noobish, script that is not a tutorial at all.

He can tell me to shutup all he wants, doesnt change the fact that he should first learn what it is he's trying to teach

nathan99
July 5th, 2005, 01:14 AM
lol.