I'm creating a game for children using SpriteKit framework in iOS.
In my game, there are many speech bubbles which should be drawn by code.
I googled around and found intructions about using SKShapeNode to do it, but I haven't found a full Objective-C source code.
Has anyone done this before?
You can use the speech bubble you have already posted and display it as a SKSpriteNode with texture or image. Depending on your code set limitations, you can scale the y-axis for more or less text lines. Add SKLabelNodes to the bubble as children.
Related
I am in the processs of creating a "shape flicking" game of sorts for the iOS platform. I am using Apple's Sprite Kit and I would like the most efficient and least performance costly approach to have the ability to "flick" the various shapes off the screen.
My first thought would be to have an invisible circular physics body that follows your finger whenever you swipe or touch the screen, but I think there may be an easier way by applying an impulse..any thoughts?
I found the solution I was looking for here in the link below..question was already answered!
How to hit objects with finger movement in Sprite Kit, Objective C
I am not an iOS developer, I just started to implement my game, that I have done in flash, hoping that it will be super fast using the native environment.
The project is a 2d game that has a lot of dynamic bezier drawing based on the user's interaction. Basically I draw dynamic blobs (amoeba type of shapes).
First I tried Swift, which is very similar to actionscript, but it turned out, Apple won't be able to accept apps built with Swift before the final release of Xcode6 and as I want release my game before September I went to objective C route.
I wanted to use sprite kit because of the integrated physics engine, sprite hierarchy, etc.
I tried to use SKSphapeNode for drawing, but I realised it very quickly, it is not suitable for my needs. (cannot draw a stroke if it is thicker than 2 pixels, it has memory leaks etc.)
So I used UIBezierPath that I put into an UIImage, but I am not happy with the performance as I have to create a new UIImage with the new dynamically generated bezier shape.
These are the options I found so far:
SkShapeNode - not suitable for my game
UIBezierPath - UIImage > I have to create a new UIImage every frame, so it is slow
OpenGL - I haven't tried it yet, I am not sure it is possible to use it with Sprite kit
CALayer - I am trying to integrate it with spritekit at the moment, but I have a feeling I will have the same problem that I had with the UIImage approach.
Does anybody have any idea, tip what approach would be the best performance-wise?
Thank you for your help in advance!
I tried to create a lightning effect with using SpriteKit, so check out my article about that: https://andreygordeev.com/2014/11/01/lightning-with-srite-kit.html
Some of the approaches use UIBezierPath, so may be you find that useful.
I am developing an iPhone application that uses Cocos3d to draw shapes and images. Now I want to draw some text. Can anyone please guide me on how to draw text using Cocos3d?
Thanks in advance!
If you want to embed text in the 3D scene (like add a sign on a wall within the 3D scene), you can use CC3BitmapLabelNode. The CC3DemoMashUp app includes an example of how to do this, in the addBitmapLabel method of CC3DemoMashUpScene. The example actually does more than you need, because it uses a specialized subclass of CC3BitmapLabelNode that wraps the text around a cylinder. But it will give you the idea of how to use CC3BitmapLabelNode.
If you want to add text as a 2D overlay as part of the user interface (like a button, menu, or message to the user), use the standard Cocos2D components for that. You can add these 2D components to your customized CC3Layer. See the CC3DemoMashUpLayer for an example of how to do this.
I am trying to create a spotlight effect in my story book such that as the character moves around from one location to the other then the light focus moves towards that same character.Is it possible to do that in Corona SDK? How can I do that coz sprites aren't
helping me.Any idea regarding this.
I found some reference telling me that I can't do that
http://web-c2.anscamobile.com/forum/2012/10/27/dynamic-shadows-2d
http://developer.coronalabs.com/forum/2012/09/13/lightingshadows
Those two threads seem pretty definitive. You could create a spotlight pretty easy, but you can't cast shadows and the light moves different directions very easily.
If you want to do a spotlight without shadows, just create an image that's all black with a transparent hole in them middle that has some feathering around the hole. Make the black partially transparent so you can see the scene but have it a bit darker. You can them move the image around to be your spot light. You can also do it with a maskk (see the Flashlight example in the sample code)
I'm trying to draw lines in Cocos2d using touches.
I had a system where it would just add a small sprite where you touched, but it's working terribly. So I've been trying to find a way to draw actual lines using a method like ccDrawLine, but every tutorial I find seems to leave out something, and I just can't figure it out.
I've found this tutorial, Drawing line on touches moved in COCOS2D but I don't understand a few things about that.
It seems to reference the same variable from two different files, so I don't understand how it's doing that. (The naughtyTouchArray variable)
I can't find a complete guide on drawing lines, so sorry for the codeless question, but I'm getting frustrated.
Thanks.
The answer you've linked in your question provides good solution to your problem. There is no "two different files". Just two different methods of one layer. One method (ccTouchesMoved:withEvent:) handles touches and fill the array of points to be connected to each other one-by-one with lines. From cocos2d documentation, all drawing must be placed in the draw method of the node. So, another (draw) method just draws lines according to the given array. Cocos2d is based on OpenGL and it fully redraws scene every tick, so you cannot just draw new line. You had to draw all of them.
Or any other node can draw your array in it's draw method, so you can simply pass stored array of points from the layer, that detects touches, to this node.