View Full Version : My Sidescrolling Game

10-23-2001, 09:24 PM
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!

10-24-2001, 01:14 AM
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

10-24-2001, 05:57 AM
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!

10-26-2001, 07:11 AM
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.. ??

10-26-2001, 08:03 AM
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~

red penguin
10-26-2001, 10:49 AM
Well, you know we all wouldn't mind taking a look at your game! As for a jump idea...

//Keeps a MC on a defined floor, simple use for building
//platform jump'n'run games.
//e.g. this.keepOnFloor(7,_root.ground);

Movieclip.prototype.keepOnFloor=function (gr,floor) {
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)) {
this._y=pos.y- i;
//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!


I believe I got this from this very site but for the life of me I don't remember from who. If anyone can claim credit, then please do so...Sorry for not writing it down!!
I haven't tested it, so that's up to you...
Good luck!:)

10-26-2001, 10:55 AM
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!

red penguin
10-26-2001, 11:02 AM
So, just let us know when you get some progrss and I'd like to see the guy jumping, yeah?

10-26-2001, 12:01 PM
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?

red penguin
10-26-2001, 12:49 PM
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? :confused:

10-26-2001, 07:35 PM
Were you sleep coding? :D Maybe you coded it in your sleep and just forgot about it? hahaha

Josh Dura

10-26-2001, 09:03 PM
that function was from PROTO[type] (http://www.layer51.com/proto/d.asp?p=1&f=198) it was written by bma at bitfrog dot de. ive played around with this one also, and it is pretty sweet.

red penguin
10-26-2001, 11:36 PM
ahhh, someone with a brain...Thanks tg! Give credit where credit is due...Hey, wasn't it you who originally told us about proto[type]?

10-27-2001, 02:45 AM
if i brought it up here first or not, but doesn't really matter... i found it from this (http://www.were-here.com/forums/showthread.php?threadid=52708&pagenumber=1) were-here thread. its a good read, but 23 pages long so be ready to spend some time on it.

the thread was started by flashguru and grew from there. someone who was obviously enjoying the thread desided to turn it into a project. i think it turned out great.

good stuff.