00:00
00:00

I've made a jumping engine for all.

43,370 Views | 367 Replies
New Topic Respond to this Topic

Response to I've made a jumping engine for all. 2004-07-25 11:53:09


It is a kinda blasphemeric game, so beware :D

Response to I've made a jumping engine for all. 2004-07-25 12:37:31


I told u in the Actionscript forum to shut up and die. So do.

Response to I've made a jumping engine for all. 2004-07-25 14:00:22


At 7/25/04 12:37 PM, FFKing wrote: I told u in the Actionscript forum to shut up and die. So do.

Huh? What on earth are you talking about?

Response to I've made a jumping engine for all. 2004-07-25 14:05:41


Someone posted garbage on every post, it has been deleted.

Response to I've made a jumping engine for all. 2004-07-25 14:24:52


Wow, thanks, I've been wanting to make a platformer in flash.

Expect one for that little guy in my sig.

Response to I've made a jumping engine for all. 2004-07-25 14:32:52


At 7/25/04 02:00 PM, Rystic wrote: Huh? What on earth are you talking about?

Dont worry, its not u I;'m on about, but some guy whos only 45 psots were like spam!!!111, just copy-pasted like 400 times. Not u. Sorry for the confusion.

Response to I've made a jumping engine for all. 2004-07-25 14:50:35


At 7/25/04 02:05 PM, schorhr wrote: Someone posted garbage on every post, it has been deleted.

Oh, I see.

Response to I've made a jumping engine for all. 2004-07-25 15:22:16


I modified the script a little.
My modification allows for the character to jump through the bottom of a platform and land on the top.
I also made a modifcation to alter the "gravity"

Here's the .swf of it:

Here's how to do it: http://www.eternalrpg.net/modification.swf
(Note: You must know how to make buttons/movieclips for this)

Draw a line that has the same width has your platform (line thickness doesn't matter, but I prefer to use "3").
Make it a movieclip, and place it just under the bottom of your platform.
Give it this actionscript:
onClipEvent(enterFrame) {
_alpha=0
if(this.hitTest(_root.circle)) {
_root.jumpgo = "yes"
}
}

Copy and paste that line.
Now, this may get confusing.
Move the line above the platform, and place it just above the height of your character.
(Here's an animation that will explain it better: http://www.eternalrpg.net/explained.swf

Now, delete the actionscript in the top line, and give it this script:
onClipEvent(enterFrame) {
_alpha=0
if(this.hitTest(_root.circle)) {
_root.jumpgo = "no"
}
}

Now, delete all the actionscript in your platform (assuming you have any in it, and have a platform made) and give it this script:
onClipEvent (load) {
activated = false;
down = false;
}
onClipEvent (enterFrame) {
if(_root.jumpgo == "yes") {
} else {
_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;
}
}
}

And finally, make 3 buttons, they will be for making the gravity "High", "Normal", and "Low".
After you have them made, give them this actionscript:

The "High" Button:
on(release) {
_root.fallspeed=2;
}

The "Normal" Button:
on(release) {
_root.fallspeed=1;
}

The "Low" Button:
on(release) {
_root.fallspeed=.5;
}

If something doesn't work, or you can't figure something out, just ask for help.

Response to I've made a jumping engine for all. 2004-07-25 15:29:41


This is a nice mod. Good job!
Still, i hate flat levels :-) I prefer something like http://www.di-m.de/runner.swf (just a coding test)

Response to I've made a jumping engine for all. 2004-07-25 15:51:03


At 7/25/04 03:29 PM, schorhr wrote: This is a nice mod. Good job!
Still, i hate flat levels :-) I prefer something like http://www.di-m.de/runner.swf (just a coding test)

This engine doesn't necessary use flat surfaces. All you have to do is make a bunch of small squares in a diagonal line. That'll work. Also, the line seems to be dead.

Response to I've made a jumping engine for all. 2004-07-25 16:40:32


Yeah, but using a bunch of plattforms is a bit insuficcient for a shaped ground.
My first platformer is on a different webspace ( http://www.spamihilator.com/shaw/shawcartoon/test/rpg18b.html ), but its very basic.

Response to I've made a jumping engine for all. 2004-07-25 17:05:15


Wow that game was pretty cool.. It kinda reminded me of Hobbo Hotel or something like that... Keep up the good work!

Response to I've made a jumping engine for all. 2004-07-25 17:17:06


Habbo? That game? My Rogerjump? :-)
I wish I would have invested some more work in the animation & Art, it was intended to be a small how-to-mak-plattformers, but the ideas are just wild :)

