00:00
00:00

## As: Platformer with Slopes

7,628 Views | 24 Replies

As: Platformer with Slopes 2006-04-07 23:58:27

AS:Main

Hey, this is an example of the game.

Controls
Move- Left and Right
Jump-Space
http://denvish.net/u..0_Platformer%206.swf

The special thing about this platformer is that all yu need to do is draw the grounds, and it tells if it is a wall, or a ceiling, or ground.

First create a ball or square or anything, and make it 50X50. (Click properties, and change width and height to 50 and 50) Then make it into a movelcip, and make sure the + is at the exact bottem middle! Then add this code.

// Made by pyro111 April 7, 2006
// only happens once
fall = true;
//makes a varialbe called fall, and sets it to true
jump = 0;
jumping = false;
// makes and sets jumpign to false
spd = 0;
// makes and sets spd to 0
grav = 0;
// makes and sets grav to 0
slow = .97;
// makes and sets slow to .97
this.playerB.playerC.gotoAndStop(1);
// only used if you want it to rotate
}
onClipEvent (keyUp) {
// if no key is pressed
this.playerB.playerC.gotoAndStop(1);
// makes playerB.playerC stop on frame 1
}
//closes keyUp
onClipEvent (enterFrame) {
// happens every frame
_x += spd;
// makes x go up by spd
this.playerB._rotation += spd;
// makes the rotation spd
if (Key.isDown(Key.SPACE) && grav == 0) {
// if space is pressed and grav is equal to 0
jumping = true;
// makes jumping true
_y -= jump;
// makes y go down (but really up) by the varialbe jump
grav = 0;
// sets grav to 0
fall = false;
// makes fall false
} else {
// otherwise (and the first } closes the if
jumping = false;
// jumping is false
fall = true;
// fall is true
}
// closes the else
if (jumping == true) {
// if jumping is true
jump--;
// makes jump go down by 1
}
// closes the if
if (!Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT)) {
// if left or right arent pressed
spd *= slow;
// makes spd multiply by slow (.97)
}
// closes the if
if (spd<.5 && spd>0) {
// if spd is less than .5 and greater than 0
spd = 0;
// makes spd 0
}
//closes the if
if (spd>-.5 && spd<0) {
// if spd is greater than -.5 and less than 0
spd = 0;
// makes spd 0
}
//closes the if
if (Key.isDown(Key.RIGHT) && spd<20) {
// if the right key is pressed and spd is less than 20
spd++;
// makes spd go up by 1
this.playerB.playerC.play();
// makes the movieclip play
}
//closes the if
if (Key.isDown(Key.LEFT) && spd>-20) {
// if left is pressed and spd is greater than 20
spd--;
// makes spd go down by 1
this.playerB.playerC.play();
// makes the movieclip play
}
//closes the if
if (fall == true) {
// if fall is true
_y += grav;
// y goes up (but really down, the axis are inverted) by grav
grav++;
// grav goes up by 1
jumping = false;
// makes jumping false
}
//closes the if
if (grav>20) {
// if grav is greater than 20
grav = 20;
// grav is 20
}
//closes the if
if (_root.gd.hitTest(_x+25, _y-25, true)) {
// if the ground hits the right of this
spd *= -1;
// spd is multipled by 1
jumping = false;
// makes jumping false
fall = true;
// makes fall true
jump = -10;
// makes jump -10
}
//closes the if
if (_root.gd.hitTest(_x-25, _y-25, true)) {
// this the ground hits the left of this
spd *= -1;
// spd is multiplied by -1
jumping = false;
// makes jumping false
fall = true;
// makes falling true
jump = -10;
// makes jump -10
}
//closes the if
if (_root.gd.hitTest(_x, _y-50, true)) {
// if the ground hits the top
jumping = false;
fall = true;
jump = -10;
// same as before withought changing the spd
}
//closes the if
if (_root.gd.hitTest(_x, _y, true)) {
// if the ground hits the bottem
falling = false;
// makes falling false
grav = 0;
// makes grav 0
jump = 10;
// makes jump 10
} else {
// otherwise
falling = true;
// falling is true
}
//closes the else
while (_root.gd.hitTest(_x, _y, true)) {
// while it is touching the ground
_y--;
// this y is subtraceted by 1 (making it go up)
}
// closes the while
}
// closes the enter frame

To make the ground, just draw anything (tiny lines wont work) and call the movieclip gd. Thats all there is to it. Hope I helped someone, and this is my 3rd submission to As:Main.

Response to As: Platformer with Slopes 2006-04-08 00:02:06

that is really good

// Harvest++ coming soon, more modes, more stuff, customizable character, achievements and more!

Response to As: Platformer with Slopes 2006-04-08 03:02:36

not much of a tutorial... :/ this is more suited for FOSS than AS since its only commented code

Response to As: Platformer with Slopes 2006-04-08 08:14:55

Nice job on the code : ) Thanks!

