Swift is a multi-paradigm, compiled programming language.
1
vote
0answers
23 views
Fatal error: unexpectedly found nil while unwrapping an Optional value [on hold]
I am trying to run this code but I keep on getting this error:
fatal error: unexpectedly found nil while unwrapping an Optional value
I don't understand why I'm getting it. Any hint?
import ...
0
votes
0answers
30 views
Handling with Speech Bubbles in SpriteKit
what is a good way to make Speech bubbles in our game like in Zelda, Pokemon, ...?
SKLabelNodes have no line break and need to fit perfectly in the Bubble.
Also if the text is long we need a scroll ...
1
vote
1answer
93 views
Tile based movement with SKAction (Xcode 8, Tile Map)
I am trying to make a game where the Hero can move like in Pokemon with SKActions.
But the movement looks unprofessional and have delays.
How can we handle to move the Hero smoothly with SKActions ...
0
votes
0answers
18 views
How to use Apple present scene method for SK/SCN Scenes
Hey i keep getting an error:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-55.2.6.1/Framework/MTLTexture.m:643: failed assertion `MTLTextureDescriptor has one or more dimensions set ...
0
votes
1answer
51 views
SpriteKit and Swift or Objective-C
As a newbie to iOS programming, I'm wondering which of these would be more conducive to the type of game I want to program. I've been tasked to program an iOS game for my company. They asked me to do ...
0
votes
0answers
26 views
How to play a sequence of tracks in SpriteKit?
Say I have two arrays that contain names of sound files to play. I want to start playing from the first array sequentially, and then as the last track is playing, allow user input that should play ...
0
votes
1answer
201 views
How can I create a “wireframe” texture for a sphere in SceneKit?
I've been struggling to figure this out. I would like to have a sphere in SceneKit that looks like this:
I think the easiest way would be to create a mostly transparent texture with the wireframe ...
4
votes
1answer
208 views
How do I pixelate a scene with SceneKit and Metal, in Swift?
I managed to get pixelation working by using the OpenGLES2 rendering API, and a CIFilter. But it was way too slow, so I want to use the Metal API and just have a very simple filter that pixelates ...
0
votes
0answers
12 views
Should the Sprites in my Boids implementation be backed by model objects?
This question is about the proper way to architect an implementation of Craig Reynolds Boids algorithm.
I have an Agent object like this:
struct Agent: Equatable
{
let identifier = ...
0
votes
0answers
42 views
How can I make a realistic soccer ball that gets impulsed by finger touch in Swift?
So I got this ball
ball = SKSpriteNode(imageNamed: "ball")
ball.name = ballCategoryName
ball.userInteractionEnabled = false
ball.size = CGSizeMake(120, 120)
ball.zPosition = 2
...
0
votes
0answers
45 views
Dynamically add Components to an Entity
In my game, I have an entity which is an empty robot, and some components which are parts for building that robot(arm, head, weapon, tool, etc) and each part consists of different types. What I want ...
0
votes
0answers
22 views
Issue moving only one child node
I am trying to make a game that has a ball which is a SKShapeNode that shoots projectiles (SKSpriteNode). The issue that I am having is that when I try to get the players to move, it moves all of the ...
0
votes
0answers
87 views
Draw straight line for aiming
If you played Angry Birds or any Pool game before you would be familiar with what I'm trying to do, basically what I want is:
1- Draw a line in touchesMoved so that the player can know in which ...
0
votes
1answer
138 views
CPU and RAM usage in OpenGL too high in Swift
My game is set up so the the display controls the game loop, usual in Cocoa. The callback function calls run() which is this. The thing is, the thread running the callback is using 63% CPU and the RAM ...
0
votes
1answer
112 views
Collision Between SKSpriteNode and SKShapeNode
Im trying to create a collision between to objects. one is a SKSpriteNode and the other is a SKShapenode. the Code I have so far for Contact is :
func didBeginContact( contact: SKPhysicsContact) {
...
1
vote
0answers
90 views
Failed to pass uniform in Metal shader modifier
I'm trying to write a simple shader able to pass the color to be used for drawing in the fragment shader, through a uniform. I load the shader modifier and pass the uniform:
let fragmentShaderPath =...
2
votes
0answers
112 views
How to add a bump map in scene kit?
I'm trying to draw an Earth, as I've found the textures in this site: http://planetpixelemporium.com/earth.html
I loaded the diffuse, specular and bump maps:
let earthGeometry = SCNSphere(radius: ...
0
votes
1answer
248 views
Is it possible to use Metal and SceneKit at the same time?
All the tutorials that I've found online speak about using Metal alone, without any other supporting library. But I don't understand if it's possible to create a SceneKit game and then use a Metal ...
0
votes
0answers
10 views
Cocos2d changing game play dynamically like Hellrider
I am creating a game somewhat related to Hellrider. I also want to change game play similar to this game.
Like, at starting player goes in Upside, after sometimes, Left-to-right, Right-to-left, ...
0
votes
1answer
39 views
How can I increase the hit range of a node?
How can I set the radius or the hit range of a node initialized with a texture? Of course I can do that with increasing the size of it, but actually I want to do this without resizing the picture ...
1
vote
0answers
68 views
How do I simulate vehicle movement in a non-gravity environment (e.g., space)?
As a series of small experiments, I've began to tinker with game development, specifically using SpriteKit and Swift. I'm looking to simulate a body moving through a non-gravity environment, ...
0
votes
0answers
38 views
Shininess property not working as expected
I'm trying out the SCNMaterial class by creating a pyramid with a diffuse and specular material:
let pyramid = SCNPyramid(width: 10.0, height: 20.0, length: 10.0)
let pyramidNode = SCNNode(geometry:...
0
votes
1answer
266 views
Why is SCNNode.rotation property a four dimensional vector?
I don't understand why SCNNode's rotation property is a SCNVector4 instead of a SCNVector3. The documentation states that:
The four-component rotation vector specifies the direction of the rotation ...
-1
votes
1answer
80 views
SceneKit – White layer covering my tube
I have a simple tube node in my scene that isn't displaying properly.
When I rotate it to face the camera, more than half of it is covered by some invisible sheet. When I rotate the tube enough, it ...
3
votes
1answer
148 views
Pathfinding: longest route along tiles of same type
I'm programming a simple tile-based puzzle game, and I've gotten stuck trying to work out a pathfinding algorithm.
Here's how the game is set out:
The game board is (arbitrarily) 8 tiles wide by 8 ...
-1
votes
1answer
102 views
Fix buttons on screen
I've added buttons and SKCameraNode for my player. I got problem. When player moving left/right/jump all buttons dont follow for him.
UPDATE
class GameScene: SKScene, SKPhysicsContactDelegate {
...
0
votes
1answer
84 views
How to reregister gamecontroller changedvalue handler upon game scene reload
I'm working on a tvOS game that uses the siri gamepad controller. Everything works fine the first time out. If the user loses the round I reload the same scene using presentScene. After reloading the ...
0
votes
1answer
59 views
Resources for making iPhone apps in C++? [closed]
I would like to start making games for the iPhone and I only know C++. I have picked up a book on Swift development, and through my research I have found it is possible to create iPhone games through ...
-2
votes
1answer
216 views
Is it possible to use Box2D or Chipmunk in Swift & Cocos2d?
I am new to iOs programming.
I wonder whether it is possible to use Box2D physic engine in Cocos2D with Swift. I am asking because I started to learn Swift. And I create Xcode project from ...
0
votes
0answers
7 views
scaling ccsprite and ccphysicsbody
The player which is scaled down (after few seconds as game progresses) but its associate body is not being scaled down.
I have create a Player object with SpriteBuilder with following details:\
...
2
votes
1answer
106 views
Get Stencil buffer working iOS OpenGL ES 2.0
I have been trying to get this work but either get black screen or reporting error when using XCode to analyze the GL code like below. Any help appreciated. I am using Swift here if that making a ...
1
vote
0answers
59 views
swift fast enumeration on MDLAsset not working
I load an MDLAsset from my main bundle and get an compile error when fast iterating the asset object.
Type 'MDLAsset' does not conform to protocol 'SequenceType'
Documentation says it does support ...
0
votes
1answer
56 views
Does Apple allow customers to play over Bluetooth?
I'm a beginner in app development so sorry if my question is cheap :(
I wanted to start developing a card game and i was wondering if apple allows customers to play over Bluetooth or not ( on ...
1
vote
1answer
438 views
spritekit sidescroller how to move hero through the level
I am trying to learn spritekit by working my way through developing a simple side scrolling game, but I cannot find a clear answer on how to move the hero through the level.
The width of my ground ...
2
votes
1answer
193 views
Collisions between sprites in SpriteKit
I'm making a game in XCode using SpriteKit. The game has a player and different types of projectiles that he has to avoid. When the player collides with the projectiles, the score changes and the ...
0
votes
2answers
183 views
Where should I save game object's attributes (hp, score) in Swift?
Scenario: I have a game with several game objects on screen. Each can have different score and hitpoints. When I use collision detection for cannonball vs. ship (example) I need to know which ship is ...
0
votes
1answer
72 views
How to use objects with different attribute values in Swift?
I think this is a really basic question and to make it easier to understand what I do not understand, I use the following scenario.
Scenario: I have two or more ships in my game. They should have ...
1
vote
1answer
331 views
How can I avoid a delay with continues touch detection in swift?
I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the ...
0
votes
1answer
365 views
Is it possible to detect contact with every frame change when using an animation in SpriteKit?
Is it possible to detect contact with every frame change when using an animation in SpriteKit? For example, if I have two nodes of a person walking, I want to detect contact with the ground each time ...
0
votes
1answer
141 views
How to choose a SKSpriteNode randomly?
I want to choose from 4 enemies using random and present it on scene. For that purpose I've made this:
func enemyPicker() -> SKSpriteNode {
var enemyArray = [mouse, robot, drone, block, bird]
var ...
0
votes
1answer
49 views
How to assign a button in the main storyboard to launch the GameViewController.swift file
I am quite new to swift and I have constructed a main menu in the main.storyboard file, how do I assign the 'Play Now' button to launch the GameViewController.swift file where I actually plan to ...
1
vote
1answer
368 views
problem with SCNTransaction in Scene Kit
I'm trying to move an object over a period of ten seconds from y coordinate 0 to y coordinate 10. the object is created at y coordinate 0. The problem is when the animation starts, the object pops ...