diff --git a/client/resources/images/get_false.png b/client/resources/images/get_false.png new file mode 100644 index 0000000..969b9a0 Binary files /dev/null and b/client/resources/images/get_false.png differ diff --git a/client/resources/images/get_true.png b/client/resources/images/get_true.png new file mode 100644 index 0000000..3c6ce18 Binary files /dev/null and b/client/resources/images/get_true.png differ diff --git a/client/src/main.coffee b/client/src/main.coffee index ba24ca1..80fc557 100644 --- a/client/src/main.coffee +++ b/client/src/main.coffee @@ -14,6 +14,8 @@ class Jubiol extends Game IMAGES : [ 'player.png', 'kawaz.png', + 'get_true.png', + 'get_false.png', 'main_background.png', 'plate_200.png', 'plate_300.png', diff --git a/client/src/player.coffee b/client/src/player.coffee index d9211ba..2de3b20 100644 --- a/client/src/player.coffee +++ b/client/src/player.coffee @@ -90,11 +90,19 @@ class ItemManager extends Group for item_elem in @item_obj for item in item_elem console.log t - if t.intersect(item) and user_area.intersect(item) + if t.intersect(item)# and user_area.intersect(item) console.log 'deleted' @deleteSushi item_elem @server.room_socket.emit 'get_sushi' , { sushi_order_id : item_elem[1].object_id} @sushi_list.add(item_elem[1].object_id) + ### + # TODO : サーバ側の判定がないのでモック代わりにランダムで判定させる + ### + result = Math.floor Math.random() * 2 + if result is 1 + @addChild new GetTrueImageObject @ + else + @addChild new GetFalseImageObject @ createSushi : (elem) -> ### # 寿司生成メソッド @@ -140,7 +148,7 @@ class ItemObject extends KawazSprite @invincibleTimer.setComplete -> @stop() update : (e) -> - @x -= 8 + @x -= 28 class PlateObject extends ItemObject ### @@ -152,6 +160,49 @@ class PlateObject extends ItemObject constructor: (price,x=0,y=0) -> super "plate_#{price}", x, y +class AbstractJudgeObject extends KawazSprite + ### + # 寿司取得時の判定時の画像の基底クラス + # Author : miio mitani + # Package ; Osushi + # Licence : GNU Lesser General Public License v3 (http://www.gnu.org/licenses/) + ### + constructor : (mediator, name) -> + ### + # TODO : 画面サイズから算出させたほうがいいと思うのです + ### + super 300,300, 200, 200 + @setImage "#{name}.png" + @timer = new Timer 3 + @mediator = mediator +#¥ @timer.play + @timer.setComplete -> + console.log 'timer_end_get_sushi' + @mediator.removeChild @ + @timer.play() + update : (e) -> + @timer.tick() + +class GetTrueImageObject extends AbstractJudgeObject + ### + # 寿司取得時に取得できたときの画像オブジェクトクラス + # Author : miio mitani + # Package : Osushi + # Licence : GNU Lesser General Public License v3 (http://www.gnu.org/licenses/) + ### + constructor : (mediator) -> + super mediator, "get_true" + +class GetFalseImageObject extends AbstractJudgeObject + ### + # 寿司取得時に取得できなかったときの画像オブジェクトクラス + # Author : miio mitani + # Package : Osushi + # License : GNU Lesser General Public License v3 (http://www.gnu.org/licenses/) + ### + constructor : (mediator) -> + super mediator, "get_false" + class SushiObject extends ItemObject ### # 寿司オブジェクトクラス #