Cocos2D making a isometric hexagonal tileMap - objective-c

I'd like to create a simple game with an isometric map with Cocos2D, but I can't figure how I should use an hexagonal tile (always isometric) map.
Any hints?

This link is probably your best bet for tile maps using cocos2d. I believe that the cocos2d sample code that comes with it has a hex tile map as well.

Related

Would using cocos2d be easier for a drag and match game?

I am pretty new to making games, but I am pretty familiar with programing iOS. I am creating a shape matching game, so there would be an array of different shapes and the user would drag the shape to the correct corresponding shape if they get it right it would stay and if they get it wrong it would shoot back. Now my question is would that be easier using cocso2d or any game engine or would it be just as easy not using one, just using a touch event?
Since the game you are describing is not graphically intense - I would recommend using UIKit. Couple of reasons why I would use UIKit over cocos2d:
Interface builder / Storyboards are awesome. You can lay out your
screens and game elements on screen. (I know tools exist to do this
using cocos like CocosBuilder, but IMO they just don't compare to
working directly in XCode)
UIKit animations couldn't be easier and you can do some pretty powerful things with minimal code.
You have direct access elements such as UITableView, UICollectionView, UIScrollView, etc. There are cocos nodes that mimic these, but they don't match up in terms of response and behavior.
For more graphically intense games I would still use cocos2d hands down. Some scenarios when you would use it:
You have a large number of sprites with a large number of animations (opengl is fast)
You want to use opengl based effects like particles, lighting, etc.
You need a physics engine
You want to work off a prebuilt game engine (there are tons such as levelsvg, kobold2d, line starter kit, etc)
Hope this helps you.

Objective-C, Methods for animating gui

I've created many types of interfaces using the Cocoa API — some of them using documented basic animation techniques and others simply by experimenting (such as placing an animated .gif inside an NSImage class) — which had somewhat catastrophic consequences. The question I have is what is the correct or the most effective way to create an animated and dynamic GUI so that it runs optimally and properly?
The closest example I can think of that would use a similar type of animation would be something one might see done in flash on any number of interactive websites or interfaces. I'm sure flash can be used in a Cocoa app, although if there is a way to achieve a similar result without re-inventing the wheel, or having to use 3rd party SDKs, I would love to get some input. Keep in mind I'm not just thinking of animation for games, iOS, etc. — I'm most interested in an animated GUI for Mac OS X, and making it 'flow' as one might interact in it.
If u wish to add many graphics animations, then go for OpenGLES based xcode project for iOS. That helps u to reduce performance problem. You can render each of the frames in gif as 2D texture.
I would recommend that you take a look at Core Animation. It is Apples framework for hardware accelerated animations for both OS X and iOS. It's built for making animated GUIs.
You can animate the property changes for things like position, opacity, color, transforms etc and also animate gradients with CAGradientLayer and animate non-rectagunal shapes using CAShapeLayer and a lot of other things.
A good resource to get you started is the Core Animation Programming Guide.

Why are OpenGL ES and cocos2D faster than Cocoa Touch / iOS frameworks itself?

I wonder if cocos2D is built on top of iOS's frameworks, won't cocos2D be slightly slower than using the Cocoa framework directly? (is cocos2D on top of OpenGL ES, which in turn is on top of Cocoa Touch / iOS frameworks including Core Animation and Quartz?).
However, I heard that OpenGL ES is actually faster than using Core Graphics, Core Animation, and Quartz?
So is OpenGL ES the fastest, cocos2D the second, and Core Animation the slowest? Does someone know why using OpenGL ES is faster than using Cocoa framework directly?
cocos2D is built on top of OpenGL. When creating a sprite in cocos2D, you are actually creating a 3D model and applying a texture to it. The 3D model is just a flat square and the camera is always looking straight at it which is why it all appears flat and 2D. But this is why you can do things like scaling and rotating sprites easily - all you are really doing is rotating the 2D square (well, two triangles really) or moving them closer or further away from the camera. But Cocos2D handles all that for you.
OpenGL is designed from the start to pump out 3D graphics very very quickly. So it is designed to handle shoving points and triangles around. This is then enhanced by a 3D rendering hardware which it can use specifically for this. As this is all it does, it can be very optimised for doing all the maths on the points that build up the objects and mapping textures onto those object. It doesn't have to worry about handling touches or other system things that Cocoa does.
Cocoa Touch doesn't use openGl. It may use some hardware acceleration, but it isn't designed for that - it's designed for creating 2D buttons, etc. What it does, it does well, but it has lots of layers to pass through to do what it needs to do which doesn't make it as efficient as something designed just for graphics (openGL).
OpenGL is the fastest
cocos2D is slightly slower, but only because there are some wrappers to make your life easier. If you were to do the same thing, then you may get it faster, but with the cost of flexibility.
Core Animation is the slowest.
But they all have their uses and are excellent in their individual niche areas.

How to make nice openGL blended lines in cocos2d?

i've written an algorithm to create electricity using ccDrawLine function in cocos2d for iphone. Currently, the ccDrawLine is a simple wrapper method for drawing openGL lines on the fly.
My algorithm is sound and works as I want. But the problem is with the appearance of the electricity in general.
I have little openGL programming knowledge(hence the use of the wrapper) and I require the ccLines to be blended nicely and look like either lasers or electricity.
How can I go about doing this avoiding the use of openGL programming if possible, otherwise i'll need to learn it.
you sample the surrounding pixels for each pixel of the area and average it out. This is the most basic way i know but it is not very fast so you could blend in 2x2 squares instead of 1x1 or even 4x4 and move over every iteration because for a nice effect you would do maybe 3 times.

How do I move a sprite in Cocoa?

I'm working in Objective-C for a Mac cocoa application. It's a pretty simple question, but I can't find an answer. I just want to move a sprite across the screen, like in a Snake game. Do I need to use NSTimer or NSAnimation, and how would I use it?
Thanks
You could use Core Animation. It provides a unified way to move and animate visual elements on the screen.
If you plan to create a simple game, "Cocoa with Love" has a nice "Asteroid" example:
http://cocoawithlove.com/2009/02/asteroids-style-game-in-coreanimation.html
Another game-related Core Animation project is Apple's Geek Game Board:
http://developer.apple.com/library/mac/#samplecode/GeekGameBoard/Introduction/Intro.html
Well, actually it depends on how you imagined your application, there's a lot of way to make things move. If you do not need anything complex or particularly efficient you may just access and modify the NSView frame property. Otherwise you should consider use Core Animation or OpenGL.
Core Animation Programming Guide
OpenGL Programming Guide for MacOSX