[COLOR=red]EDIT[/COLOR]:Okay, this is the mini game I made so far since I was bored.
PLAY
This should work, it’s a simple movement code for moving and jumping and falling. So why does the bold part not work?
//defined variables on load
onClipEvent(load){
PLAYERX=this._x;
PLAYERY=this.Hero._y;
jumping = true;
jump = 0;
movespeed=4;
falling=true;
fallspeed=10;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)&&this._xscale==-100||Key.isDown(68)&&this._xscale==-100){
this._xscale=100;
**this._x+=movespeed;**
}
if(Key.isDown(Key.LEFT)&&this._xscale==100||Key.isDown(65)&&this._xscale==100){
this._xscale=-100;
**this._x-=movespeed;**
}
//jumping
if (Key.isDown(Key.UP) && !jumping && !falling||Key.isDown(87)&& !jumping && !falling) {
_root.jumpsound.start();
jumping = true;
}
if (jumping) {
this._y -= jump;
jump -= 1;
if (jump<0) {
falling = true;
}
if (jump<-12) {
jump = -12;
}
}
//falling
if (_root.Ground.hitTest(this._x, this._y, true) && falling) {
jump = 15;
jumping = false;
falling = false;
}
if (!_root.Ground.hitTest(this._x, this._y, true) && !jumping) {
this._y += fallspeed;
falling=true;
}
}