cocos2d

2D-iPhone-Game with side-scrolling & platforms like Super Mario with Cocos2D?

I want to create a game where the player only can run and jump on platforms. I think Cocos2D would be great for that but i haven't found any tutorials for cocos2d and side-scrolling. Where I have to start? ...

Box2D and sonic-like physics for platformer

I'm working on a platformer for the iPhone that is using Box2D and cocos2D. I'm trying to figure out a way to create similar behavior for my controlled character as is found in the Sonic the Hedgehog games, but maintain use of the Box2D physics library as I want projectiles and some level objects to behave according to realistic physics...

Adding text into a Sprite

How can I add text or characters into a Sprite. If it's not possible, is there any alternative to get the same effect? NOTE: I am using COCOS2D framework. EDIT: I have tried in this way- CCLabel* label = [[CCLabel alloc] initWithString:@"H!" dimensions:CGSizeMake([spriteObj contentSize].width, [spriteObj contentSize].height) alignme...

Cocos2d touches snap sprites if move one over another

Hi I'm having problem with touch events. I have a class (Inheritance from CCLayer) that return some sprites with touches events. I have around 10 of this same class with different sprites. Kind like a domino. The problem is that if I move the sprites I have defined on this class over another, they snap to each other. My .h file: @...

How to detect shake on the iPhone using Cocos2D?

I know how to do shake for the iPhone has been asked a million times on here, but I can't seem to find anything useful regarding the accelerometer with Cocos2D. Everything i have found involves using views and I don't think i am using any views in Cocos2D, if I am they are hidden from me I think. I want to be able to tell when any sort o...

How to safely remove objects from NSMutableSet (cocos2d-iphone)

Hello. I'm rather new to serious programming, so please forgive my dumbness, but I've failed to figure this out by myself. I am writing a game with cocos2d-iphone. I have a scene object with several NSMutableSets in its ivars - units, buildings, rockets, etc. I have a problem removing objects from these NSMutableSets. When a bullet obj...

Creating Menus and Keyboards with Cocos2d

Hi all Im just creating a menu for an iphone app using cocos2d CCMenuItem. Now i havent been using cocos2d that long so i may be doing this completely arse ways so hopefully someone can point me in the right direction. CCMenuItem *mainMenuItem = [CCMenuItemImage itemFromNormalImage:@"Main Menu Up.png" selectedImage:@"Main Menu Down.png"...

Invalid initializer, CGPoint

i have this code and on the second line it gives me an error that says invalid initialzer this is the code: -(void)setPlayerPosition:(CGPoint)position { CGPoint tileCoord = [self tileCoordForPosition:position]; int tileGid = [_meta tileGIDAt:tileCoord]; if (tileGid) { NSDictionary *properties = [_tileMap propertiesForGID:tileGid]; ...

Add cocos2d scene to UIViewController..

Hi, I use the following code to add cocos2d scene to a viewcontroller - (void)viewDidLoad { self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)]; if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] ) [CCDirector setDirectorType:CCDirectorTypeDefault]; [[CCDirector sharedDirector] setPixelFor...

Objective c ccTouchesBegan issue

hello i have a problem with ccTouchesBegan - (void)ccTouchesBegan:(UITouch *)touches withEvent:(UIEvent *)event { if (_mouseJoint != NULL) return; _paddleBody=body2; UITouch *myTouch = [touches anyObject]; CGPoint location = [myTouch locationInView:[myTouch view]]; location = [[CCDirector sharedDirector] convertToGL:location]; b2Vec2...

cocos2d - textures are not found on the device

Hey. Here's my code with I use to create sprite thanks to cocos2d. [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"bambusowy.plist"]; CCSpriteSheet *teksturySheet = [CCSpriteSheet spriteSheetWithFile:@"bambusowy.png"]; [self addChild:teksturySheet]; NSString * stttt = [NSString stringWithUTF8String: tex_...

Game Objects setup in cocos2d + box2d

I am having a design issue, this may be due to the fact that i don't fully understand cocos2d and box2d yet. I want to create game objects that have a CCSprite(image data) and a b2Body(physics), Would i be right to make an encapsulating object that contains both? if i did this this would enable me to make changes to the CCSprite OR ...

Cocos2D - ccTouchesBegan not registering

Hi, I have ccTouchesBegan to listen to touch events. It listen fine except within the location where the status bar is usually at (i.e the one that contains battery life, time etc), even though the status bar is turned off. In my case, the top 20px of my app isn't causing ccTouchesBegan to get triggered. How can I ensure that touch ev...

Restarting an action in cocos2D for the iPhone

If I am using an action that does not repeat in cocos2D how do I restart that action? I am using the code: CCAnimate* action = [CCAnimate actionWithAnimation:myAnimation]; [mySprite runAction: action]; The action runs fine once, but when an event is triggered I want to be able to run the action again as long as it is finished, so ...

How to do smooth movement with Accelerometer in Android?

How to move sprite objects smoothly on x-axis on change of Accelerometer in Android using Cococ2d? ...

box2d collision detection

Hi everyone Im using box2d in my game and i have a problem I need to determinate collision between two objects but only if they are touched with one exact side. For instance bottom of one object collided with top of another object. Could you give a pice of advice how can i do it? ...

Cocos2d Animation Flickering

Hi, I have a sprite which i animate using CCAnimate. the animation is composed of 4 spritesheets that i swap when needed. everything works pretty good except for some flickering when swapping spritesheets. any ideas on what to do? ...

Doodle Jump like gameplay

Hello, I am pretty new to cocos2d. Could someone please direct me to a good tutorial on how to make a game like doodle jump. I need to know how to make him bounce of the platforms, spawn platforms, use the accelerometer to control the player, etc. Thanks ...

iphone using cocos2d get EXC_BAD_ACCESS

I am making a simple game project involving the use of Cocos2d. Now as defined by Ray Wenderlich's example, i have completed the whole tutorial but added an extra bit of code myself to check total number of melons, when they reach 3, i replace screen with "You Win" screen to notify the user that he has won using [[CCDirector sharedDirect...

My "drawView" function is being called only once?

Hello, I'm new to OpenGL ES and having a simple kind of problem in my project. I've successfully drawn a square on my screen but the problem is that my "drawView" function in my EAGLView is only called once however I wrote code to call it again n again as in Xcode's OpenGL ES Template. Do anyone have clue where's the mistake? Followin...