SpriteKit

RSS for tag

Drawing shapes, particles, text, images, and video in two dimensions using SpriteKit.

SpriteKit Documentation

Posts under SpriteKit subtopic

Post

Replies

Boosts

Views

Activity

how to randomly spawn enemies on screen
let randomNumber = arc4random_uniform(2) let x: CGFloat = randomNumber == 0 ? 1 : -1 enemy.position = CGPoint(x: (CGFloat(arc4random_uniform(UInt32(UIScreen.main.bounds.width))) * x), y: UIScreen.main.bounds.height) here is my code for enemy spawn, it works but some of my enemies are spawning outside of my screen. What can i change to make them all spawn inside the border
1
0
792
Sep ’21
How can I give an SkSpriteNode an initial push?
I have an SkSpriteNode (ball) in a box. Gravity is set to false, otherwise it has an SkPhysicsBody to bounce off of walls. Is there a method to give the ”ball” an initial push in a specified direction and velocity/strength wise?
Replies
1
Boosts
0
Views
463
Activity
Oct ’21
how to randomly spawn enemies on screen
let randomNumber = arc4random_uniform(2) let x: CGFloat = randomNumber == 0 ? 1 : -1 enemy.position = CGPoint(x: (CGFloat(arc4random_uniform(UInt32(UIScreen.main.bounds.width))) * x), y: UIScreen.main.bounds.height) here is my code for enemy spawn, it works but some of my enemies are spawning outside of my screen. What can i change to make them all spawn inside the border
Replies
1
Boosts
0
Views
792
Activity
Sep ’21