Response to As: Platformer with Slopes 2006-04-08 08:17:23

Ha ha, it rolls uphill :)

Nice, but not really a tutorial - plus I think Joelasticot made a tutorial on this.

Sup, bitches :)

Response to As: Platformer with Slopes 2006-05-30 09:15:32

my ball dsnt rotate.....and it cant go up any walls

Response to As: Platformer with Slopes 2006-05-30 09:43:23

Hey thats really cool thanks for that!

Response to As: Platformer with Slopes 2006-06-05 20:48:46

At 5/30/06 09:15 AM, E-K wrote: my ball dsnt rotate.....and it cant go up any walls

That doesn't sound right... Anyways, great tut. ^__^

Response to As: Platformer with Slopes 2006-06-05 21:37:37

Response to As: Platformer with Slopes 2006-06-05 21:57:13

At 6/5/06 09:37 PM, Khao wrote: CHECK IN THE AS:MAIN TO SEE IF YOUR IDEA HAS ALREADY BEEN DONE BEFORE DOING ONE, FUCKTARD

pie.

There is always more than one way to do things, and some come out with completly differnt outcomes. Platformers are really differnent, so there are going to be way more than 1 way to do something. There are more than one tutorials on other subjects, too. But whatever.

Response to As: Platformer with Slopes 2006-06-14 21:01:05

// Made by pyro111 April 7, 2006
// only happens once
fall = true;
//makes a varialbe called fall, and sets it to true
jump = 0;
jumping = false;
// makes and sets jumpign to false

jumpign???

Response to As: Platformer with Slopes 2006-06-15 02:11:08

At 6/14/06 09:01 PM, Allen1288 wrote: jumping = false;
// makes and sets jumpign to false

jumpign???

who the fuck cares if he made one little typo in a comment? Get a life :X

Response to As: Platformer with Slopes 2006-07-29 20:39:31

At 5/30/06 09:15 AM, E-K wrote: my ball dsnt rotate.....and it cant go up any walls

I think what you need to do is tell Flash, (put this in the actions,) that when move left or right play movie clip.

If you're thinking it, NO! I'm not the same person as that old black & white cartoon character.

Response to As: Platformer with Slopes 2006-08-06 09:49:44

Very good man :D How can you edit how high you can jump?

Response to As: Platformer with Slopes 2006-08-06 10:26:37

No offense but your comment style is terrible, meaning this is almost useless for anyone who wants to LEARN. You leave tons of obvious comments like

spd++;
// makes spd go up by 1

this.playerB.playerC.play();
// makes the movieclip play

Seriously, everyone knows what that does! The problem is that you fail to document how the code actually lets the ball roll. You missed the explaination of the grand scheme of whats going on. This bugs me. :P

Come join music competitions on Chips Compo and hang on our Discord!

Good artists copy. Great artists get banned from the Audio Portal.

Response to As: Platformer with Slopes 2006-08-06 12:44:28

At 8/6/06 10:26 AM, johnfn wrote: blah blah blah

This is old and shitty and I want it removed. I made a new one which is much better expalined.

Response to As: Platformer with Slopes 2006-08-07 08:14:33

Response to As: Platformer with Slopes 2006-08-07 08:16:36

At 8/6/06 12:44 PM, pyro111 wrote:
At 8/6/06 10:26 AM, johnfn wrote: blah blah blah
This is old and shitty and I want it removed. I made a new one which is much better expalined.

lol, but the comments are pretty bad. You should space them out or something to make it easier to read.

Response to As: Platformer with Slopes 2006-11-14 17:37:01

OMG THANK YOU! I have been looking for a way to get my character to roll (or walk) up a hill. I have Googl'ed it so much and haven't been able to find how. Now I will just have to spend a few weeks modifying your code so I can get the screen to scroll too, then I will have a perfect game.

Response to As: Platformer with Slopes 2006-11-14 17:46:53

Response to As: Platformer with Slopes 2006-11-14 18:29:22

I really only need know how to get the ball from bouncing at the bottom. I just want it to roll smoothly or bounce somewhat like in Paintball-The Game.

Response to As: Platformer with Slopes 2006-11-14 18:57:52

Can ya re-host it?

It doesn't work any more.

Click my Sig! I make money :)

Response to As: Platformer with Slopes 2007-03-24 04:12:11

I dont understand the bit about "only used if you want it to rotate" that could mean one of two things: 1. The clip rolls when you move 2. the movieclip is always facing down towards teh ground, if 2. then it would be useful to know how to do that...

Response to As: Platformer with Slopes 2007-03-24 10:20:16

Well, first off there's way too many platform tuts on As:main. And second, that link say site not found. (at least for me)

Blok' Party, Orbital Khaos, site, MSMstudios, Phrozen Phlame

Response to As: Platformer with Slopes 2007-04-17 19:49:26

is it possible for me to tack another jumping code on this one-the jumping in this is remeniscent of smb for nes-not a good thing.