00:00
00:00
Newgrounds Background Image Theme

Mekatov 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!

I've made a jumping engine for all.

50,541 Views | 365 Replies
New Topic Respond to this Topic

Response to I've made a jumping engine for all. 2006-09-09 11:52:08


hell ya man!

Response to I've made a jumping engine for all. 2006-09-09 11:54:35


At 9/9/06 11:52 AM, mr_resident_evil wrote: hell ya man!

HA. Honestlly, it's such a good code. Although, it restricts you.. You must still know about AS to add enimies, power ups, health, etc.. so don't just make some lame game.

Response to I've made a jumping engine for all. 2006-09-09 12:07:21


At 9/9/06 11:52 AM, mr_resident_evil wrote: hell ya man!

actually the MC that represents the character keeps falling threw the ground thing.

Response to I've made a jumping engine for all. 2006-09-24 12:23:19


I think its an awsome code but I don't like that the Character can jump so far left and right, when in the air. I want to restrict him to only jumping a certain distance left and right can anyone help me with this problem?

This is the demo of my game:

http://media.putfile..m/unfinished-game-21

This is the code I have so far:

onClipEvent (load) {
fall = false;
_name = "circle";
jump = 0;
speed = 20;
jumpheight = 15;
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;
}
}

Response to I've made a jumping engine for all. 2006-09-25 15:43:04


nvm

Response to I've made a jumping engine for all. 2006-09-25 15:47:09


Woah, isnt this topic over two years old?


Gorilla Studios || A game is like sex, its better when its free

BBS Signature

Response to I've made a jumping engine for all. 2006-09-25 17:20:50


nice codes.....how did you make it so you dont need instances?

oh, and watch out....there gonna be a butt load of nOObs making platformers
alot of blamin'


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

BBS Signature

Response to I've made a jumping engine for all. 2006-09-25 17:22:33


At 7/31/06 09:23 PM, yoshlan0440 wrote: no it's not rellay working for me and i'm using flash 8 pro and the cracater i had was half why trough the the rectangle stragely very stragely

srry for double posting but, its doing this cuz the registration is in the middle


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

BBS Signature

Response to I've made a jumping engine for all. 2006-10-04 00:11:43


ok if the characters falling through the block this might work for you.
put this in the character

onClipEvent (load) {
fall = false;
_name = "circle";
jump = 0;
speed = 8;
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;
}
}

and then put this in the block

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>yMi
n) {
_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;
}
}

if this dont work i have no idea


Oops

Response to I've made a jumping engine for all. 2006-10-07 15:33:10


i used tis i think a year ago when messing around. now im making a 2p fighting game and want to include this. is there anyway to get it to accept two movie clips? i tried messing around with it, and it failed most miserably

Response to I've made a jumping engine for all. 2006-10-07 18:14:03


At 10/7/06 03:33 PM, Goldtop wrote: is there anyway to get it to accept two movie clips?

nevermind, ive got it. btw, for anyone else with this problem, i found several ways to do it, but the easiest by far is to copy the block, and paste it in its shadow (right click>paste in place) then go to its script, and replace all of the "circle"s or whatever you had, i had player1, with the instance name of your second player. the easiest way to do this is ctrl+f, type in "circle" in the "find" box and "player2"(or whatever the nstance name of your second guy is) and clikc replace all.

Response to I've made a jumping engine for all. 2006-10-07 18:35:23


I got it to work in Flash 8 perfectly, and I applaud your brilliant code. I'm gunna spend the rest of the day making it works with one big block and can have slopes and hills :D.


BBS Signature

Response to I've made a jumping engine for all. 2006-10-21 02:34:45


When I jump off a block and then land back on it I fall right off. If I jump off it and land on another block. No problem. If I jump of that block and land back on the first block no problem. But if I jump and land on the same block I fall right through it

Response to I've made a jumping engine for all. 2006-10-29 22:36:41


i'm having a really big problem. everytime i jump onto a different black, my character falls right through it. please help!

Response to I've made a jumping engine for all. 2007-01-26 17:25:27


Yeah, it's doing the same thing for me, it lands fine originally, but if i try to jump or anything, it goes right through everything.

Haha, but I don't know if anyone checks this post anymore.

Response to I've made a jumping engine for all. 2007-02-17 22:13:52


I use Flash Pro 8 and This is almost working, but the character goes halfway through the block and the stops.


