X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=inline;f=main.coffee;h=d571e1307c2b4441dd5aa93bb4864471f8f25aa1;hb=4e7ee7b8a6b471c5cfe54264a7c42700f8c9f699;hp=900295d3b9d4e6646d1e0014060947b7e47adf85;hpb=fff2ed1a0a156da47c7fa1e9760c8546b9af44fe;p=hexbog.git diff --git a/main.coffee b/main.coffee index 900295d..d571e13 100644 --- a/main.coffee +++ b/main.coffee @@ -225,7 +225,7 @@ init_board_layout = () -> unless is_top_tile and fw_other is -1 push i + columns[col_num].height + fw_other # will be dereferenced later - space.neighbors = neighbors.clone() # FIXME ?remove ``.clone()`` + space.neighbors = neighbors col_offset += column.height # convert all space.neighbors arrays from containing space ids to referencing the space for s in spaces @@ -332,9 +332,13 @@ unselect_tile = -> update_selection_display() _unselect_tile = -> - html_tile = selected.pop().dom - html_tile.removeClass 'selected_word' - html_tile.removeClass 'selected' + tile = selected.pop() + dom = tile.dom + if tile.connector? + tile.connector.remove() + delete tile.connector + dom.removeClass 'selected_word' + dom.removeClass 'selected' unselect_all = -> while selected.length @@ -544,7 +548,11 @@ blip_selection = -> force = effects.force.last() if force > 0 for tile in area.up - tile.new_hp = tile.hp + force + if tile.new_hp + # for overlap of board and [n]neigbors + tile.new_hp += force + else + tile.new_hp = tile.hp + force for s in spaces s.tile.new_hp ?= s.tile.hp - 1 if s.tile.new_hp < 0 @@ -599,10 +607,12 @@ score_for = (word) -> Math.round(Math.pow(1.7, word.length)) activate_selection = -> word = selected_word() if word.length < 3 + # should only happen when trying to blip a word with the keyboard # FIXME make this a hint log "Too short: \"#{word}\"" return unless is_word word + # should only happen when trying to blip a word with the keyboard # FIXME make this automatically part of the selection display log "Not on word list: \"#{word}\"" return @@ -625,9 +635,48 @@ show_definition = (word, type, definition, language) -> html += '