这是我的第一个问题,我希望它不是太愚蠢,我已经搜索但找不到答案,希望你能帮助我!
我创建一个 SKSpriteNode 并将其添加到我的场景中,然后我希望能够在 TouchesBegan 方法中知道其当前位置,然后根据其当前位置使用条件。
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
SKSpriteNode *miChar = [self createCharacter];
[self addChild: miChar];
}
这只是将它添加到我的场景的简单方法,然后我想知道 miChar.position.y 例如当 TouchesBegan
-(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*/
}
好吧,就是这样,可能很简单,或者只是不可能这样做.. 抱歉刚开始编码。谢谢你们的时间!