Skip to content

Commit 947bb44

Browse files
committed
naming tweaks
1 parent 26591c6 commit 947bb44

File tree

17 files changed

+68
-68
lines changed

17 files changed

+68
-68
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"created": "2013-03-12",
3-
"modified": "2013-05-31",
3+
"modified": "2013-06-25",
44
"color": "#3498d8",
55
"author": "Justin Windle",
6-
"name": "Vectoroids",
6+
"name": "Space Game!",
77
"hidden": false
88
}

coder-base/static/apps/vectoroids/js/index.js renamed to coder-base/static/apps/space_game_/js/index.js

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var MEDIA_PATH = staticurl + '/media/';
44
var snippeteditor;
55
var gamecontainer;
66
var firstColorError = true;
7-
var Vectoroids;
7+
var SpaceGame;
88

99
$(document).ready( function() {
1010

@@ -14,11 +14,11 @@ $(document).ready( function() {
1414
// Toggle game when editing
1515

1616
snippeteditor.on( 'focus', function() {
17-
if ( Vectoroids ) Vectoroids.stop();
17+
if ( SpaceGame ) SpaceGame.stop();
1818
});
1919

2020
snippeteditor.on( 'blur', function() {
21-
if ( Vectoroids ) Vectoroids.start();
21+
if ( SpaceGame ) SpaceGame.start();
2222
});
2323

2424
$("#closepanel").click( function(){
@@ -40,10 +40,10 @@ $(document).ready( function() {
4040

4141
// Initialize game
4242
GameCode.container = gamecontainer.get(0);
43-
Vectoroids = Game2D.create( GameCode );
43+
SpaceGame = Game2D.create( GameCode );
4444

4545
configureEditor({
46-
target: 'Vectoroids',
46+
target: 'SpaceGame',
4747
comment: 'Try changing the variables below and see how they affect the game',
4848
props: [
4949
'projectileColor',
@@ -55,13 +55,13 @@ $(document).ready( function() {
5555
'fillShapes'
5656
]
5757
},{
58-
target: 'Vectoroids.ship',
58+
target: 'SpaceGame.ship',
5959
comment: 'The 3 letter name for your ship and high scores',
6060
props: [
6161
'name'
6262
]
6363
},{
64-
target: 'Vectoroids.ship',
64+
target: 'SpaceGame.ship',
6565
comment: 'Ship properties',
6666
props: [
6767
'speed',
@@ -85,7 +85,7 @@ var closeTools = function() {
8585

8686
// Ensure the game knows about dimension changes
8787
setTimeout( function() {
88-
Vectoroids.__resize();
88+
SpaceGame.__resize();
8989
}, 500 );
9090
};
9191

@@ -96,7 +96,7 @@ var openTools = function() {
9696

9797
// Ensure the game knows about dimension changes
9898
setTimeout( function() {
99-
Vectoroids.__resize();
99+
SpaceGame.__resize();
100100
}, 500 );
101101
};
102102

@@ -152,16 +152,16 @@ var configureEditor = function() {
152152
};
153153

154154
/*
155-
Coder.loadData( 'vectoroids:data', function( result ) {
155+
Coder.loadData( 'spacegame:data', function( result ) {
156156
157157
if ( result && result.data ) {
158158
159159
console.log( 'LOAD DATA', result );
160160
161-
Vectoroids.data = JSON.parse( result.data );
161+
SpaceGame.data = JSON.parse( result.data );
162162
163-
if ( Vectoroids.data.code && Vectoroids.data.code !== snippeteditor.getValue() ) {
164-
snippeteditor.setValue( Vectoroids.data.code );
163+
if ( SpaceGame.data.code && SpaceGame.data.code !== snippeteditor.getValue() ) {
164+
snippeteditor.setValue( SpaceGame.data.code );
165165
snippeteditor.gotoLine(1);
166166
}
167167
}
@@ -172,12 +172,12 @@ var configureEditor = function() {
172172

173173
var saveCode = function() {
174174

175-
Vectoroids.data.code = snippeteditor.getValue();
176-
var data = JSON.stringify( Vectoroids.data );
175+
SpaceGame.data.code = snippeteditor.getValue();
176+
var data = JSON.stringify( SpaceGame.data );
177177

178178
/*
179-
Coder.saveData( 'vectoroids:data', data, function() {
180-
console.log( 'SAVE DATA', 'vectoroids:data', +new Date, data );
179+
Coder.saveData( 'spacegame:data', data, function() {
180+
console.log( 'SAVE DATA', 'spacegame:data', +new Date, data );
181181
});
182182
*/
183183
};
@@ -187,8 +187,8 @@ var configureEditor = function() {
187187
try {
188188

189189
eval( snippeteditor.getValue() );
190-
Vectoroids.clear();
191-
Vectoroids.draw();
190+
SpaceGame.clear();
191+
SpaceGame.draw();
192192

193193
clearTimeout( saveTimeout );
194194
saveTimeout = setTimeout( saveCode, 1500 );
@@ -257,7 +257,7 @@ var Entity = Polygon.extend({
257257
}
258258
});
259259

260-
var Vectoroid = Entity.extend({
260+
var Asteroid = Entity.extend({
261261

262262
init: function( generation ) {
263263

@@ -292,8 +292,8 @@ var Vectoroid = Entity.extend({
292292

293293
split: function() {
294294

295-
var child1 = new Vectoroid( this.generation + 1 );
296-
var child2 = new Vectoroid( this.generation + 1 );
295+
var child1 = new Asteroid( this.generation + 1 );
296+
var child2 = new Asteroid( this.generation + 1 );
297297

298298
child1.translate( this.center );
299299
child2.translate( this.center );
@@ -501,9 +501,9 @@ var STATES = {
501501
};
502502

503503
var SOUNDS = {
504-
DESTROY_VECTOROID: new Sound( MEDIA_PATH + 'die_vectoroid.mp3' ),
504+
DESTROY_VECTOROID: new Sound( MEDIA_PATH + 'die_asteroid.mp3' ),
505505
DESTROY_SHIP: new Sound( MEDIA_PATH + 'die_ship.mp3' ),
506-
SHOOT: new Sound( MEDIA_PATH + 'vectoroids_shoot.mp3' ),
506+
SHOOT: new Sound( MEDIA_PATH + 'asteroids_shoot.mp3' ),
507507
THRUST: new Loop( MEDIA_PATH + 'thrust.mp3' ),
508508

509509
stop: function() {
@@ -536,11 +536,11 @@ var GameCode = {
536536
fillShapes: true,
537537
lineThickness: 2,
538538

539-
minVectoroids: 10,
539+
minAsteroids: 10,
540540
projectileSpeed: 400,
541541
maxProjectiles: 10,
542542
projectiles: [],
543-
vectoroids: [],
543+
asteroids: [],
544544
canFire: true,
545545
state: '',
546546
score: 0,
@@ -560,7 +560,7 @@ var GameCode = {
560560

561561
this.lives = 3;
562562
this.score = 0;
563-
this.vectoroids = [];
563+
this.asteroids = [];
564564
this.projectiles = [];
565565

566566
this.resetShip();
@@ -592,7 +592,7 @@ var GameCode = {
592592

593593
case STATES.INTRO:
594594

595-
$( '.title' ).text( 'Vectoroids' );
595+
$( '.title' ).text( 'Space Game!' );
596596
$( '.start' ).text( 'Start Game' );
597597
this.getScores();
598598

@@ -636,7 +636,7 @@ var GameCode = {
636636
me.showScores();
637637

638638
/*
639-
Coder.loadData( 'vectoroids:data', function( result ) {
639+
Coder.loadData( 'spacegame:data', function( result ) {
640640
641641
if ( typeof result.data !== 'undefined' && result.data != null && result.data != "" ) {
642642
me.data = JSON.parse(result.data);
@@ -662,8 +662,8 @@ var GameCode = {
662662

663663
var data = JSON.stringify( this.data );
664664
/*
665-
Coder.saveData( 'vectoroids:data', data, function() {
666-
console.log( 'saved data', 'vectoroids:data', +new Date, data );
665+
Coder.saveData( 'spacegame:data', data, function() {
666+
console.log( 'saved data', 'spacegame:data', +new Date, data );
667667
});
668668
*/
669669
},
@@ -699,52 +699,52 @@ var GameCode = {
699699
}, 1500);
700700
},
701701

702-
createVectoroid: function() {
702+
createAsteroid: function() {
703703

704-
var vectoroid = new Vectoroid();
704+
var asteroid = new Asteroid();
705705

706706
var x = random( this.width * 0.25 );
707707
var y = random( this.height * 0.25 );
708708

709709
if ( chance() ) x = this.width - x;
710710
if ( chance() ) y = this.height - y;
711711

712-
vectoroid.translate( new Vector( x, y ) );
713-
this.vectoroids.push( vectoroid );
712+
asteroid.translate( new Vector( x, y ) );
713+
this.asteroids.push( asteroid );
714714
},
715715

716-
destroyVectoroid: function( vectoroid ) {
716+
destroyAsteroid: function( asteroid ) {
717717

718718
SOUNDS.DESTROY_VECTOROID.play();
719719

720-
var index = this.vectoroids.indexOf( vectoroid );
720+
var index = this.asteroids.indexOf( asteroid );
721721

722722
if ( index > -1 ) {
723723

724-
this.vectoroids.splice( index, 1 );
724+
this.asteroids.splice( index, 1 );
725725

726-
if ( vectoroid.generation < 3 ) {
727-
this.vectoroids = this.vectoroids.concat( vectoroid.split() );
726+
if ( asteroid.generation < 3 ) {
727+
this.asteroids = this.asteroids.concat( asteroid.split() );
728728
}
729729
}
730730
},
731731

732732
update: function() {
733733

734734
var dtSeconds = this.dt / 1000;
735-
var i, j, n, m, vectoroid, projectile;
735+
var i, j, n, m, asteroid, projectile;
736736

737-
// Update vectoroids
737+
// Update asteroids
738738

739-
while ( this.vectoroids.length < this.minVectoroids ) {
740-
this.createVectoroid();
739+
while ( this.asteroids.length < this.minAsteroids ) {
740+
this.createAsteroid();
741741
}
742742

743-
for ( i = 0, n = this.vectoroids.length; i < n; i++ ) {
743+
for ( i = 0, n = this.asteroids.length; i < n; i++ ) {
744744

745-
vectoroid = this.vectoroids[i];
746-
vectoroid.wrap( 0, 0, this.width, this.height );
747-
vectoroid.update( dtSeconds );
745+
asteroid = this.asteroids[i];
746+
asteroid.wrap( 0, 0, this.width, this.height );
747+
asteroid.update( dtSeconds );
748748
}
749749

750750
// Update projectiles
@@ -815,50 +815,50 @@ var GameCode = {
815815
draw: function() {
816816

817817
var shipColor = this.shipColor;
818-
var i, j, n, m, color, vectoroid, projectile, child1, child2;
818+
var i, j, n, m, color, asteroid, projectile, child1, child2;
819819

820820
this.container.style.backgroundColor = this.backgroundColor;
821821
this.container.style.color = this.textColor;
822822

823-
// Draw vectoroids
823+
// Draw asteroids
824824

825825
this.graphics.lineWidth = min( 10, max( 0, abs( this.lineThickness ) ) );
826826
this.graphics.globalCompositeOperation = 'lighter';
827827

828-
for ( i = 0, n = this.vectoroids.length; i < n; i++ ) {
828+
for ( i = 0, n = this.asteroids.length; i < n; i++ ) {
829829

830-
vectoroid = this.vectoroids[i];
830+
asteroid = this.asteroids[i];
831831

832-
color = this.enemyColors[ vectoroid.seed * this.enemyColors.length | 0 ];
832+
color = this.enemyColors[ asteroid.seed * this.enemyColors.length | 0 ];
833833

834834
this.graphics.strokeStyle = color;
835835
this.graphics.fillStyle = color;
836836

837-
// Check for vectoroid-projectile collision
837+
// Check for asteroid-projectile collision
838838

839839
for ( j = 0, m = this.projectiles.length; j < m; j++ ) {
840840

841841
projectile = this.projectiles[j];
842842

843-
// If projectile is hitting vectoroid
843+
// If projectile is hitting asteroid
844844

845-
if ( vectoroid.contains( projectile.vertices[0] ) ) {
845+
if ( asteroid.contains( projectile.vertices[0] ) ) {
846846

847847
this.score += 20;
848848

849849
this.projectiles.splice( j, 1 );
850-
this.destroyVectoroid( vectoroid );
850+
this.destroyAsteroid( asteroid );
851851

852-
n = this.vectoroids.length;
852+
n = this.asteroids.length;
853853
m = this.projectiles.length;
854854

855855
break;
856856
}
857857
}
858858

859-
// Check for vectoroid-ship collision
859+
// Check for asteroid-ship collision
860860

861-
if ( !this.ship.invincible && this.ship.intersects( vectoroid ) ) {
861+
if ( !this.ship.invincible && this.ship.intersects( asteroid ) ) {
862862

863863
if ( this.lives <= 1 ) {
864864

@@ -868,15 +868,15 @@ var GameCode = {
868868

869869
SOUNDS.DESTROY_SHIP.play();
870870

871-
this.destroyVectoroid( vectoroid );
872-
n = this.vectoroids.length;
871+
this.destroyAsteroid( asteroid );
872+
n = this.asteroids.length;
873873

874874
this.resetShip();
875875
this.lives--;
876876
}
877877
}
878878

879-
vectoroid.draw( this.graphics );
879+
asteroid.draw( this.graphics );
880880

881881
if ( this.fillShapes ) {
882882
this.graphics.globalAlpha = 0.5;
@@ -890,7 +890,7 @@ var GameCode = {
890890

891891
if ( this.drawBounds ) {
892892

893-
vectoroid.drawBounds( this.graphics );
893+
asteroid.drawBounds( this.graphics );
894894
this.graphics.globalAlpha = 0.5;
895895
this.graphics.stroke();
896896
}

coder-base/views/apps/vectoroids/index.html renamed to coder-base/views/apps/space_game_/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Vectoroids</title>
4+
<title>Space Game!</title>
55
<meta charset="utf-8">
66
<!-- Standard Coder Includes -->
77
<script>
@@ -46,7 +46,7 @@
4646

4747
<!-- splash screen -->
4848
<div id="splash" class="overlay">
49-
<h2 class="title">Vectoroids</h2>
49+
<h2 class="title">Space Game!</h2>
5050
<a href="#" id="start" class="start">Start Game</a>
5151
<div class="scores">
5252
<h3>High Scores</h3>

0 commit comments

Comments
 (0)