PROUD '06 USER

Response to I've made a jumping engine for all. 2007-02-20 19:32:05


It worked but I was wondering how would you make the screen scroll?


There is Heaven

There is Hell

And then there is Heck

BBS Signature

Response to I've made a jumping engine for all. 2007-02-25 15:42:28


yeah, I have always wanted it to scroll.

Response to I've made a jumping engine for all. 2007-02-25 15:50:14


Lawl this thread is magical. Is it because the code is so long? :P


BBS Signature

Response to I've made a jumping engine for all. 2007-03-15 22:50:38


At 2/20/07 07:32 PM, Greth-of-choas wrote: It worked but I was wondering how would you make the screen scroll?

just make whatever you want to scroll into an mc, give it an instance of thing put a stop action in the first frame, and make an animation of it scrolling. Then put this tiny bit of code into the circle mc:

onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
_root.thing.play();
}
if(!Key.isDown(Key.RIGHT)){
_root.thing.stop();
}
}

It will only scroll right though and it may make it completely not work, but probably not.


PROUD '06 USER

Response to I've made a jumping engine for all. 2007-03-21 17:03:27


At 2/17/07 10:13 PM, blackqat wrote: I use Flash Pro 8 and This is almost working, but the character goes halfway through the block and the stops.

I have the same problem with the original code, when I use the one posted later on it falls out of the screen entirely.
:(

Response to I've made a jumping engine for all. 2007-07-04 15:29:20


OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.


I did it for the lulz.

Also, google.

BBS Signature

Response to I've made a jumping engine for all. 2007-07-04 15:46:48


At 7/4/07 03:29 PM, FamouslyFamous wrote: OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.

This is old anyway. There are many other ways to do this without instance names. For instance, there is a name in there because _name = "circle" just automatically sets the heros name to circle. no instance names required indeed.

From what I gather, you need the code put on all platforms added, but I haven't check this thread or if the code works. I don't know if it works for sloped ground, but if I could automatically set names and say no instance names, anyone can.

_name has been in since Flash 6.

you can even use a for...in loop to loop through all instances in a master platform holder and just hitTest against any within range.

Either way copying and pasting is bad and I don't want to help I'm just telling you other possibilities.


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature

Response to I've made a jumping engine for all. 2007-07-17 21:09:22


Thanks for the script im still sorta a noob at flash XD

Response to I've made a jumping engine for all. 2007-07-17 22:49:05


At 7/24/04 02:17 PM, Rystic wrote: ANYONE WHO HAS PROBLEMS GIVE ME YOUR E-MAILS AND I WILL SEND YOU THE WORKING FILE

That should do it...

infinitywraith
[ a t ]
gmail . com


BBS Signature

Response to I've made a jumping engine for all. 2007-07-18 00:12:49


At 7/17/07 10:49 PM, Sinvader wrote:
At 7/24/04 02:17 PM, Rystic wrote: ANYONE WHO HAS PROBLEMS GIVE ME YOUR E-MAILS AND I WILL SEND YOU THE WORKING FILE

That should do it...

asp1988@gmail.com

cheers

Response to I've made a jumping engine for all. 2007-07-29 11:20:50


At 7/4/07 03:29 PM, FamouslyFamous wrote: OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.

That's because (unfortunately) it doesn't work with any version of Flash above 6.


PROUD '06 USER

Response to I've made a jumping engine for all. 2007-08-08 15:45:37


At 7/23/04 10:47 PM, Rystic wrote:
thnx... it was hard to make.. but i did it...

No you didn't, this was stolen from GAMECUBICLE. This tutorial has the original piece of code that you stole from. In the tutorial just click, *Flash> Actionscipt> Platform Game: very easy engine> Next,* and all the code is right there. Next time don't pretend that you made something that you didn't. I can't believe that you got away with it to, If I can tell someone about this I will.


You can't know what you don't know if you can only use yourself as a reference point.

Response to I've made a jumping engine for all. 2007-08-08 15:49:35


Sorry about that, I just looked at the dates and discovered that this thread was made before the tutorial was. Sorry.


You can't know what you don't know if you can only use yourself as a reference point.

Response to I've made a jumping engine for all. 2007-08-08 16:25:15


This would work on flash 8 right?

I might use this for my first game evar.


Brains in a hour glass