OBY29
ステップを分離
Obyクラスのステップを各パーツのクラスに分担させる為分離しまする。
ObyEyesとObyLipsに各ステップメソッドをつくっちゃうっす。
じゃあObyクラスのステップにはなにをさせるかって〜と
オビー自体にいろいろとアニメーションしてもらおうってわけね。
(ま〜た修正ってことじゃんか!)
■メソッドを追加します。
● ObyLipsクラスstepメソッド
口のランダムアニメーションの部分をもってくるだけでする。
「self lips」を「self」にするのは忘れちゃダメっすね。
--------------------------------------------
step
super step.
10 atRandom = 1
ifTrue: [[self perform: #(daha heh aha uhyo nee ehe goh) atRandom.
(Delay forMilliseconds: 2000 atRandom) wait.
self perform: #(nomal nomal gee hohe) atRandom] fork].
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
● ObyLipsクラスstepTimeメソッド
--------------------------------------------
stepTime
^ 1000
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
● ObyEyesクラスstepメソッド
目のアニメの部分を持ってくるだけっす。
--------------------------------------------
step
| amount |
super step.
5 atRandom = 1
ifTrue: [[self closeEye.
(Delay forMilliseconds: 180) wait.
self openEye.
2 atRandom = 1 ifTrue: [self lookAtFront]] fork.
^ self].
20 atRandom = 1
ifTrue: [amount _ (0.2 to: 1.0 by: 0.01) atRandom.
amount _ self leftEye eyeExtent x amount.
self leftEye openness: amount.
self rightEye openness: amount].
3 atRandom = 1 ifTrue: [self lookAtHand. ^ self].
3 atRandom = 1 ifTrue: [self lookAtFront. ^ self].
3 atRandom = 1 ifTrue: [self lookAtMorph: self world submorphs atRandom]
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
● ObyクラスstepTimeメソッド
--------------------------------------------
stepTime
^ 1000
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
ステップを分離するのにともないましてlookAtHandメソッドも修正しなくちゃです。
ObyクラスにあったやつをObyEyesクラスに作ってObyクラスからはそれを呼び出すってかんじに修正します。
● ObyEyesクラスlookAtHandメソッド
--------------------------------------------
lookAtHand
| hand |
self isInWorld ifFalse: [^ self].
hand _ (self world activeHand) ifNil: [self world primaryHand].
self lookAtMorph: hand
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
● ObyクラスlookAtHandメソッド
--------------------------------------------
lookAtHand
self eyes lookAtHand
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
● Obyクラスstepメソッド
で、Obyクラスのstepメソッドはどうするかって〜と、まあ後で使うんで
こんなかんじにでもしておくです。
--------------------------------------------
step
super step.
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
▲PREV ------ ● TOP ● ------ NEXT▼
■ MEMO ■
Links to this Page
- I BOBY last edited on 28 April 2004 at 8:57:55 pm by tk0005-202x210x196x109.ap-TK.usen.ad.jp
- OBY28 last edited on 18 June 2007 at 5:12:55 am by localhost.localdomain
- OBY30 last edited on 18 June 2007 at 5:28:38 am by localhost.localdomain