-
Senior Member
Need some help on my platform engine
hi,
here's my engine for my platform game but I still need to add some thing like for example if you press the left arrow key it needs to display the mc left the same thing for jump, duck, run, shoot etc. Only I dont know how :S I made this more than a year ago and since than I did no AS so I kinda forot most things :'(
this code is put in the hero mc so I dont know if I should move it somewhere else.
here it is:
onClipEvent (load) {
gravity = "on";
old_y = this._y;
jumping = false;
dir = "decel";
}
onClipEvent (enterFrame) {
distance = old_y-this._y;
if (Key.isDown(Key.LEFT)) {
this._x -= 10;
}
if (Key.isDown(Key.RIGHT)) {
this._x += 10;
}
if (gravity == "on" && jumping == true && dir == "decel") {
this._y += 15;
}
if (Key.isDown(Key.SPACE) && jumping == false) {
old_y = this._y;
jumping = true;
dir = "accel";
}
if (dir == "accel") {
this._y -= 15;
}
if (distance>=70) {
dir = "decel";
}
if (_root.back.hitTest(this._x, this._y+43, true)) {
gravity = "off";
jumping = false;
old_y = this._y;
} else {
gravity = "on";
jumping = true;
}
}
onClipEvent (load) {
moveSpeed = 10;
_root.laser._visible = false;
laserCounter = 1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL)) {
laserCounter++;
_root.laser.duplicateMovieClip("laser"+laserCounte r, laserCounter);
_root["laser"+laserCounter]._visible = true;
}
}
edit: for those of you that want to see some of the animations check http://home.zonnet.nl/caroladevries/cj/bb_anime.swf
Last edited by tongue of colicab; 11-17-2003 at 11:00 AM.
-
Senior Member
ok, I just figured out the hittest with the freaking ground works like crap too Some1 got some ideas on how to make this work better? I also need to jump on platforms and you must be able not to walk true walls.
-
DOT-INVADER
so it's a platform game...?
ok, i have an art based open source located here:
www.gotoandplay.it , article section. the hitTest is *almost* perfect (let's say it's perfect, then ) and the animations are playing correctly
-
leight.com.au
yeh marmotte's platform engine is great! the hitTest with the groud is better than mine mine doesnt have the walking anims etc. But if you wana check mine out, its in my sig.
hope it helps
-
Senior Member
marmotte I tried but I really cant get the thing to work :@ I copied every piece of code into my hero mc and all (changed the names too) but Just nothing happens.
@leight: cool engine but just as with marmotte's engine I just cant get things to work :S
I feel really stupid not getting things to work, I guess, My as skills are just 0.0. Is one of you willing to help me out getting the basics to work?
thanks for the replies
-
.fla
-
DOT-INVADER
thanks for the nice words, vont and leight ^_^
i remember your file, vont, and i thought it was mine! never mind, the file i posted at gotoandplay is my newest version, now pixel perfect... but it remains art based...
tongue of colicab, sure i can explain everything, but please try to learn from my file (or some working file)(i know, i know, i truely HATE studying AS with other's files and prefer experiment by myself... that's probably why i spent WEEKS on creating my first hitTest (rocky raccoon wandering in a zelda world, it brings back sweet memories )... anyway, it paid at the end. oh, and my file is fully commented, so i think it's not that hard to understand after a while, no?
oh, maybe instead of copying my AS into your file, why don't you simply change the gfx i used and put yours? (ok, if you do that you will not learn anything... urm!)
-
leight.com.au
-
.fla
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|