我正在创建这个简单的Pong游戏。底部和顶部有两个桨。一个球在弹跳。
运行时,桨叶形成了在田野中戳穿的有线尖刺。
代码:GameScene.swift
import SpriteKit
import GameplayKit
class GameScene: SKScene {
//create obj
var ball = SKSpriteNode()
var enemy = SKSpriteNode()
var main = SKSpriteNode()
override func didMove(to view: SKView) {
ball = self.childNode(withName: "ball") as! SKSpriteNode
enemy = self.childNode(withName: "enemy") as! SKSpriteNode
main = self.childNode(withName: "main") as! SKSpriteNode
ball.physicsBody?.applyImpulse(CGVector(dx:20, dy:20) )
let border = SKPhysicsBody(edgeLoopFrom: self.frame)
border.friction = 0
border.restitution = 1
self.physicsBody = border
}
override func update(_ currentTime: TimeInterval) {
// Called before each frame is rendered
}
}
想知道这是否是渲染问题。
有什么想法吗? Record of spikes