Skip to content

Commit

Permalink
Added "Word too short!" message
Browse files Browse the repository at this point in the history
  • Loading branch information
caseywebdev committed May 6, 2012
1 parent 19b36d1 commit 6c5d7d3
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions client/app.coffee
Expand Up @@ -131,6 +131,9 @@
playedWord = ->
playMessage 'green', 'Played word!'

tooShort = ->
playMessage 'red', 'Word too short!'

playMessage = (color, text) ->
$('#play-message')
.removeClass()
Expand Down Expand Up @@ -195,16 +198,17 @@
lastChar = ''
else if e.keyCode is 13
word = battle.get('rack').word()
if word.length > 2
unless Rack.wordValue
notAWord()
else if battle.wordPlayed word
alreadyPlayed()
else
@emit play:
word: word
battle.get('rack').removeAll()
$("#played-tiles .tile").appendTo $ '#rack'
if word.length < 3
tooShort()
unless Rack.wordValue
notAWord()
else if battle.wordPlayed word
alreadyPlayed()
else
@emit play:
word: word
battle.get('rack').removeAll()
$("#played-tiles .tile").appendTo $ '#rack'
lastChar = ''
else
char = String.fromCharCode e.keyCode
Expand Down

0 comments on commit 6c5d7d3

Please sign in to comment.