let moveShipOnTheScreenAction = SKAction.moveTo(y: self.size.height*0.2, duration: 0.5)
当我在iPad上对其进行测试时,以上一行很奇怪。它先到前面,然后又回到原来的位置。
let startPoint = CGPoint(x: player.position.x, y: self.size.height * 1.2)
但是当我在所有其他iPhone上进行测试时,我都没有这个问题。
在那里它从startpoint
到moveShipOnTheScreenAction
。
我已经尝试过不包括moveShipOnTheScreenAction
,而只是将startPoint
设置为moveShipOnTheScreenAction
总是结束的位置,这并不奇怪。
也许我的球员价值观不在正确的位置。
player.setScale(delta + 0.1)
player.position = CGPoint(x: self.size.width/2, y: 0 - player.size.height)
player.zPosition = 2
player.physicsBody = SKPhysicsBody(rectangleOf: player.size)
player.physicsBody!.affectedByGravity = false
player.physicsBody!.categoryBitMask = PhysicsCategories.Player
player.physicsBody!.collisionBitMask = PhysicsCategories.None
player.physicsBody!.contactTestBitMask = PhysicsCategories.Enemy
pointOfTouch = CGPoint(x: player.position.x, y: player.position.y)
self.addChild(player)
答案 0 :(得分:0)
我没有解决问题,但我通过更改默认位置来解决该问题,并在游戏开始之前也将玩家的alpha值设置为0,然后将位置更改回其原始位置,同时将玩家的alpha值设置为1。