Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent (load) {
- yspeed = 0;
- xspeed = 0;
- wind = 0.00;
- power = 5;
- gravity = 0;
- upconstant = 0.75;
- friction = 0.99;
- collected_coins = 0;
- }
- onClipEvent (enterFrame) {
- if (Key.isDown(Key.LEFT)) {
- xspeed = xspeed-power;
- gravity = 0.8;
- }
- if (Key.isDown(Key.RIGHT)) {
- xspeed = xspeed+power;
- gravity = 0.8;
- }
- if (Key.isDown(Key.UP)) {
- yspeed = yspeed-power*upconstant;
- gravity = 0.8;
- }
- if (Key.isDown(Key.DOWN)) {
- yspeed = yspeed+power*upconstant;
- gravity = 0.8;
- }
- xspeed = (xspeed+wind)*friction;
- yspeed = yspeed+gravity;
- _y = _y+yspeed;
- _x = _x+xspeed;
- _rotation = _rotation+xspeed;
- if (_root.wall.hitTest(_x, _y, true)) {
- xspeed = 0;
- yspeed = 0;
- _x = 50;
- _y = 50;
- _root.score -= 2;
- _root.lives -= 1;
- if (_root.score<0) {
- _root.score = 0;
- }
- }
- if (_root.environment.hitTest(_x, _y, true)) {
- xspeed = 0;
- yspeed = 0;
- _x = 50;
- _y = 50;
- _root.score -= 1;
- _root.lives -= 1;
- if (_root.score<0) {
- _root.score = 0;
- }
- if (_root.lives = 0) {
- _root.lives = 0;
- }
- }
- if (_root.coin.hitTest(this.dude_hit)) {
- _root.coin._x = Math.random()*400+50;
- _root.coin._y = Math.random()*250+50;
- _root.score++;
- collected_coins++;
- }
- _root.level1_text.text = 10-collected_coins+" more to go";
- if (collected_coins == 10) {
- _root.play();
- }
- if (_root.lives == 0) {
- collected_coins = 0
- }
- _root.lives_text.text = _root.lives;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement