View
Theme
Font Style
7pt
8pt
9pt
10pt
11pt
Line Style
100%
110%
120%
130%
140%
Bold Keyword
Default
Inspector
Kkaefer
Eclipse
SQ Light
Lesser
Dark
Cobalt
Monokai
Rubyblue
Night
SQ Dark
Ambiance
Blackboard
Line Num.
Wrap Lines
Preview
Redraw
JS Tab
HTML Tab
CSS Tab
Live Tab
Prev. Tab
Next Tab
Browser
History…
Help
Edit
Settings
Auto Complete
Match Brackets
Match Highlight
Strip Whitespace
Auto Close Brackets
Auto Close Quotes
Show Print Margin
Undo
Redo
Delete
Select Line
Select All
Find & Replace
Find
Find in Repo.
Find Next
Find Previous
Replace Single
Replace All
Wrap Search
Revert
As Template
Diff Revision
Format
Compress
Text
Zen Coding
Indent
Tab Width
1
2
3
4
5
6
7
8
Indent Unit
1
2
3
4
5
6
7
8
Smart Indent
Use Tabs
Visible Tabs
Shift Left
Shift Right
Put Indent
Number
Increment by 1
Decrement by 1
Increment by 0.1
Decrement by 0.1
Increment by 10
Decrement by 10
Simple Math
Comment
Line
Move Up
Move Down
Copy Up
Copy Down
Go to Line…
Remove Line
Next Point
Prev. Point
Help
Share
Login
You can jump to the latest bin by adding
/latest
to your URL
×
z
Find
→
←
⟲
Replace
⊗
All
Replace
// Crystal Galaxy // Effect Games LLC // Version: 1.0b // Author: Joseph Huckaby // Copyright (c) 2009 Effect Games LLC Effect.Game.addEventListener( 'onLoadGame', function() { // setup our game // load title screen Effect.Game.loadLevel( 'TitleScreen', CrystalGalaxy.do_title_screen ); // Hook the 'start' key for pausing and resuming the game // or starting a new game if we're on the title screen "level" Effect.Game.setKeyHandler('start', { onKeyDown: function() { if (Effect.Game.getState() == 'title') CrystalGalaxy.start_new_game(); else Effect.Game.pause(); } } ); Effect.Game.setResumeKey( 'start' ); // Hook the pause and resume events so we can control the music and play a pause sound Effect.Game.addEventListener( 'onPause', function() { Effect.Audio.quiet(); Effect.Audio.playSound( 'pause_resume.mp3' ); var splane = Effect.Port.getPlane('sprites'); if (splane) { var player = splane.getSprite('player'); if (player) player.leftMouseButtonDown = false; } } ); Effect.Game.addEventListener( 'onResume', function() { Effect.Audio.playSound( 'pause_resume.mp3' ); if (Effect.Game.getState() == 'run') Effect.Audio.getTrack('engine').play(); // fade music back in over 45 frames, to not overwhelm the sound effect var music_id = Effect.Game.getLevelProps().music; if (music_id) Effect.Audio.getTrack( music_id ).fadeIn( 45 ); var splane = Effect.Port.getPlane('sprites'); if (splane) { var player = splane.getSprite('player'); if (player) player.leftMouseButtonDown = false; } } ); // finally, if the user has disabled, then re-enabled music, we have to resume the track Effect.Game.addEventListener( 'onEnableMusic', function() { var music_id = Effect.Game.getLevelProps().music; if (music_id) Effect.Audio.getTrack( music_id ).play(); } ); // more event hooks Effect.Game.setStateHandler( 'title', function(clock) { // Effect.Port.setBackgroundOffset( clock, 0 ); } ); Effect.Game.setStateHandler( 'run', function(clock) { // handle autoscroll var b = CrystalGalaxy.scroll_behavior; var splane = Effect.Port.getPlane('sprites'); if (!splane) return; var player = splane.getSprite('player'); if (CrystalGalaxy.gameMode == 'standard') { // b.angle += ((b.targetAngle - b.angle) / b.angleEase); b.angle = b.targetAngle; b.distance += ((b.targetDist - b.distance) / b.distEase); b.scroll.project( b.angle, b.distance ); var pt = b.scroll.clone().floor(); player.offset( pt.x - Effect.Port.scrollX, pt.y - Effect.Port.scrollY ); // counteract scroll affect on ship Effect.Port.setScroll( pt.x, pt.y ); } if (player.dirtyDisplay) { // update HUD player.update_hud(); player.dirtyDisplay = false; } // handle sound loops var snds = CrystalGalaxy.requestSound; for (var key in snds) { var track = Effect.Audio.getTrack(key); if (snds[key]) { if (!track.isPlaying()) { Debug.trace('cg', "There is a request to play audio track " + key + " and it is not currently playing, so calling play() on it now"); track.play(); } snds[key] = 0; } else { if (track.isPlaying()) { Debug.trace('cg', "There is no longer a need to play audio track " + key + " but it is still playing, so calling stop() on it now"); track.stop(); } delete snds[key]; } } // survival mode if (CrystalGalaxy.gameMode == 'survival') { // spawn stuff, increasing probability if (clock % 45 == 0) { CrystalGalaxy.survival_idle(); } } // survival } ); // run state handler (logic) /* Effect.Game.addEventListener( 'onMouseMove', function(pt) { Debug.trace("Game.onMouseMove: " + dumper(pt)); } ); */ Effect.Game.addEventListener( 'onMouseMove', function(globalPt) { // Debug.trace("Port.onMouseMove: " + dumper(pt)); var pt = Effect.Port.getMouseCoords( true ); if (pt.x < Effect.Port.scrollX) pt.x = Effect.Port.scrollX; else if (pt.x >= Effect.Port.scrollX + Effect.Port.portWidth) pt.x = (Effect.Port.scrollX + Effect.Port.portWidth) - 1; if (pt.y < Effect.Port.scrollY) pt.y = Effect.Port.scrollY; else if (pt.y >= Effect.Port.scrollY + Effect.Port.portHeight) pt.y = (Effect.Port.scrollY + Effect.Port.portHeight) - 1; CrystalGalaxy.lastMousePt = pt; if (Effect.Game.getState() == 'run') { Effect.Port.getPlane('sprites').getSprite('player').mouse_move(pt); } } ); Effect.Port.addEventListener( 'onMouseDown', function(pt, buttonNum) { if (Effect.Game.getState() == 'run') { Effect.Port.getPlane('sprites').getSprite('player').mouse_down(pt, buttonNum); } } ); Effect.Port.addEventListener( 'onMouseUp', function(pt, buttonNum) { if (Effect.Game.getState() == 'run') { Effect.Port.getPlane('sprites').getSprite('player').mouse_up(pt, buttonNum); } } ); Effect.Game.addEventListener( 'onKeyDown', function(name, code) { if (Effect.Game.getState() == 'title') { var c = CrystalGalaxy; if ((c.konamiIdx < c.konamiCodes.length) && (code == c.konamiCodes[c.konamiIdx])) { c.konamiIdx++; if (c.konamiIdx >= c.konamiCodes.length) { Effect.Audio.playSound( 'get_option' ); } } } } ); } ); var CrystalGalaxy = { konamiCodes: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], konamiIdx: 0, lastMousePt: new Point(), rockSizes: [32, 64, 96], rockClasses: ['a', 'b', 'c', 'd'], spriteGroups: {}, requestSound: {}, scroll_behavior: { scroll: new Point(), angle: 0, distance: 0, targetAngle: 0, angleEase: 32, targetDist: 0, distEase: 32 }, do_title_screen: function() { // title screen is now loaded Effect.Game.clearSchedule(); Effect.Game.setState( 'title' ); Effect.Port.setScroll( 0, 0 ); var splane = Effect.Port.getPlane('sprites'); if (!splane) { splane = new SpritePlane('sprites'); splane.zIndex = 2; Effect.Port.attach(splane); } var bplane = Effect.Port.getPlane('bkgnd'); if (!bplane) { bplane = new SpritePlane('bkgnd'); bplane.zIndex = 1; bplane.setScrollSpeed( 0.5 ); Effect.Port.attach(bplane); } Effect.Port.tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { backgroundOffsetX: { start: 150, end: 0 } } }); splane.createSprite( StaticImageSprite, { url: '/images/title/title.png', x: 130, y: -150, zIndex: 3 } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { y: { start: -150, end: 40 } } }); splane.createSprite( StaticImageSprite, { url: '/images/title/crystal.png', x: 410, y: 600, zIndex: 2 } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { y: { start: 600, end: -5 } } }); splane.createSprite( StaticImageSprite, { url: '/images/title/ship.png', x: -480, y: 220, zIndex: 2 } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { x: { start: -480, end: 110 } } }); bplane.createSprite( StaticImageSprite, { url: '/images/title/planet.png', x: 800, y: 220, zIndex: 1 } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { x: { start: 800, end: -20 } } }); // hook mouse events for the buttons splane.createSprite( 'TitleButton', { url: 'button_new_game.png', x: 800, y: 600, zIndex: 4, onMouseUp: function() { CrystalGalaxy.start_new_game(); } } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { x: { start: 800, end: 570 }, y: { start: 600, end: 425 } } }).captureMouse(); splane.createSprite( 'TitleButton', { url: 'button_survival.png', x: 800, y: 600, zIndex: 4, onMouseUp: function() { CrystalGalaxy.start_survival(); } } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { x: { start: 800, end: 570 }, y: { start: 645, end: 470 } } }).captureMouse(); splane.createSprite( 'TitleButton', { url: 'button_about.png', x: 800, y: 600, zIndex: 4, onMouseUp: function() { CrystalGalaxy.show_about(); } } ).tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { x: { start: 800, end: 570 }, y: { start: 690, end: 515 } } }).captureMouse(); // play title music var music_id = Effect.Game.getLevelProps().music; Effect.Audio.getTrack( music_id ).rewind().play(); // reset konami code CrystalGalaxy.konamiIdx = 0; }, show_about: function() { // show about page var splane = Effect.Port.getPlane('sprites'); if (!splane.getSprite('about')) { splane.createSprite( StaticImageSprite, { id: 'about', url: '/images/title/about.png', x: 810, y: 566, zIndex: 1 } ); splane.createSprite( 'TitleButton', { url: 'button_back.png', x: 1090, y: 1107, zIndex: 4, onMouseUp: function() { CrystalGalaxy.cancel_about(); } } ).captureMouse(); } Effect.Audio.playSound( 'click' ); Effect.Port.tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { scrollX: 800, scrollY: 576 } }); }, cancel_about: function() { // return to title Effect.Audio.playSound( 'click' ); Effect.Port.tween({ delay: 0, duration: 180, mode: 'EaseOut', algorithm: 'Quintic', properties: { scrollX: 0, scrollY: 0 } }); }, start_new_game: function() { // start new game (from title screen) var port = Effect.Port; CrystalGalaxy.spriteGroups = {}; CrystalGalaxy.gameMode = 'standard'; Effect.Audio.quiet(); Effect.Audio.playSound( 'start_new_game.mp3' ); Effect.Game.clearSchedule(); Effect.Game.removeAllTweens(); Effect.Port.removeAll(); Effect.Port.setBackgroundColor('black'); Effect.Game.loadLevel( 'Level1', CrystalGalaxy.start_level ); // level loaded }, // start_new_game start_survival: function() { // start new game (from title screen) var port = Effect.Port; CrystalGalaxy.scroll_behavior.targetDist = 0; CrystalGalaxy.scroll_behavior.distance = 0; CrystalGalaxy.spriteGroups = {}; CrystalGalaxy.gameMode = 'survival'; CrystalGalaxy.logicStart = Effect.Game.logicClock; Effect.Audio.quiet(); Effect.Audio.playSound( 'start_new_game.mp3' ); Effect.Game.clearSchedule(); Effect.Game.removeAllTweens(); Effect.Port.removeAll(); Effect.Port.setBackgroundColor('black'); Effect.Game.loadLevel( 'Survival', CrystalGalaxy.start_level ); // level loaded }, // start_survival start_level: function() { // level is loaded! Effect.Game.setState( 'run' ); // particle plane // (for objects that don't have to hit each other) if (!Effect.Port.getPlane('particles')) { var particle_plane = new SpritePlane('particles'); particle_plane.zIndex = 4; Effect.Port.attach(particle_plane); } // initialize our heads-up display if (!Effect.Port.getPlane('huds')) { var hplane = new SpritePlane('huds'); hplane.setZIndex( 90 ); hplane.setScrollSpeed( 0 ); Effect.Port.attach(hplane); hplane.createSprite( StaticImageSprite, { url: '/images/interface/hud_background.png', x: 0, y: 0 } ); var hud = new TextSprite('hud'); hud.setZIndex( 91 ); // above everything else // hud.setFont( 'digitaldream' ); hud.setCustomFont( '/fonts/digitaldream-19pt-custom.png', 16, 20 ); hud.setTableSize( 50, 1 ); hud.setTracking( 1.0, 1.0 ); hud.setPosition( 16, 7 ); hplane.attach(hud); } // get references to our planes, which were created when the level loaded var splane = Effect.Port.getPlane('sprites'); var tplane = Effect.Port.getPlane('tiles'); // connect the planes, for collision detection if (tplane) splane.linkTilePlane( tplane ); // locate our player sprite and scroll to its position var player = splane.getSprite( 'player' ); if (!player) alert("FAIL"); player.powerups = {}; player.setImage( 'ship5.png' ); player.tow = null; player.crystals = 0; player.lastBestPowerup = ''; if (CrystalGalaxy.konamiIdx >= CrystalGalaxy.konamiCodes.length) { player.lives = 30; } Effect.Port.follow( player ); CrystalGalaxy.scroll_behavior.scroll.set( Effect.Port.scrollX, Effect.Port.scrollY ); // capture key for buy powerup player.setKeyHandler( 'select' ); // update our HUD with the player's current stats player.update_hud(); // setup taildragger // player.head.set( player.x + 32, player.y ); // player.rawMouse.set( player.head ); // player.tail.set( player.head.getPointFromOffset( 0, 64 ) ); player.rawMouse.set( Effect.Port.getMouseCoords() || CrystalGalaxy.lastMousePt ); player.start_flyin(); // start our music track var music_id = Effect.Game.getLevelProps().music; Effect.Audio.getTrack( music_id ).rewind().setVolume(1.0).play(); // ship thrust sprites var flame1 = Effect.Port.getPlane('particles').createSprite( 'ShipThrust', { dieOffscreen: false, x: 1000, y: 1000, offsetAngle: 90, offsetDistance: 4, character: player }); var flame2 = Effect.Port.getPlane('particles').createSprite( 'ShipThrust', { dieOffscreen: false, x: 1000, y: 1000, offsetAngle: 270, offsetDistance: 4, character: player }); // start the ship thrust sound var thrustSound = Effect.Audio.getTrack('engine'); thrustSound.setVolume( 0 ); thrustSound.play(); // hide the cursor Effect.Port.hideCursor(); // setup all enemy ship groups splane.findSprites( {}, true ).each( function(sprite) { if (sprite.groupId) { if (!CrystalGalaxy.spriteGroups[ sprite.groupId ]) CrystalGalaxy.spriteGroups[ sprite.groupId ] = { count: 0 }; CrystalGalaxy.spriteGroups[ sprite.groupId ].count++; } } ); for (var key in CrystalGalaxy.spriteGroups) { CrystalGalaxy.spriteGroups[key].remain = CrystalGalaxy.spriteGroups[key].count; } // show ready message if (Effect.Game.getLevelProps().startMsg) { Effect.Game.scheduleEvent( 30, function() { CrystalGalaxy.show_message( Effect.Game.getLevelProps().startMsg ); } ); } /* if (CrystalGalaxy.gameMode == 'survival') { // start us out with a fine rock Effect.Game.scheduleEvent( 45 * 3, function() { CrystalGalaxy.spawn_rock({ screenLoop: true }); } ); } */ }, // start_level survival_idle: function() { var splane = Effect.Port.getPlane('sprites'); var player = splane.getSprite('player'); var max_sec = 250; // after N seconds, we're spawning at "full speed" var sec = Math.floor( (Effect.Game.logicClock - CrystalGalaxy.logicStart) / 45 ); if (sec > max_sec) sec = max_sec; var difficulty = (sec / max_sec); // 0.0 to 1.0 var rnd = Math.random() * max_sec; // if no enemies are onscreen, force a spawn var numEnemies = splane.findSprites({ category: 'enemy' }).length + splane.findSprites({ type: 'Rock' }).length; var enemyTypes = ['rock','rock','rock','miner','shooter','miner','shooter']; if (sec > 30) enemyTypes.push( 'sphere' ); if (sec > 60) enemyTypes.push( 'tesla' ); if (sec > 120) { enemyTypes.push( 'shooter' ); enemyTypes.push( 'shooter' ); } if (sec == max_sec) { enemyTypes.push( 'shooter' ); enemyTypes.push( 'shooter' ); } if (((rnd < sec) || !numEnemies) && (sec > 3) && (player.state != 'death')) { switch (rand_array(enemyTypes)) { case 'rock': CrystalGalaxy.spawn_rock({ screenLoop: true }); break; case 'miner': CrystalGalaxy.spawn_ship({ shipType: 6, state: 'seek', angleSpeed: 2 + (3 * difficulty), speed: 2 + (3 * difficulty), energy: 3 + (3 * difficulty), shootProb: 0 }); break; case 'shooter': CrystalGalaxy.spawn_ship({ shipType: 1, state: 'seek', angleSpeed: 2 + (3 * difficulty), speed: 2 + (3 * difficulty), energy: 3 + (3 * difficulty), shootProb: 0.01 + (0.1 * difficulty) }); break; case 'tesla': var pt = new Point( Effect.Port.scrollX + (Effect.Port.portWidth / 2), Effect.Port.scrollY + (Effect.Port.portHeight / 2) ); var dist = Math.sqrt( Math.pow(Effect.Port.portWidth / 2, 2) + Math.pow(Effect.Port.portHeight / 2, 2) ); var ang = Math.random() * 360; pt.project( ang, dist ).floor(); var delta = (new Point()).project( ang + 180, 2 + (2 * difficulty) ); Effect.Port.getPlane('sprites').createSprite( 'TeslaCoil', { x: pt.x - 32, y: pt.y - 32, xd: delta.x, yd: delta.y, angle: ang, angleDelta: 0.5 + (1 * difficulty), numBolts: 4 }); break; case 'sphere': var ang = Math.random() * 360; var dist = Math.sqrt( Math.pow(Effect.Port.portWidth / 2, 2) + Math.pow(Effect.Port.portHeight / 2, 2) ); var pt = Effect.Port.getPlane('sprites').getScreenRect().centerPoint().project( ang, dist ).offset(-32, -32); Effect.Port.getPlane('sprites').createSprite( 'Sphere', { x: pt.x, y: pt.y, angle: ang, angleDelta: 0.5 + (2 * difficulty), distance: dist, distanceDelta: -1 - (2 * difficulty), behavior: 'trig' }); break; } // switch type } // time to spawn player.update_hud(); // time counter }, spawn_ship: function(args) { var pt = new Point( Effect.Port.scrollX + (Effect.Port.portWidth / 2), Effect.Port.scrollY + (Effect.Port.portHeight / 2) ); var dist = Math.sqrt( Math.pow(Effect.Port.portWidth / 2, 2) + Math.pow(Effect.Port.portHeight / 2, 2) ); pt.project( Math.random() * 360, dist ).floor(); args.cx = pt.x; args.cy = pt.y; Effect.Port.getPlane('sprites').createSprite( 'EnemyShip', args); }, spawn_rock: function(args) { // spawn new rock object if (!args) args = {}; var port = Effect.Port; var x = args.x; var y = args.y; var rockClass = args.rockClass; var rockSize = args.rockSize; // if (!rockSize) rockSize = rockSizes[ parseInt(Math.random() * 3) ]; if (!rockSize) rockSize = 96; if (!rockClass) rockClass = CrystalGalaxy.rockClasses[ Math.floor(Math.random() * 4) ]; var xd = args.xd; if (!xd) { xd = Math.floor(Math.random() * 6) - 3; if (!xd) xd = 2; else if (Math.abs(this.xd) == 1) this.xd *= 2; } var yd = args.yd; if (!yd) { var yd = Math.floor(Math.random() * 6) - 3; if (!yd) yd = -2; else if (Math.abs(this.yd) == 1) this.yd *= 2; } if (!x && !y) { if (Math.abs(xd) > Math.abs(yd)) { // more of a horizontal rock if (xd < 0) x = port.scrollX + port.portWidth; else x = port.scrollX - rockSize; y = (port.scrollY - rockSize) + Math.floor( Math.random() * (port.portHeight + rockSize) ); } else { // more of a vertical rock if (yd < 0) y = port.scrollY + port.portHeight; else y = port.scrollY - rockSize; x = (port.scrollX - rockSize) + Math.floor( Math.random() * (port.portWidth + rockSize) ); } } var frameDelta = (Math.random() * 2) - 1; if (Math.abs(frameDelta) < 0.25) frameDelta *= 2; if (!args.group) { args.group = {}; switch (rockSize) { case 32: args.group.remain = 1; break; case 64: args.group.remain = 3; break; case 96: args.group.remain = 7; break; } } Effect.Port.getPlane('sprites').createSprite( 'Rock', { x: x, y: y, xd: xd, yd: yd, frameFloat: 0, frameDelta: frameDelta, rockClass: rockClass, size: rockSize, group: args.group, screenLoop: !!args.screenLoop }); }, /* spawn_ship_group: function(args) { var pt = new Point( port.scrollX + (port.portWidth / 2), port.scrollY + (port.portHeight / 2) ); var dist = Math.sqrt( Math.pow(port.portWidth / 2, 2) + Math.pow(port.portHeight / 2, 2) ); pt.project( args.originAngle, dist ).floor(); Effect.Port.getPlane('sprites').createSprite( 'EnemyShip', { cx: pt.x, cy: pt.y, group: args }); args.remain = args.count; args.count--; }, */ create_debris: function(args) { var particle_plane = Effect.Port.getPlane('particles'); for (var idx = 0; idx < args.amount; idx++) { var cx = args.cx; var cy = args.cy; if (args.scatter) { cx += ((Math.random() * args.scatter) - (args.scatter / 2)); cy += ((Math.random() * args.scatter) - (args.scatter / 2)); } particle_plane.createSprite( 'Debris', { cx: cx, cy: cy, angle: Math.random() * 360, distance: args.distance, debrisClass: args.debrisClass }); } // foreach particle }, create_particles: function(args) { var particle_plane = Effect.Port.getPlane('particles'); for (var idx = 0; idx < args.amount; idx++) { var cx = args.cx; var cy = args.cy; if (args.scatter) { cx += ((Math.random() * args.scatter) - (args.scatter / 2)); cy += ((Math.random() * args.scatter) - (args.scatter / 2)); } particle_plane.createSprite( 'Particle', { cx: cx, cy: cy, angle: Math.random() * 360, distance: args.distance, particleClass: args.particleClass }); } // foreach particle }, show_message: function(text) { // create HUD text sprite to "blink" message on screen text = text.toString(); var hplane = Effect.Port.getPlane('huds'); var msg = new TextSprite(); msg.setZIndex( 91 ); // above everything else msg.setFont( 'digitaldream' ); // msg.setCustomFont( '/fonts/digitaldream-19pt-custom.png', 16, 20 ); msg.setTableSize( text.length, 1 ); msg.setTracking( 1.0, 1.0 ); msg.setPosition( (Effect.Port.portWidth / 2) - ((text.length * 16) / 2), (Effect.Port.portHeight / 2) - 10 ); msg.frameCount = 0; msg.logic = function(clock) { this.show( this.frameCount % 30 < 20 ); if (this.frameCount % 30 == 0) Effect.Audio.playSound( 'message.mp3' ); this.frameCount++; if (this.frameCount >= 30 * 5) this.destroy(); }; hplane.attach(msg); msg.setString( 0, 0, text ); }, level_complete: function() { this.show_message("LEVEL COMPLETE!"); Effect.Audio.playSound( 'level_complete' ); Effect.Audio.getTrack('engine').stop(); Effect.Game.scheduleEvent( 45 * 2, function() { Effect.Port.getPlane('sprites').getSprite('player').start_flyout(); } ); Effect.Game.scheduleEvent( 45 * 6, function() { CrystalGalaxy.return_to_title(); } ); }, return_to_title: function() { // game over, return to title if (CrystalGalaxy.saveLevelMusic) { Effect.Game.getLevelProps().music = CrystalGalaxy.saveLevelMusic; delete CrystalGalaxy.saveLevelMusic; } Effect.Game.clearSchedule(); Effect.Audio.quiet(); Effect.Game.removeAllTweens(); Effect.Port.showCursor(); Effect.Port.removeAll(); Effect.Port.setBackgroundColor('black'); Effect.Game.loadLevel( 'TitleScreen', CrystalGalaxy.do_title_screen ); } }; // CrystalGalaxy namespace function RADIANS_TO_DECIMAL(_rad) { return _rad * 180.0 / Math.PI; } function DECIMAL_TO_RADIANS(_dec) { return _dec * Math.PI / 180.0; } function rand_array(arr, min, max) { // return random element from array if (!min) min = 0; if (!max) max = arr.length; return arr[ min + parseInt(Math.random() * (max - min), 10) ]; }
Crystal Galaxy 1.0b | EffectGames.com
/* Basic Framework */ html, body, div, p, form { margin: 0; padding: 0; border: 0; } .container { margin: 0 auto; width: 85%; min-width: 800px; max-width: 2048px; } body { font-family: "Lucida Grande", Helvetica, Arial, sans-serif; font-size: 12px; } .body { font-size: 12px; } .clear { clear: both; } .caption { font-family:arial,sans-serif; font-size:11px; cursor:default; color:#aaa; }
Pop out
Help
About
×
×