Ok Since I havent done Platform games in like my whole programming time I completly forgot how and understood.
So I commented this code to see if it was right and now I mam checking with you to check with the code.
onClipEvent (load) {
// Variables for setting velocity Accelartion and Jumping
vel_y = 0;
accel = 4;
jumping = false;
}
onClipEvent (enterFrame) {
// Boundaries Of The Platform
my_bounds = new Object();
my_bounds = this.getBounds(_root);
t_edge = my_bounds.Ymin;
b_edge = my_bounds.Ymax;
if (Key.isDown(Key.RIGHT)) {
this._x = this._x+5;
}
// Move Left
if (Key.isDown(Key.LEFT)) {
this._x = this._x-5;
}
// Jumpin Is allowed
if (gravity eq "on" and platform eq "off" and !jumping) {
this._y = this._y+12;
jumping = true;
}
// Key To Jump
if (Key.isDown(Key.UP) && !jumping) {
platform = "no";
vel_y = 22;
jumping = true;
}
// To Jump Or Not TO Jump(that is the question)
if (jumping == true) {
if (platform eq "on") {
gravity = "on";
vel_y = 0;
jumping = false;
} else {
gravity = "off";
}
vel_y -= accel;
if (vel_y<-12) {
vel_y = -12;
}
this._y -= vel_y;
}
// Settings
platform = "off";
gravity = "on";
// Boundaries In THe Level
if (this._x<=10) {
this._x = 10;
}
}
if I am wrong could you maybe Tell me what it does do then.