00:00
00:00
Newgrounds Background Image Theme

jailander1 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Simple AS: Platformer

5,900 Views | 19 Replies
New Topic

Simple AS: Platformer 2005-06-08 17:28:37


Making the platformer
by: Brad B (etchandsketchdesigns)

What you need to draw:

1. “Character”
2. “Platform(s)”


Now: In Select the “Character” Press F8, Convert to Symbol > Movie Clip
Name it “Chart”

Select platform one it’s own Press F8 Convert to Symbol > Movie Clip
Name Each, Platform, Platorm1, Platform2.


Character Code: //enter this into the Actions panel of your movieclip

onClipEvent (load) {
fall = false;
_name = "circle";
jump = 0;
speed = 6;
jumpheight = 18;
maxfall = -54;
}
onClipEvent (enterFrame) {
xmin = getBounds(_root).xMin;
xmax = getBounds(_root).xMax;
ymin = getBounds(_root).yMin;
ymax = getBounds(_root).yMax;
if (Key.isDown(Key.SPACE) && fall == false && jump == undefined) {
fall = true;
jump = jumpheight;
}
if (jump<>undefined) {
if (jump>maxfall) {
jump--;
}
_y -= jump;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}

Platform codes: // enter in the Actions panel of your movieclip(s)

onClipEvent (load) {
activated = false;
down = false;

}
onClipEvent (enterFrame) {
_root.report.text = Math.round(_root.circle.yMax)+" "+Math.round(yMin);
xmin = getBounds(_root).xMin;
xmax = getBounds(_root).xMax;
ymin = getBounds(_root).yMin;
ymax = getBounds(_root).yMax;
if (_root.circle.xMax>xMin && _root.circle.xMin<xMax && _root.circle.yMax<yMin) {
if (_root.circle.yMax-_root.circle.jump*2>yMin) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
}
if (Math.round(_root.circle.yMax)>Math.round(yMin)) {
if (hitTest(_root.circle) && _root.circle.xmax<xmin) {
_root.circle._x -= _root.circle.speed;
}
if (hitTest(_root.circle) && _root.circle.xmin>xmax) {
_root.circle._x += _root.circle.speed;
}
if (hitTest(_root.circle) && _root.circle.ymin>ymax && _root.circle.jump>-1) {
_root.circle.jump = -1*(_root.circle.jump);
}
}
if (activated == true && not hitTest(_root.circle) && _root.circle.jump == undefined) {
_root.circle.jump = 0;
activated = false;
}
if (hitTest(_root.circle) && _root.circle.ymax>ymin && _root.circle.jump<>undefined && _root.circle._y<_y) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
if (_root.circle.ymax-_root.circle.jump>ymin && _root.circle.xMin<xMax && _root.circle.xMax>xMin && _root.circle.jump<>undefined && _root.circle._y<_y) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
}

now to test the game:
Press ALT and ENTER at the same time, this will bring you to the game screen, where you can test it.

Move with arrow keys. Press space to jump.


By: etchandsketchdesigns

Response to Simple AS: Platformer 2005-06-08 17:32:01


Press ALT and ENTER at the same time, this will bring you to the game screen, where you can test it.

It's actually control+enter... but people would figure that out eventually anyways...

Response to Simple AS: Platformer 2005-06-08 17:50:43


At 6/8/05 05:32 PM, Caraboo wrote:
It's actually control+enter... but people would figure that out eventually anyways...

thanks mna, i don't know what i was thinking

Response to Simple AS: Platformer 2005-06-23 09:57:20


The code itself was good(although you didn't invent it),but honestly,the tutorail wasn't good at all...


BBS Signature

Response to Simple AS: Platformer 2005-06-23 09:58:30


At 6/8/05 05:28 PM, etchandsketchdesigns wrote: Simple AS: Platformer

this code is not simple at all!I think newbs(beginners) should not be using it!


BBS Signature

Response to Simple AS: Platformer 2005-06-23 10:15:55


is the instance name of the player "circle"? it would appear so, although im not sure, im not good at AS.

Response to Simple AS: Platformer 2005-06-23 11:44:44


Yeah you stole that and also n00bs would not get it and it is stupid to just copy other peoples work


- Matt, Rustyarcade.com

Response to Simple AS: Platformer 2005-06-23 11:50:20


This tutorial doesn't deserve to be in the AS: section >:(


BBS Signature

Response to Simple AS: Platformer 2005-07-02 13:00:30


At 6/23/05 11:50 AM, -Toast- wrote: This tutorial doesn't deserve to be in the AS: section >:(

Excuse me, but this code was STOLEN from ME. Not only does the explaination suck, I'm given no credit!!

Response to Simple AS: Platformer 2005-07-02 13:04:04


At 6/23/05 11:50 AM, -Toast- wrote: This tutorial doesn't deserve to be in the AS: section >:(

Sure doesn't, stolen stuff doesn't belong anywhere actually.

Once I saw that etchandsketch made a topic I knew there was thievery afoot(just check out his LotR rpg thread).

Response to Simple AS: Platformer 2005-07-02 13:10:03


At 7/2/05 01:04 PM, GeoffCLogan wrote:
At 6/23/05 11:50 AM, -Toast- wrote: This tutorial doesn't deserve to be in the AS: section >:(
Sure doesn't, stolen stuff doesn't belong anywhere actually.

Once I saw that etchandsketch made a topic I knew there was thievery afoot(just check out his LotR rpg thread).

This bastard didn't even explain the code right. He's a fucking idiot as well as a dirty thief!

Response to Simple AS: Platformer 2005-07-02 13:10:22


You really thought you could get away with stealing rystics code? n00b!

Response to Simple AS: Platformer 2005-07-02 13:11:12


Its not even the best way to do a platform game..

say i have 12 platforms that is 12hitTests, then sayn i hav a couple of enemies and they are shooting at me.. all these hitTests will add up and the game will lag terribly on slower computers even with quality lessoned...

Response to Simple AS: Platformer 2005-07-02 13:14:06


At 7/2/05 01:11 PM, isthatlegal wrote: Its not even the best way to do a platform game..

say i have 12 platforms that is 12hitTests, then sayn i hav a couple of enemies and they are shooting at me.. all these hitTests will add up and the game will lag terribly on slower computers even with quality lessoned...

Actually, it runs pretty well. Never lags for me...

Response to Simple AS: Platformer 2005-07-02 13:14:43


At 7/2/05 01:11 PM, isthatlegal wrote: Its not even the best way to do a platform game..

say i have 12 platforms that is 12hitTests, then sayn i hav a couple of enemies and they are shooting at me.. all these hitTests will add up and the game will lag terribly on slower computers even with quality lessoned...

If you ran all the platform hitTests through a for loop, rystic's way doesn't really cause much lag at all.

Also, if your computer is more than a few years old then you should expect lag not just from flash but from other things too.

Response to Simple AS: Platformer 2005-07-02 13:19:14


I don't think this thread is a good idea.
If you want to make a AS thread about his code,at least try to explain how it works.
So noobs won't just copy and paste it without understanding anything.


BBS Signature

Response to Simple AS: Platformer 2005-07-02 13:23:29


At 7/2/05 01:19 PM, -Toast- wrote: I don't think this thread is a good idea.
If you want to make a AS thread about his code,at least try to explain how it works.
So noobs won't just copy and paste it without understanding anything.

I don't think this thread is a good idea, either. If you want an explaination, you can view my original thread.

<A>http://www.newgrounds.com/bbs/topic.php?id=152495<A>

All the CORRECT information for this engine can be found there. This loser just butchers the explaination.

Response to Simple AS: Platformer 2005-07-02 15:36:02


no offense, but this is a horrible tutorial with stolen code, you explained nothing, you just pasted the code R wrote

Response to Simple AS: Platformer 2005-07-02 15:37:14


At 7/2/05 03:36 PM, Inglor wrote: no offense, but this is a horrible tutorial with stolen code, you explained nothing, you just pasted the code R wrote

Agreed you clearly didnt write this code


- Matt, Rustyarcade.com

Response to Simple AS: Platformer 2005-07-02 15:47:45


I think we've already established that the code was stolen. I don't really see the point of repeatedly bumping the thread to restate that fact. If I could delete the thread, I would, but it's too old.


- - Flash - Music - Images - -

BBS Signature