-1

AS3 はまったく初めてで、まだロープを学んでいるので、ご容赦ください。ActionScript 3.0 を使用して、5 匹のバッタがステージ上をランダムな位置で飛び回るゲームを作成しようとしています。TweenLite および TweenMax トゥイーン エンジンを使用してみましたが、役に立ちませんでした。完全に間違っている可能性がありますが、現時点ではどこに行くべきかわかりません。どんな助けでも大歓迎です。

編集: TweenMax CirclePath2D を配置して、バッタの個々のインスタンスに影響を与えようとしています。該当するコードを [アクション] パネル自体に挿入しようとしましたが、次のエラーが返されました: 1020: オーバーライドとマークされたメソッドは、別のメソッドをオーバーライドする必要があります。およびエラー 1024: オーバーライド用にマークされていない関数をオーバーライドしています。

以下は私が使用しようとしているコードです:

import com.greensock.TweenMax;
import com.greensock.easing.*;


TweenMax.to(GrassHopper, 0.25, {bezierThrough:[{x:253, y:139}, {x:272, y:335}], ease:Back.easeIn});

さらに、今のところ上記の場所のみを使用しています。バッタがジャンプする場所をランダム化する方法はありますか? さらに、どこでも継続的に飛び回らせる方法はありますか?

前もって感謝します。

4

1 に答える 1

0

Well first off, you need to refer to specific objects rather than the overall class, so where you wrote 'Grasshopper' you want a reference to grassHopper1. Then loop through all your grasshoppers to set tweens on them.

For randomizing the locations, use Math.random(). So instead of writing x:253 write something like x:Math.random()*253

For continuously hopping around, TweenMax gives an onComplete parameter you can use to call a function when the tween completes. So put onComplete:setHops in the tween and do all the tweening in the setHops() function (ie. have the function call itself)

于 2012-12-14T20:39:00.057 に答える