How to move an NSImageView in a 2D game? - iphone

I am porting one of my iPhone apps to the mac, but I cant figure out how to move my NSImageViews around the screen, like i would do with CGpointMake. Also, how do you find the image.center.x in cocoa?
Any help would be great!

This sounds like you're searching for CoreAnimation.
CALayers are made for the things you want. You can specify their "anchorPoint" (their "center") free on them, so you can decide if their center should be in the upper-left corner, in the center or somewhere else.
Also, they are made for animation and such stuff.
Porting from an UIView-Based application is very easy (I have done this myself). Views and Layers are very similar in many aspects.

Related

What approach should I use to create animated backgrounds in Unity?

I'm new to Unity and trying to figure out the best way to create animated backgrounds. To be clear, I'm not asking you to give me an exact solution or instructions, and I would be grateful if you just tell me which direction to look in, and I will figure it out by reading the documentation.
I'm interested in how animated backgrounds are created in 2D Unity (for example, as here: https://youtu.be/OxiGlmV6ByA?t=1075 flying leaves are visible on the background). I only thought of using particles or just creating standard animations in Unity. But, the second way seems too long and complex, and about the particles, I'm not sure how much it affects the performance in a mobile game. Google searches mostly give instructions on how to create parallax backgrounds or moving backgrounds in Unity.
In general, I will be grateful if you tell me which approach is the most optimal for creating an animated background in a mobile 2D game in Unity.
The particles system is well optimized, for what you want to do it will not affects the performance, even on mobile.

Sprites for iOS devices

I'm trying to do a little research for my next game that I'm planning to make and just wondering if anyone could give me a little direction.
I'd like to use sprites to show animation, characters walking and such so my question is this. What game engine handles sprites the best?
And how many sprites can be shown per second? Say i had a character walking and wanted it to look pretty fluid, might i be able to get 60fps? or is that way way to high?
Last question.. sorry! If a sprite has more colors and complexity, but is the same file size as something simpler would it take more processing power to display the complex one?
thanks!
James.
I would highly recommend cocos2d for sprite animations. It's very easy to pick up if you already know objective-c. And it's great for working with sprites. The animations are very fluid and when your testing your applications in an iOS simulator, it tells you the frames per second in the bottom left hand corner. The frames per second usually runs at about 60. And regarding the sprite file size, I believe if the file size is the same between two sprites then they require the same amount of processing power.
A good engine to use for it's simplicity is the Sparrow engine for sprites, sound and other things. There is no reason you can't get 60fps. As for your last question, it wouldn't make a difference.

Dynamic animation using mic volume as trigger

I am new to iPhone development, and I am looking for someone with experience
to simply tell me whether I am on the right path or to perhaps point me to it
regarding what I am trying to acheive.
I am trying to develop a character animation that reacts to the volume of
the microphone input. Something like Talking Tomcat, except that instead of
having just a face react to the volume, an entire character´s body is involved.
The character has been created in illustrator and it is image based. So
this will be a 2D animation. I have created numerous frames for the different
kinds of reactions the character will have depending on the volume.
For my animation I am using UIViews using its Animation resources and adding
UIImageViews as subviews. I am also using CGAffineTransforms for rotating
images.
I am also relying on Timers to control the different stages of the
animation.
To allow for a more flexible animation, I have created UIViews for the head,
arms, torso and legs of the character. These have been severed into their own
images and I am manipulating these images individually through UIViews.
I can go over my code in more detail if necessary, although any help will be greatly appreciated even if it is something off the bat.
Seeing that you're not an advanced ios developer I would suggest starting with cocos2d.
It has everything you need to start with animation.
Web page and forums has plenty of information on how to do it and... what's most important [to me at least], you've got gurus like Ray Wenderlich writing excellent tutorials like:
http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

Animate a Stick Figure with Cocos2d, images vs. drawing?

I saw this question on a Cocos2d forum, and I would really like to see the answer, I'm assuming its more likely to get answered here:
I was wondering what would be the best method to go about animating a stick figure running, walking, etc.
I need to have a wide and flexible range of motion, so prefer to actually animate multiple lines rather than create premade images and flip through them.
Would I use rotation or use trigonometry to figure coordinates from the angle of the moving extremities?
Any advice, direction or code snippets would be really appreciated!
You could set your own anchor points for each sprite to animate with the rotation- that way you could rotate an arm from the end of the arm just by using rotate instead of doing a lot of complicated math. Setting the anchor point also allows you to translate the sprite along that point instead of its center. Anchorpoint tutorial.
However, I think that it might be easier just to create a lot of images of the stick figure doing all of the actions. I think that n game does this and their character has a lot of animations.

scattering effect

I went through all my resources but I am not getting the scattering effect of an image smoothly. However, I am able to zoom it and I had scattered it but it is not as smooth as I want. I just want to click on a button and it should zoom and the other image should get scatter
I want the image to be scattered as the link given below is it possible in iPhone?
http://www.touchmagix.com/templates/diamond.htm
this is hell lot of graphics. If you intend to achieve this with iPhone sdk, start learning details about CALayer and then try to manipulate the movements of different objects. Which will require lot of coding logic.
My suggestion would be going for Cocos2D and try with the different classes and api's present there. In Cocos2D you can create an image which will act as an actual physical object and you can apply all laws of physics to it. Say if you create a ball, and you push it, the ball will go in the direction of the push and bounce back if it gets hit by any other physical object and you don't require to do any coding for this. Cocos2D takes care of all these things.
Try it.