Advertisement
Hydro9268

2003 Flash Map Source code - Console Controls

Jun 4th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* CONSOLE - USED FOR NAVIGATION */
  2.  
  3. // globally set level location of objects
  4. BASE = _level0;
  5.  
  6. // *** main objInit ***
  7. objWidth = getProperty(_level0.mapLoad,_width);
  8. objHeight = getProperty(_level0.mapLoad,_height);
  9.  
  10. northButtonY = 10;
  11. eastButtonX = 550;
  12. southButtonY = 375;
  13. westButtonX = 0;
  14. if (objWidth >= 700) {
  15.     speed = 3;
  16. } else if (objWidth <= 699 && objWidth >= 400) {
  17.     speed = 2;
  18. } else {
  19.     speed = 1;
  20. }
  21.  
  22. // *** function calls ***
  23. north.onPress = northMovePress;
  24. north.onRelease = controlRelease;
  25. north.onReleaseOutside = controlRelease;
  26.  
  27. east.onPress = eastMovePress;
  28. east.onRelease = controlRelease;
  29. east.onReleaseOutside = controlRelease;
  30.  
  31. south.onPress = southMovePress;
  32. south.onRelease = controlRelease;
  33. south.onReleaseOutside = controlRelease;
  34.  
  35. west.onPress = westMovePress;
  36. west.onRelease = controlRelease;
  37. west.onReleaseOutside = controlRelease;
  38.  
  39. // *** mouse release ***
  40. function controlRelease() {    
  41.     this._quality = "HIGH";
  42.     clearInterval(this.navAction);
  43.     delete this.navAction;
  44. }
  45.  
  46. //*** move north ***
  47. function northMovePress() {
  48.     this._quality = "MEDIUM";  
  49.     this.navAction = setInterval(function() {
  50.     objY = getProperty(BASE,_y);
  51.     moveMax = objHeight - (objY * -1) - 9;
  52.         if (moveMax <= objHeight) {
  53.             BASE._y = BASE._y + speed;
  54.         }
  55.     }, 0);
  56. }
  57.  
  58. //*** move east ***
  59. function eastMovePress() {
  60.     this._quality = "MEDIUM";  
  61.     this.navAction = setInterval(function() {
  62.     objX = getProperty(BASE,_x);
  63.     moveMax = objWidth - (objX * -1) + 5;
  64.         if (moveMax >= eastButtonX) {
  65.             BASE._x = BASE._x - speed;
  66.         }
  67.     }, 0);
  68. }
  69.  
  70. //*** move south ***
  71. function southMovePress() {
  72.     this._quality = "MEDIUM";  
  73.     this.navAction = setInterval(function() {
  74.     objY = getProperty(BASE,_y);
  75.     moveMax = objHeight - (objY * -1) + 5;
  76.         if (moveMax >= southButtonY) {
  77.             BASE._y = BASE._y - speed;
  78.         }
  79.     }, 0);
  80. }
  81.  
  82. //*** move west ***
  83. function westMovePress() {
  84.     this._quality = "MEDIUM";  
  85.     this.navAction = setInterval(function() {
  86.     objX = getProperty(BASE,_x);
  87.     moveMax = (objWidth - objX) + 9;
  88.         if (moveMax >= objWidth) {
  89.             BASE._x = BASE._x + speed;
  90.         }
  91.     }, 0);
  92. }
  93.  
  94. stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement