Public paste
STYLO
By: KARIMO | Date: Mar 7 2007 12:38 | Format: None | Expires: never | Size: 1.15 KB | Hits: 1298

  1. var levens = 3;
  2. //initialisatiescript
  3. var toets = "";
  4. //besturing
  5. Key.addListener(this);
  6. function onKeyDown() {
  7.         toets = Key.getCode();
  8. }
  9. function onKeyUp() {
  10.         toets = "";
  11.         bal.gotoAndStop(1);
  12. }
  13. function onEnterFrame() {
  14.         oudex = bal._x;
  15.         oudey = bal._y;
  16.         vijand._x += 20;
  17.         if (vijand._x>550) {
  18.                 vijand._x = -50;
  19.                 vijand._y = Math.round(Math.random()*450+25);
  20.         }
  21.         if (bal.hitTest(vijand) && vijand._visible) {
  22.                 levens--;
  23.                 vijand._visible = false;
  24.         }
  25.         leven._x += 20;
  26.         if (leven._x>550) {
  27.                 leven._x = -50;
  28.                 leven._y = Math.round(Math.random()*450+25);
  29.         }
  30.         if (bal.hitTest(leven) && leven._visible) {
  31.                 levens++;
  32.                 leven._visible = false;
  33.         }
  34.         if (toets == 39) {
  35.                 bal._x += 20;
  36.                 bal.gotoAndStop(2);
  37.         }
  38.         if (toets == 37) {
  39.                 bal._x -= 20;
  40.                 bal.gotoAndStop(3);
  41.         }
  42.         if (toets == 38) {
  43.                 bal._y -= 20;
  44.         }
  45.         if (toets == 40) {
  46.                 bal._y += 20;
  47.         }
  48.         if (bal._x>500) {
  49.                 bal._x = 500;
  50.         }
  51.         if (bal._x<50) {
  52.                 bal._x = 50;
  53.         }
  54.         if (bal._y>450) {
  55.                 bal._y = 450;
  56.         }
  57.         if (bal._y<0) {
  58.                 bal._y = 0;
  59.         }
  60.         for (a=1; a<=5; a++) {
  61.                 if (bal.hitTest("_root.doolhof.muur"+a)) {
  62.                         bal._x = oudex;
  63.                         bal._y = oudey;
  64.                 }
  65.         }
  66. }
  67.