Response to I've made a jumping engine for all. 2004-07-25 18:22:35


At 7/25/04 05:17 PM, schorhr wrote: Habbo? That game? My Rogerjump? :-)
I wish I would have invested some more work in the animation & Art, it was intended to be a small how-to-mak-plattformers, but the ideas are just wild :)

Is it made of diagonal boxes? Kinda feels like it...

Response to I've made a jumping engine for all. 2004-07-25 18:24:43


At 7/25/04 06:22 PM, Rystic wrote:
Is it made of diagonal boxes? Kinda feels like it...

Nevermind... reading back on the posts, I see it is...

Boy, that was bad of me.

Response to I've made a jumping engine for all. 2004-07-25 18:30:19


Good news everyone!

Originally when I made this engine, I was going to add a side scrolling feature so a REAL platformer could be made. However, since I didn't want to bother with attachments in the very beginning, I held off doing it. Well now, since the topic is such a success, I'll release the other code! I'm not sure if it works properly yet, so you guys be the beta testers.

First, add this to every block:


onClipEvent (enterFrame) {
if (_global.moveX>0) {
_x -= _root.circle.speed;
}
if (_global.moveX<0) {
_x += _root.circle.speed;
}
}

Then, add this to the character:

onClipEvent (enterFrame) {
if (_global.moveX>0) {
_x -= _root.circle.speed*2;
}
if (_global.moveX<0) {
_x += _root.circle.speed*2;
}
}

Finally, make two big blocks off screen on each side of the drawing board. Put this into the one on the right:


onClipEvent (enterFrame) {
x++;
if (hitTest(_root.circle)) {
_global.moveX = 1;
x=0;
}
if (x==5 && _global.moveX==1) {
_global.moveX=0;
}
}

and this in the one on the left:


onClipEvent (enterFrame) {
x++;
if (hitTest(_root.circle)) {
_global.moveX = -1;
x=0;
}
if (x==5 && _global.moveX==-1) {
_global.moveX=0;
}
}

If it works properly, you should have side-scrolling platforms!

Tell me if it works. I need to know.

Response to I've made a jumping engine for all. 2004-07-25 18:31:18


ARGH dang, I posted the wrong game link.

The RPG uses boxes and shapes. But i ment

http://www.spamihilator.com/shaw/shawcartoon/test/rogerjump8.html

.....

Response to I've made a jumping engine for all. 2004-07-25 19:16:44


At 7/25/04 06:31 PM, schorhr wrote:

:http://www.spamihilator.com/shaw/shawcartoon/test/rogerjump8.html

O_o, weird game.

Response to I've made a jumping engine for all. 2004-07-25 19:28:34


At 7/25/04 07:16 PM, Rabid_Badger wrote:
At 7/25/04 06:31 PM, schorhr wrote: http://www.spamihilator.com/shaw/shawcartoon/test/rogerjump8.html
O_o, weird game.

A tad blocky.

Response to I've made a jumping engine for all. 2004-07-26 05:55:32


At 7/25/04 07:16 PM, Rabid_Badger wrote:
At 7/25/04 06:31 PM, schorhr wrote: http://www.spamihilator.com/shaw/shawcartoon/test/rogerjump8.html
O_o, weird game.

I still need someone to test my code in MX 2004 to see if it works.

Response to I've made a jumping engine for all. 2004-07-26 07:51:26


does not work for flash 5????

Response to I've made a jumping engine for all. 2004-07-26 09:49:04


Rabid_Badger has yet another nice modification!
This one is for moving the character, so he/she has a walking animation, and so he/she can attack.

First off, in your character (the movieclip) make 6 frames, each one with an exact copy of the character.
All of these copies must be movieclips too.

(still inside the movieclip)
In Frame 1
Have your character facing right.

In Frame 2
Have your character walking right.

In Frame 3
Have your character facing left.

In Frame 4
Have your character walking left.

In Frame 5
Have your character attacking, while facing right.

In Frame 6
Have your character attacking, while facing left.

Now, leave the movieclip, and go into your character's actionscript (press F9 whilst you have it selected) and find this:

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}

