Skip to content

Commit

Permalink
New minified version using Google Closure Compiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Kleffner committed Jul 28, 2011
1 parent f26b33a commit 10da86d
Show file tree
Hide file tree
Showing 19 changed files with 274 additions and 49 deletions.
28 changes: 14 additions & 14 deletions Enjine/animatedSprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Enjine.AnimationSequence = function(startRow, startColumn, endRow, endColumn) {
if ((this.StartRow == this.EndRow) && (this.StartColumn == this.EndColumn)) {
this.SingleFrame = true;
}
}
};

/**
Subclass that extends the regular sprite with animation capability.
Expand All @@ -34,7 +34,7 @@ Enjine.AnimatedSprite = function() {

//cheesy dictionary hack to make animation sequences more accessible
this.Sequences = new Object();
}
};

Enjine.AnimatedSprite.prototype = new Enjine.FrameSprite();

Expand Down Expand Up @@ -82,59 +82,59 @@ Enjine.AnimatedSprite.prototype.Update = function(delta) {
this.Playing = false;
}
}
}
};

Enjine.AnimatedSprite.prototype.PlaySequence = function(seqName, loop) {
this.Playing = true;
this.Looping = loop;
this.CurrentSequence = this.Sequences["seq_" + seqName];
this.FrameX = this.CurrentSequence.StartColumn * this.FrameWidth;
this.FrameY = this.CurrentSequence.StartRow * this.FrameHeight;
}
};

Enjine.AnimatedSprite.prototype.StopLooping = function() {
this.Looping = false;
}
};

Enjine.AnimatedSprite.prototype.StopPlaying = function() {
this.Playing = false;
}
};

Enjine.AnimatedSprite.prototype.SetFrameWidth = function(width) {
this.FrameWidth = width;
this.Rows = this.Image.width / this.FrameWidth;
}
};

Enjine.AnimatedSprite.prototype.SetFrameHeight = function(height) {
this.FrameHeight = height;
this.Columns = this.Image.height / this.FrameHeight;
}
};

Enjine.AnimatedSprite.prototype.SetColumnCount = function(columnCount) {
this.FrameWidth = this.Image.width / columnCount;
this.Columns = columnCount;
}
};

Enjine.AnimatedSprite.prototype.SetRowCount = function(rowCount) {
this.FrameHeight = this.Image.height / rowCount;
this.Rows = rowCount;
}
};

Enjine.AnimatedSprite.prototype.AddExistingSequence = function(name, sequence) {
this.Sequences["seq_" + name] = sequence;
}
};

Enjine.AnimatedSprite.prototype.AddNewSequence = function(name, startRow, startColumn, endRow, endColumn) {
this.Sequences["seq_" + name] = new Enjine.AnimationSequence(startRow, startColumn, endRow, endColumn);
}
};

Enjine.AnimatedSprite.prototype.DeleteSequence = function(name) {
if (this.Sequences["seq_" + name] != null) {
delete this.Sequences["seq_" + name];
}
}
};

Enjine.AnimatedSprite.prototype.ClearSequences = function() {
delete this.Sequences;
this.Sequences = new Object();
}
};
4 changes: 2 additions & 2 deletions Enjine/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Enjine.Application = function() {
this.canvas = null;
this.timer = null;
this.stateContext = null;
}
};

Enjine.Application.prototype = {
Update: function(delta) {
Expand All @@ -32,4 +32,4 @@ Enjine.Application.prototype = {

this.timer.Start();
}
}
};
2 changes: 1 addition & 1 deletion Enjine/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
Enjine.Camera = function() {
this.X = 0;
this.Y = 0;
}
};
4 changes: 2 additions & 2 deletions Enjine/collideable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Enjine.Collideable = function(obj, width, height, collisionEvent) {
} else {
this.CollisionEvent = function() {}
}
}
};

Enjine.Collideable.prototype = {
Update: function() {
Expand Down Expand Up @@ -46,4 +46,4 @@ Enjine.Collideable.prototype = {
this.CollisionEvent(other);
other.CollisionEvent(this);
}
}
};
4 changes: 2 additions & 2 deletions Enjine/drawable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

Enjine.Drawable = function() {
this.ZOrder = 0;
}
};

Enjine.Drawable.prototype = {
Draw: function(context) { }
}
};
4 changes: 2 additions & 2 deletions Enjine/drawableManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Enjine.DrawableManager = function() {
this.Unsorted = true;
this.Objects = [];
}
};

Enjine.DrawableManager.prototype = {
Add: function(object) {
Expand Down Expand Up @@ -84,4 +84,4 @@ Enjine.DrawableManager.prototype = {
}
}
}
}
};
4 changes: 2 additions & 2 deletions Enjine/frameSprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Enjine.FrameSprite = function() {
this.FrameY = 0;
this.FrameWidth = 0;
this.FrameHeight = 0;
}
};

Enjine.FrameSprite.prototype = new Enjine.Sprite();

Enjine.FrameSprite.prototype.Draw = function(context, camera) {
context.drawImage(this.Image, this.FrameX, this.FrameY, this.FrameWidth, this.FrameHeight, this.X - camera.X, this.Y - camera.Y, this.FrameWidth, this.FrameHeight);
}
};
4 changes: 2 additions & 2 deletions Enjine/gameCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Enjine.GameCanvas = function() {
this.Context2D = null;
this.BackBuffer = null;
this.BackBufferContext2D = null;
}
};

Enjine.GameCanvas.prototype = {
Initialize: function(canvasId, resWidth, resHeight) {
Expand All @@ -28,4 +28,4 @@ Enjine.GameCanvas.prototype = {
EndDraw: function() {
this.Context2D.drawImage(this.BackBuffer, 0, 0, this.BackBuffer.width, this.BackBuffer.height, 0, 0, this.Canvas.width, this.Canvas.height);
}
}
};
4 changes: 2 additions & 2 deletions Enjine/gameTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Enjine.GameTimer = function() {
this.LastTime = 0;
this.IntervalFunc = null;
this.UpdateObject = null;
}
};

Enjine.GameTimer.prototype = {
Start: function() {
Expand All @@ -30,4 +30,4 @@ Enjine.GameTimer.prototype = {
Stop: function() {
clearInterval(this.IntervalFunc);
}
}
};
2 changes: 1 addition & 1 deletion Enjine/keyboardInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Enjine.KeyboardInput = {
event.preventDefault();
}
}
}
};
2 changes: 1 addition & 1 deletion Enjine/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ Enjine.Resources = {
this.currentTime = -1;
this.play();
}
}
};
4 changes: 2 additions & 2 deletions Enjine/sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Enjine.Sprite = function() {
this.X = 0;
this.Y = 0;
this.Image = null;
}
};

Enjine.Sprite.prototype = new Enjine.Drawable();

Enjine.Sprite.prototype.Draw = function(context, camera) {
context.drawImage(this.Image, this.X - camera.X, this.Y - camera.Y);
}
};
6 changes: 3 additions & 3 deletions Enjine/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Enjine.GameStateContext = function(defaultState) {
this.State = defaultState;
this.State.Enter();
}
}
};

Enjine.GameStateContext.prototype = {
ChangeState: function(newState) {
Expand All @@ -29,7 +29,7 @@ Enjine.GameStateContext.prototype = {
Draw: function(delta) {
this.State.Draw(delta);
}
}
};

/**
* Base game state class to at least ensure that all the functions exist.
Expand All @@ -42,4 +42,4 @@ Enjine.GameState.prototype = {
Update: function(delta) {},
Draw: function(context) {},
CheckForChange: function(context) {}
}
};
18 changes: 9 additions & 9 deletions code/levelState.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Mario.LevelState.prototype.Enter = function() {
this.Level = levelGenerator.CreateLevel(this.LevelType, this.LevelDifficulty);

//play music here
if (this.LevelType === Mario.LevelType.Overground) {
Mario.PlayOvergroundMusic();
} else if (this.LevelType === Mario.LevelType.Underground) {
Mario.PlayUndergroundMusic();
} else if (this.LevelType === Mario.LevelType.Castle) {
Mario.PlayCastleMusic();
}
//if (this.LevelType === Mario.LevelType.Overground) {
//Mario.PlayOvergroundMusic();
//} else if (this.LevelType === Mario.LevelType.Underground) {
//Mario.PlayUndergroundMusic();
//} else if (this.LevelType === Mario.LevelType.Castle) {
//Mario.PlayCastleMusic();
//}

this.Paused = false;
this.Layer = new Mario.LevelRenderer(this.Level, 320, 240);
Expand Down Expand Up @@ -308,7 +308,7 @@ Mario.LevelState.prototype.Draw = function(context) {
}

if (Mario.MarioCharacter.WinTime > 0) {
Mario.StopMusic();
//Mario.StopMusic();
t = Mario.MarioCharacter.WinTime + this.Delta;
t = t * t * 0.2;

Expand All @@ -322,7 +322,7 @@ Mario.LevelState.prototype.Draw = function(context) {
}

if (Mario.MarioCharacter.DeathTime > 0) {
Mario.StopMusic();
//Mario.StopMusic();
t = Mario.MarioCharacter.DeathTime + this.Delta;
t = t * t * 0.1;

Expand Down
4 changes: 2 additions & 2 deletions code/mapState.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Mario.MapState.prototype.Enter = function() {
this.LevelDifficulty = 0;
this.LevelType = 0;

Mario.PlayMapMusic();
//Mario.PlayMapMusic();
};

Mario.MapState.prototype.Exit = function() {
Mario.StopMusic();
//Mario.StopMusic();

delete this.WaterSprite;
delete this.DecoSprite;
Expand Down
4 changes: 2 additions & 2 deletions code/titleState.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ Mario.TitleState.prototype.Enter = function() {
Mario.MarioCharacter = new Mario.Character();
Mario.MarioCharacter.Image = Enjine.Resources.Images["smallMario"];

Mario.PlayTitleMusic();
//Mario.PlayTitleMusic();
};

Mario.TitleState.prototype.Exit = function() {
Mario.StopMusic();
//Mario.StopMusic();

this.drawManager.Clear();
delete this.drawManager;
Expand Down
22 changes: 22 additions & 0 deletions enjine.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 10da86d

Please sign in to comment.