gpt4 book ai didi

ios - 改变火的方向

转载 作者:行者123 更新时间:2023-11-29 12:58:49 24 4
gpt4 key购买 nike

<分区>

我做了一个游戏,现在我不知道如何在你点击的地方而不是直接向前射击。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
/* Called when a touch begins */
//1
SKSpriteNode *shipLaser = [_shipLasers objectAtIndex:_nextShipLaser];
_nextShipLaser++;
if (_nextShipLaser >= _shipLasers.count) {
_nextShipLaser = 0;
}

//2
shipLaser.position = CGPointMake(_ship.position.x+shipLaser.size.width/2,_ship.position.y+0);
shipLaser.hidden = NO;
[shipLaser removeAllActions];

//3
CGPoint location = CGPointMake(self.frame.size.width, _ship.position.y);
SKAction *laserMoveAction = [SKAction moveTo:location duration:0.5];
//4
SKAction *laserDoneAction = [SKAction runBlock:(dispatch_block_t)^() {
//NSLog(@"Animation Completed");
shipLaser.hidden = YES;
}];

//5
SKAction *moveLaserActionWithDone = [SKAction sequence:@[laserMoveAction,laserDoneAction]];
//6
[shipLaser runAction:moveLaserActionWithDone withKey:@"laserFired"];

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com