All pastes #781042 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-18 19:14 UTC
rendered paste body
onClipEvent (load) {
	var xvar = 0;
	var yvar = 0;
	friction = 0.95;
	myBounce = 10;
        w = _width/2;
        h = _height/2;
}
onClipEvent (enterFrame) {
	xvar *= friction;
	yvar *= friction;
	_x -= xvar;
	_y -= yvar;
	if (Key.isDown(87)) {
		yvar++;
		_y -= _root.speed;
	}
	if (Key.isDown(83)) {
		yvar--;
		_y += _root.speed;
	}
	if (Key.isDown(68)) {
		xvar--;
		_x += _root.speed;
	}
	if (Key.isDown(65)) {
		xvar++;
		_x -= _root.speed;
	}
	if (Key.isDown(Key.UP)) {
		yvar++;
		_y -= _root.speed;
	}
	if (Key.isDown(Key.DOWN)) {
		yvar--;
		_y += _root.speed;
	}
	if (Key.isDown(Key.RIGHT)) {
		xvar--;
		x += _root.speed;
	}
	if (Key.isDown(Key.LEFT)) {
		xvar++;
		_x -= _root.speed;
	}
	if (_root.die == true && _root.maze.hitTest(_x, _y, true)) {
		_root.life.nextFrame();
	}
	if (_root.die == true && this.hitTest(_root.invi)) {
		_root.die = false;
		_root.invi.play();
	}
	if (_root.die == false && _root.maze.hitTest(_x+w, _y, true)) {
		_x -= myBounce;
	}
	if (_root.die == false && _root.maze.hitTest(_x-w, _y, true)) {
		_x += myBounce;
	}
	if (_root.die == false && _root.maze.hitTest(_x, _y+h, true)) {
		_y -= myBounce;
	}
	if (_root.die == false && _root.maze.hitTest(_x, _y-h, true)) {
		_y += myBounce;
	}
}