Tag Info

New answers tagged

0

First, the behavior you're describing is that of an aerodynamic vehicle with a single vector of force. A spaceship, flying in space, would operate in an entirely different manner. If this is still the desired behavior: Second, to utilize SpriteKit's efficiency, it might be best to use actions on your nodes. This isn't a requirement, but they exist ...


0

I'm just learning SpriteKit myself, however I think the following would be faster: - (BOOL)checkCollisionForSpikePoint:(GCPoint)spikePoint ballCenter:(CGPoint)ballCenter ballRadius:(CGFloat)ballRadius { CGFloat hypotenuse = sqrt(exp(spikePoint.x-ballCenter.x,2) + exp(spikePoint.y-ballCenter.y,2)); ...


0

I think most of your problems might be solved by understanding the use of category masks. Simply set the masks to ignore contact and collision between the sword and player categories. Specifically, this is done by assigning unsigned integers to the categoryBitMask, collisionBitMask, and contactBitMask properties of the SKPhysicsBody of the SKSpriteNode in ...


0

The simplest means of determining if there is contact after your touches finish is to alter the category of the "ball" to a category that registers contacts with the "bucket". That is to say, your ball would have a category that ignores the bucket until the ball is dragged and the touches end (touchesEnd method), at which point the category of the ...


1

Remember that SpriteKit's physics system is based on "SKPhysicsBody"s, which are added to "SKSpriteNode"s. Those physics bodies, however, needn't be attached to visible nodes. The simplest method is to create a SpriteNode with no actual sprite or visible body, add it as a child to the area you want on the visible shape, and categorize it differently from ...


1

If the only difference between the enemies are sprite changes and simple quantities (number of shots fired, rate of fire, etc), multiple classes would not be needed. This is exactly the sort of game Sprite-Kit was designed to make easily and quickly. Classes would be more appropriate if there was some unique behavior between the different kinds of enemy ...


0

A swipe gesture is a kind of pan gesture. Both gestures start and end when a touch starts and ends, but a pan gesture will track and report input continuously over the duration of the touch. A swipe gesture will "instantaneously" determine if the translation of the touch was fast enough and in the proper direction and report only once. Consequently, you ...


0

To get the complete bounding rectangle of a node and its child nodes you use the calculateAccumulatedFrame method. It's a member of SKNode. I ran into this when adding my SKSpriteNodes to separate SKNodes as layers for parallax and HUD elements. I kept getting (0,0) width/height for my bounding rect on the SKNode, and I found this. It returns a CGRect, and ...


1

Wrapping the SKEmitterNode in an SKEffectNode allows the EmitterNode to be rendered into a framebuffer which is subsequently rendered onto the screen. I tested this out (after much push and pull of different nodes and scenes and views) and this results in the exact effect you want, where the Add blend mode is applied to a background that is not rendered ...


0

The 20.0 is the bias used to manipulate the mipmap level to read. The same parameter exists in OpenGL ES (see a description in the specs here: http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf page 71). Note that it is only available in the fragment shader as the derivatives used to calculate the mipmap level are the differences ...



Top 50 recent answers are included