Cocos2d: graphics tool - ios

I started to learn Cocos2d to develop games and also Box2d; I read some tutorials and I seen that are used two couples of tool "LevelHelper-SpriteHelper" & "PhysicsEditor-TexturePacker".
I noticed that LevelHelper-SpriteHelper are more "simply" and organize levels and physics objects very well.
While with PhysicsEditor-TexturePacker I noticed some difficulties where the approach is not very clear.
So what are the best tools between "LevelHelper-SpriteHelper" & "PhysicsEditor-TexturePacker"?
And what are the differences? Can you explain me? thanks

This should answer your questions: http://abitofcode.com/2012/07/cocos2d-useful-tools/
Physics editor is a program that you use to create a tracing around a sprite that isn't a simple polygon. For example it could trace an image of a car, so that when you went to detect a collision between your car and another object with a physics engine (something like box2d) it registers a collision just with the car and not a square surrounding the car. Here is a picture that shows you what it does: http://www.codeandweb.com/physicseditor/features.
Texture-packer is used to put all your sprites that you use in your game into one spritesheet. This allows you to minimize the amount of memory that all of your sprites take up.
http://www.codeandweb.com/texturepacker That picture shows you what it does. Instead of having to add all your individual sprite images to your game you put them all on a spritesheet, which trims the space around each image and puts it into a file size that cocos2d and the iphone can work with.
This is helpful because cocos2d only takes images that have dimensions to the power of two. (2,4,8,16....) If you had a sprite that was 50x50, it would actually take up 64x64 amount of space in your game.
Here is a tutorial that explains most of that better than i did: http://www.raywenderlich.com/2361/how-to-create-and-optimize-sprite-sheets-in-cocos2d-with-texture-packer-and-pixel-formats
And here is project where both are used: http://www.raywenderlich.com/7261/monkey-jump
And here is one with levelhelper and spritehelper: http://www.raywenderlich.com/6929/how-to-make-a-game-like-jetpack-joyride-using-levelhelper-spritehelper-part-1
For a list of more tools go here"
http://www.learn-cocos2d.com/2011/06/complete-list-cocos2d-tools/

SpriteHelper is essentially the same tool as TexturePacker. Both create a single large texture from individual images.
LevelHelper is an editing tool to design your game visually. It also allows editing of the physics world.
PhysicsEditor is a tool to create the (collision) shapes of physics bodies from images. No more, no less.

Related

Making a scrolling floor like in Street fighter 2 in XNA(Monogame)

How would I make a scrolling pseudo 3d floor like in street fighter 2 in XNA(or more specifically MonoGame)?
https://gyazo.com/ea78954a5d96c3cb522eeac4a6ee5f21
for reference, if you aren't aware what I'm talking about. I Understand the concept of how it was done on the SNES(moving each line of the sprite separately) but how could I achieve the same effect in XNA with today's technology and libraries?
What you need is a simple ViewPort.
A ViewPort basically shows only a little scene from an overall bigger Picture. Like you have it in sides crollers or RPGs. You only see the current scene and not the complete Level/World.
An implementation example can be found here:
http://community.monogame.net/t/simple-2d-camera/9135
It might be a bit tricky to understand everything at the beginning, but at the end you can reuse this for almost any 2D game and several effects (camera shake, Rotation and so on) so it's worth the effort,

Blender + SceneKit (how-to)

A few questions to game developers. I am very beginner in this. I want to create a game level for example a green plane with trees. I have played a little in Blender and SceneKit. I know that I can export .dae from Blender and import it to Xcode. My questions:
Should I delete camera and light node before export? Why?
Should I design all level in one .dea file or make it separately? For example one .dea for plane and four different trees in for .dea's How to merge them in Xcode?
Can I use many times one .dea to generate for example a forest? How?
If creating design in separately is better way how to keep proportions between them to protect yourself from creation man bigger than tree?
I will be very great full if somebody someone dedicates to these questions. It will cut my time to learn basic. Thanks in advance. :)
I'll tell you how I do it:
1) .dea files use only for models(trees, charecters, building, etc...)
2) Game scene: floor, models, light, camera, obstacles build using Xcode scene builder or by code or mixed (based on the scene).
3) Based on size of world/level it can be split into several scenes(visible/invisible by player). Then you can create one blank scene and load/unload these scenes during runtime.
4) For a model you create a reference and after that build forest using reference of tree. If in the future you need to change the color of tree, all trees in all scenes will be updated.
5) For each model(SCNNode) (loaded from .dea file) you can set scale attribute (from code or by Xcode scene builder)
Also, 3D Apple Games by Tutorials is very good for starting.

How to draw lines on the screen for an iOS game

I am working on a game where I need to draw a bunch of lines to create a wireframe sort of object, I can do this in sprite kit using nodes but adding a bunch of nodes to the screen will drop the frame rate down a lot. I don't know how to use OpenGL Es at all so that's not an option for me. Is there anything that would just allow me to draw lines on the screen in Sprite kit without adding nodes or is there another framework that will allow me to do that?
If you want a 3D wireframe then your choices are sprite kit (which is built on top of OpenGL), OpenGL, or Metal. Or I guess you could use somebody's 3rd party framework that is also built on top of OpenGL or Metal.
I tend to agree with nhgrif's comment that you're "I don't know xyz so I can't do that" is needlessly limiting. If you can't do anything that involves learning new APIs then you're never going to get very far as a developer.

collision detection and creation in xcode class

I'm working on making a new app in xcode and have run into two problems that always seem to be a problem when I program large projects.
Basically, I want the user of this app to be able to input specifics like size, position, color, and possibly speed and/or direction.
These inputs will create a square of specific size, position, and color which will move around the screen and interact with other squares the user has created.
Now here are my problems:
First: I have absolutely no idea how to create something in code. I know I almost certainly have to do this in a class, but I've never figured out how to do this in a single programming language.
Second: Interaction between the squares. How do I detect collisions between the possibly dozens or hundreds of squares the user creates.
I'd really like to figure out how to do this, especially because I'm sure it'll be helpful in not only this, but many other future projects.
Thanks
I would recommend using sprite kit for the collision detection and creation of the squares. You'll probably want to subclass SKSpriteNode to define the properties for your squares.
https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html

How to optimize my memory usage with sprites...between SpriteFrameCache and SpriteBatchNode

I have seen the usage of plist and png atlasses for the game i am developing. However I've notice a slight performance swiftness(speed up) keeping the 60 fps, and for a side note my app has not crash at the moment.
The thing is I noticed I have used SpriteFrameCache with plist to do CCactions and animations for my characters(sprites). However some of the characters ive been using SpriteBatchnode, but it was on accident, since I am relatively new to deep development of a game, I didnt notice this difference before, they both work, but I feel like both are the same, its just that one has an easier way of implementation than the other, i was thinking that perhaps it was developed in an earlier version....
so my question is. is there a difference between the two? will my game benefit for using SpriteFrameCache over SpriteBatchNode?
Thanks for the help.
FYI: this doesnt slow down my developing, its just a question because I know at the end when my game is finished maybe i would want to optimize performance for my game.
Batch nodes draw all child sprites in one draw call.
Sprite frames hold a reference to a texture and define a region in the texture to draw from. The cache allows you to access sprite frames by name.
Both are different concepts, they are not replacements for each other. You can use sprite frames to create sprites or sprite frame animations. In addition to that sprite batching enables you to speed up rendering of two or more sprites using the same texture.
Note that if you use a batch node with only a single child sprite this will not be any different from rendering the sprite without the batch node, since both create a single draw call so there is no positive effect in using the batch node.

Resources