Skip to content

Commit

Permalink
refs #69 add getting mock images
Browse files Browse the repository at this point in the history
  • Loading branch information
miio committed Apr 4, 2012
1 parent 3f39e48 commit 79b9ca9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
Binary file added client/resources/images/get_false.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/resources/images/get_true.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions client/src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
55 changes: 53 additions & 2 deletions client/src/player.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
###
# 寿司生成メソッド
Expand Down Expand Up @@ -140,7 +148,7 @@ class ItemObject extends KawazSprite
@invincibleTimer.setComplete ->
@stop()
update : (e) ->
@x -= 8
@x -= 28

class PlateObject extends ItemObject
###
Expand All @@ -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 <[email protected]>
# 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 <[email protected]>
# 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 <[email protected]>
# Package : Osushi
# License : GNU Lesser General Public License v3 (http://www.gnu.org/licenses/)
###
constructor : (mediator) ->
super mediator, "get_false"

class SushiObject extends ItemObject
###
# 寿司オブジェクトクラス #
Expand Down

1 comment on commit 79b9ca9

@miio
Copy link
Owner Author

@miio miio commented on 79b9ca9 Apr 4, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そういえばまだ画像消えないな。。。

Please sign in to comment.