@roosterboy
@Chris_Parker
@fuerte.francis
Hey y’all. Apple has just announced the Swift Student Challenge 2021, and I wanted to enter but for some reason, my playground is giving me bugs. I am using version 3.4.1 Swift Playgrounds for Mac, and I also tried this on iPad. Both are giving me the same error. I am following a tutorial, and for her, there is no error. Please help me!
PS: I tagged everyone who helped me last time, so sorry if this is an inconvenience.
My main view:
import SpriteKit
import PlaygroundSupport
let skView = SKView(frame: .zero)
let GameScene = gameScene(size: UIScreen.main.bounds.size)
GameScene.scaleMode = .aspectFit
skView.presentScene(GameScene)
PlaygroundPage.current.liveView = skView
PlaygroundPage.current.wantsFullScreenLiveView = true
import SpriteKit
public class gameScene: SKScene, SKPhysicsContactDelegate {
var player: SKSpriteNode!
public override func didMove(to view: SKView) {
physicsBody = SKPhysicsBody(edgeLoopFrom: frame)
physicsBody?.friction = 0.0
physicsWorld.contactDelegate = self
let bg = SKSpriteNode(texture: SKTexture(image: #imageLiteral(resourceName: "Dangerous Duos தமிழ்.png")))
bg.setScale(2.0)
bg.zPosition = -10
bg.position = CGPoint(x: frame.midX, y: frame.midY)
addChild(bg)
player = SKSpriteNode(texture: SKTexture(image: #imageLiteral(resourceName: "chkbiriyani.png") ), color: .clear, size: CGSize(width: size.width = 0.05, height: size.height = 0.05))
//The error arises in the line "CGSize(width: size.width = 0.05, height: size.height = 0.05)"
player.position = CGPoint(x: frame.midX, y: frame.midY)
addChild(player)
}
}
Where is says #imageLiteral, that is just coming up when I copy and paste my code.