One you have, copy and paste this script BELOW it:

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if (Key.isDown(17)) {
_root.moving_2="left"
} else {
_root.moving_2=""
}
_root.moving="left"
if(fall == true) {
if(_root.moving_2=="left") {
_root.circle.gotoAndStop(1)
} else {
_root.circle.gotoAndStop(3)
}
} else {
if (Key.isDown(90)) {
if(_root.moving=="right") {
if(_root.moving_2=="left") {
_root.circle.gotoAndStop(5)
} else {
_root.circle.gotoAndStop(6)
}
}
if(_root.moving=="left") {
_root.circle.gotoAndStop(6)
}

}
if(_root.moving_2 == "left") {
_root.circle.gotoAndStop(2)
} else {
_root.circle.gotoAndStop(4)
}
}

} else {
if(_root.moving=="left") {
if (Key.isDown(90)) {
if(_root.moving_2=="left") {
_root.circle.gotoAndStop(5)
} else {
_root.circle.gotoAndStop(6)
}
} else {
if(_root.moving_2=="left") {
_root.circle.gotoAndStop(1)
} else {
_root.circle.gotoAndStop(3)
}
}
}

if (Key.isDown(Key.RIGHT)) {
if (Key.isDown(17)) {
_root.moving_2="right"
} else {
_root.moving_2=""
}
_root.moving="right"
if(fall == true) {
if(_root.moving_2=="right") {
_root.circle.gotoAndStop(3)
} else {
_root.circle.gotoAndStop(1)
}
} else {
if(_root.moving_2=="right") {
_root.circle.gotoAndStop(4)
} else {
_root.circle.gotoAndStop(2)
}
}

} else {
if(_root.moving=="right") {
if (Key.isDown(90)) {
if(_root.moving_2=="right") {
_root.circle.gotoAndStop(6)
} else {
_root.circle.gotoAndStop(5)
}
} else {
if(_root.moving_2=="right") {
_root.circle.gotoAndStop(3)
} else {
_root.circle.gotoAndStop(1)
}
}
}
}

}

}

Hope it works for you.
If something doesn't work, tell me what went wrong, and I'll help you.
(Note: this script also allows for the character to be moving left/right without changing the way he/she is facing, this is done by holding CTRL+Arrowkeys)

Response to I've made a jumping engine for all. 2004-07-26 09:50:54


Damn.
I forgot to state that it has "Z" set to attack.
(if you want to change this, you can do so by finding the ASCII Key Value of the key you want to have attack, and replace the 90 in: if(Key.isDown(90) with the appropriate key value.

Response to I've made a jumping engine for all. 2004-07-26 19:42:25


At 7/26/04 07:51 AM, Masonogy1 wrote: does not work for flash 5????

I'm not too sure... Some of the code might be beyond flash 5.

Response to I've made a jumping engine for all. 2004-07-26 22:34:27


At 7/26/04 07:42 PM, Rystic wrote:
At 7/26/04 07:51 AM, Masonogy1 wrote: does not work for flash 5????
I'm not too sure... Some of the code might be beyond flash 5.

It probably won't work on either Flash 5, or mx2004.

Response to I've made a jumping engine for all. 2004-08-13 15:48:26


HOLY CRAP! This is the best jumping code ever! My brother and I have been trying to make a good code forever. Thanks Rystic you're the coolest!

Response to I've made a jumping engine for all. 2004-08-13 15:50:12


Mmm...quick question.

How would I go about scrolling with no instance names?

Response to I've made a jumping engine for all. 2004-08-13 17:27:54


At 7/26/04 09:50 AM, Rabid_Badger wrote: Damn.
I forgot to state that it has "Z" set to attack.
(if you want to change this, you can do so by finding the ASCII Key Value of the key you want to have attack, and replace the 90 in: if(Key.isDown(90) with the appropriate key value.

it says this with your code

**Warning** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: The file 'toplevel.as', which is required for typechecking ActionScript 2.0, could not be found. Please make sure the directory '$(LocalData)/Classes' is listed in the global classpath of the ActionScript Preferences.
stop

**Warning** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: The file 'toplevel.as', which is required for typechecking ActionScript 2.0, could not be found. Please make sure the directory '$(LocalData)/Classes' is listed in the global classpath of the ActionScript Preferences.
onClipEvent (enterFrame) {

Total ActionScript Errors: 2 Reported Errors: 2

Response to I've made a jumping engine for all. 2004-08-13 20:53:57


fixed that know this is screwed help

onClipEvent(enterFrame){
if (Key.isDown(65)) {
if(_root.moving=="right") {
if(_root.moving_2=="left")
_root.circle.gotoAndStop(7)
} else {
_root.circle.gotoAndStop(8)
}
}
if(_root.moving=="left") {
_root.circle.gotoAndStop(8)
}

}

Response to I've made a jumping engine for all. 2004-08-14 06:04:34


cool look what i made www.flashweapons.tk -- its in movies section