OBY31
お次は回転オビーね
オビーが一回転するアクションを追加するです。
後はなんかアクション思いついたら同様に追加していけばいいかにゃ・・・。
■メソッドを追加します。
● Obyクラスrotatingメソッド
10度づつ回転してゆき一回転したら止まるって感じにしますた。
--------------------------------------------
rotating
self heading: self heading + 10.
self heading >= 360 ifTrue: [
self actionFlag: 0.
self heading: 0].
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
■メソッドを修正。
● Obyクラスstepメソッド
「actionFlag」が2の場合「rotating」メソッドを実行させまする。
--------------------------------------------
step
super step.
actionFlag = 1 ifTrue: [
self bouncing].
actionFlag = 2 ifTrue: [
self rotating].
--------------------------------------------
アクセプト。
Alt + s ( Cmd + s )
★インスタンスを出してみる
--------------------------------------------
boby _ Oby new openInWorld.
boby actionFlag _ 2.
--------------------------------------------
Alt + d ( Cmd + d )
▲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
- OBY30 last edited on 18 June 2007 at 5:28:38 am by localhost.localdomain
- OBY32 last edited on 18 June 2007 at 5:18:18 am by localhost.localdomain