Skip to content

Commit

Permalink
Adds selected image
Browse files Browse the repository at this point in the history
Adds an image to denote that the clone has been selected so that it's now less confusing when managing multiple clones
  • Loading branch information
hobnob committed Nov 28, 2012
1 parent 9db460a commit 5862743
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Binary file added img/selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions js/lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function player()
*/
var _currentIndex = 0;

var _selectedImg = gamejs.image.load('img/selected.png');

/**
* Handles player input.
*
Expand Down Expand Up @@ -170,6 +172,17 @@ function player()
*/
this.draw = function( mainSurface ){
_playables.draw( mainSurface );

var x = this.getCurrentPlayable().getX();
var y = this.getCurrentPlayable().getY();

x += (this.getCurrentPlayable().rect.width / 2);
x -= (_selectedImg.getSize()[0] / 2);

y -= (_selectedImg.getSize()[1] + 2);

var rect = new gamejs.Rect([x, y])
mainSurface.blit(_selectedImg, rect);
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gamejs.preload([
'img/splash-screen.png','img/new-game.png', 'img/bg.png','img/player.png',
'img/blank.png','img/switch.png','img/door.png','img/goal.png',
'img/platform-left.png','img/platform-right.png',
'img/platform-middle.png'
'img/platform-middle.png', 'img/selected.png'
]);

gamejs.ready(function() {
Expand Down

0 comments on commit 5862743

Please sign in to comment.