| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Oct 2001
Location: New Zealand
Posts: 4
|
Hey Everyone! Im making myself a side scrolling game and im not very fond of it.
Ya see im making a game basically like 'Sonic The Hedgehog' Style and i need to know how to my guy jump. I have got the scrolling perfect. the walking left and right, and i can manage the shooting but i need to know how to make it jump up... If anyone can give me some quick and easy code to put on my character i'd be greatful... catch you all later! |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Oct 2001
Posts: 11
|
Inside your Character MC,
In the first frame, have a stop action, and make an invisible button that says on keypress (whatever key) Play. .... and then in the next frame, make an animation of him jumping, and after he jumps, an action goto and stop (1) hope i helped |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Oct 2001
Location: New Zealand
Posts: 4
|
Ummm actually ya see that wont work. i need to make a velocity thing. because if ya just make an animation of him jumping it will stuff up the part of him landing on another platform if ya know what i mean. Unless of course you had an amazing way of getting past that. anyway thanks for replying it did give me a couple ideas i could try. catch ya later!
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Oct 2001
Posts: 8
|
is it possible to have a look at your game.. want to see how your sidescrolling works.. so.. would appreciate to have a look at it.. ??
|
|
|
|
|
|
#5 |
|
Registered User
Join Date: Oct 2001
Location: New Zealand
Posts: 4
|
Well i very well could upload it but its in a very 'sketchy' stage and ill have to re-make it for easy to understand code, if a few more peeps ask for it then ill be sure to get to it right away! laterz~
|
|
|
|
|
|
#6 |
|
[^\d\D]
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,253
|
Well, you know we all wouldn't mind taking a look at your game! As for a jump idea...
Code:
//FLOORED OBJECT FOR GAME
//Keeps a MC on a defined floor, simple use for building
//platform jump'n'run games.
//usage:
//this.keepOnFloor(gravity,floor)
//e.g. this.keepOnFloor(7,_root.ground);
Movieclip.prototype.keepOnFloor=function (gr,floor) {
this._y+=this._gravity+=gr;
var pos=new Object();
pos.x=this._x; pos.y=this._y;
for (var i=0; i<=this._gravity; i++) {
if (floor.hitTest(pos.x,pos.y-i,1)) {
while (floor.hitTest(pos.x,pos.y- i,1)) {
pos.y--;
}
this._y=pos.y- i;
this._gravity=0;
}
}
}
//usage
//Draw any shape that shall be your floor and convert it to
//a Movieclip. Name this MC e.g. "ground".
//Put this on your character:
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {this._x+=10;}
if (Key.isDown(Key.LEFT)) {this._x-=10;}
if (Key.isDown(Key.UP)&&this._gravity==0){
this._gravity=-50; // JUMP!
}
this.keepOnFloor(7,_root.ground);
}
I haven't tested it, so that's up to you... Good luck! ![]() |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Oct 2001
Location: New Zealand
Posts: 4
|
Wow dude, that code was so much helpful... thanks soooooo much now i can get back to my game and actually tkae it out from the dusty part of my computer from where i left it when i couldnt make a jumping guy lol... catch ya later!
|
|
|
|
|
|
#8 |
|
[^\d\D]
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,253
|
So, just let us know when you get some progrss and I'd like to see the guy jumping, yeah?
![]() |
|
|
|
|
|
#9 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
That's a good little Func Proto you have there Red. Search FK, WH and here and couldn't find any other copies... I'd like to know who wrote it... any memories?
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#10 |
|
[^\d\D]
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,253
|
Can't remember at all. I remember seeing it (but where?)and thought, what the hell, copied it, and stuck it away in the archives...I thought it was in the library here, so I searched, then searched like you on the others, but to no avail. I really thought if I searched the forums here I'd come up with it...
Anyone out there knows? ![]() |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Card Match Game, Colour Me In Pictures and Board Game | Total Frigging | ActionScript 2.0 | 4 | 02-21-2005 01:04 AM |
| word search game with AS2 | black | General Chat | 5 | 08-12-2004 10:44 AM |
| [AS2] Tile game or not tile game? | krolben | Gaming and Game Development | 4 | 07-28-2004 01:41 PM |
| Game - freelancer required | fatherb | Projects and Positions | 6 | 07-18-2003 12:47 PM |