GameStructureObject

public class GameStructureObject : GameTileSpriteNode

A structured sprite node with a child for a physics body.

This class is used to create objects with physics bodies that need to be pinned so that they don’t move.

Note

Currently, static sprites suffer from a drifting issue. Details on this issue can be found on the Apple Developer Forums.
  • Whether the structure object is locked.

    Declaration

    Swift

    var locked: Bool
  • Initialize the game structure object.

    Declaration

    Swift

    public init(with texture: SKTexture?, size: CGSize)

    Parameters

    texture

    The texture for this sprite.

    size

    The size for this sprite.

  • Required initializer for this class. Will result in a fatal error if you initialize the object this way.

    Declaration

    Swift

    required init?(coder aDecoder: NSCoder)
  • Instantiate the physics body for this sprite.

    Declaration

    Swift

    public func instantiateBody(with physicsBody: SKPhysicsBody?)

    Parameters

    physicsBody

    The physics body to assign to the sprite.

  • Release the physics body from the sprite if the sprite is not locked.

    Declaration

    Swift

    public func releaseBody()
  • Get the physics body for this sprite.

    Declaration

    Swift

    public func getBody() -> SKPhysicsBody?