0

これは私の最初の質問です。愚かすぎないことを願っています。検索しましたが、答えが見つかりませんでした。あなたが私を助けてくれることを願っています!

私は自分のシーンに SKSpriteNode を作成して追加します。その後、TouchesBegan メソッドで現在の位置を知り、現在の位置に応じて条件を使用できるようにしたいと考えています。

-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {

    SKSpriteNode *miChar = [self createCharacter];

    [self addChild: miChar];

}

これが私のシーンに追加する簡単な方法です。たとえば、TouchesBegan のときに miChar.position.y を知りたいです。

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

     //Here is where i need the position of miChar.position.y

     SKSpriteNode *currentPos=miChar.position.y;

     while(currentPos.position.y > miChar.position.y){

       /* i want to do things here until the position is above for example
       miChar is an SKSpriteNode that is on constant movement so i need to check its 
       position wich will be constantly changing*/                             
     }

まあ、これはそれです、とても単純であるか、この方法では不可能かもしれません..申し訳ありませんが、コーディングを始めたばかりです。お時間をありがとうございました!

4

1 に答える 1