Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CONSOLE - USED FOR NAVIGATION */
- // globally set level location of objects
- BASE = _level0;
- // *** main objInit ***
- objWidth = getProperty(_level0.mapLoad,_width);
- objHeight = getProperty(_level0.mapLoad,_height);
- northButtonY = 10;
- eastButtonX = 550;
- southButtonY = 375;
- westButtonX = 0;
- if (objWidth >= 700) {
- speed = 3;
- } else if (objWidth <= 699 && objWidth >= 400) {
- speed = 2;
- } else {
- speed = 1;
- }
- // *** function calls ***
- north.onPress = northMovePress;
- north.onRelease = controlRelease;
- north.onReleaseOutside = controlRelease;
- east.onPress = eastMovePress;
- east.onRelease = controlRelease;
- east.onReleaseOutside = controlRelease;
- south.onPress = southMovePress;
- south.onRelease = controlRelease;
- south.onReleaseOutside = controlRelease;
- west.onPress = westMovePress;
- west.onRelease = controlRelease;
- west.onReleaseOutside = controlRelease;
- // *** mouse release ***
- function controlRelease() {
- this._quality = "HIGH";
- clearInterval(this.navAction);
- delete this.navAction;
- }
- //*** move north ***
- function northMovePress() {
- this._quality = "MEDIUM";
- this.navAction = setInterval(function() {
- objY = getProperty(BASE,_y);
- moveMax = objHeight - (objY * -1) - 9;
- if (moveMax <= objHeight) {
- BASE._y = BASE._y + speed;
- }
- }, 0);
- }
- //*** move east ***
- function eastMovePress() {
- this._quality = "MEDIUM";
- this.navAction = setInterval(function() {
- objX = getProperty(BASE,_x);
- moveMax = objWidth - (objX * -1) + 5;
- if (moveMax >= eastButtonX) {
- BASE._x = BASE._x - speed;
- }
- }, 0);
- }
- //*** move south ***
- function southMovePress() {
- this._quality = "MEDIUM";
- this.navAction = setInterval(function() {
- objY = getProperty(BASE,_y);
- moveMax = objHeight - (objY * -1) + 5;
- if (moveMax >= southButtonY) {
- BASE._y = BASE._y - speed;
- }
- }, 0);
- }
- //*** move west ***
- function westMovePress() {
- this._quality = "MEDIUM";
- this.navAction = setInterval(function() {
- objX = getProperty(BASE,_x);
- moveMax = (objWidth - objX) + 9;
- if (moveMax >= objWidth) {
- BASE._x = BASE._x + speed;
- }
- }, 0);
- }
- stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement