top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to use CGPointMake in Swift

0 votes
686 views

I am trying to assign a position to a Sprite Kit node but from my code error throughs as Use of unresolved identifier 'CGPointMake'

class PlayerGun: Spaceship {

    func launchRocket() {

        var rocket = Missile.playerMissile()

        // This line gives above mentioned error.    
        rocket.position = CGPointMake(0.0, 0.0) 
    }
}
posted Jul 16, 2014 by Manjunath

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You should use as

CGPoint(x: 10, y: 20)

class PlayerGun: Spaceship {

    func launchRocket() {

        var rocket = Missile.playerMissile()

        // This line gives above mentioned error.    
        rocket.position = CGPoint(x: 10, y: 20) 
    }
} 
answer Jul 17, 2014 by Raju
Similar Questions
+1 vote

How to use default values for parameter in function. What will happens when value is not passed for a default parameters.

0 votes

I want to know how to make cross bridging to use SWIFT in Objective C class

+2 votes

I am facing situation to use objective c class in SWIFT. So, i am looking for any instruction to achieve this

0 votes

How to declare , set message and show alert in SWIFT.

+1 vote

How to use below code in swift.

[actionBtn addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside];
...