cocos2d

How can i use MYSQL database connection in iphone application useing cocos2d ?

I am working on project and i need to connect MYSQL database. I am success to connect SQLite in my project ( using cocos2d).But i can not connect MYSQL database in my project. I any one do like this than help me for how to connect . Give me the necessary information. ...

How to draw a line with Cocos2d-iPhone

Hi all, I'm trying to get to grips with Cocos2d by trying to accomplish simple things. At this point, I have a scene, that scene has a background sprite, and a Layer. I'm trying to draw onto the Layer uding drawLine. Here's by current attempt. @implementation MyLayer -(id)init{ self = [super init]; if(self != nil){ glColor...

Cocos 2d & CGPoint confusion in Landscape Mode

Hi,all, me again with another noob Cocos2d iphone question. I've set my Director to Landscape, but when I was looking at the coordinates of the 'Touch Event' it was still picking them up as though the screen was portrait. So they were basically reversed. x = 100, y = 50 should have been x = 50, y = 100 No biggie, it was easily ...

TextField Example in Cocos2d

Can anyone please suggest me some links for using textField in cocos2d. I want to press on label, then textfield should get selected and i need to edit on that textfield. Please help me on this ...

Passing a value from one object into another with Objective-C

I have a class called GameScene, with is a subclass of a cocos2d Scene. In there I have two layers. GameLayer and ControlsLayer. You can probably tell already that I want the ControlsLayer to move stuff around in the GameLayer. To be precise, I'm trying to control a cPBody in the GameLayer from the ControlsLayer. At the moment, I'm t...

Accessing a property from a C method in Cocoa

I'm trying to learn Objective C & Cocoa, but I just can't manage to access a property inside an Object. Specifically an object from a C method. I'm working with the chipmunk dynamics library. Chipmunk has something similar to NSPoint called cpVect. Now I have no problem defining a cpVect inside my object, but when I try to make the acc...

Add cocos2d menu items at run-time

I am trying to add a variable amount of MenuItem objects to a Menu object on runtime. When my game starts I don't really know if my menu is having 2 or for example 5 items. for (MyItem* item in myItemCollection) { MenuItemImage* menuItem = [MenuItemImage itemFromNormalImage:@"MenuItem.png" selectedImage:@"MenuItemSelected.png" targ...

What is Chipmunk? (Apart from being a Physics Engine)

Hopefully, this question isn't a dumb as I fear it sounds, but it may still be pretty dumb. I'm new to Objective-C, and Cocoa. In fact, I'm completely new to C in general. I'm trying to implement an iPhone game using Cocos2d-iPhone. It's a game I've made before in Flash, so I thought it would be a nice way to lean Objective C, cocoa an...

How can i invisible some text (show in leble) in iphone application using cocos2d ?

I want to invisible some text which is show by leble.I can invisible using this ( leblename.visible = NO; ).But some time it's create problem when i call different screen.I need different way for invisible leble text which is not create this type of problem. ...

Updating text from textfield from one scene to other

Hi All, I am having a problem in placing data(textField text) from one scene to another scene. I'm attaching my source code with this mail. Please help me if anything wrong in my code. // // PlayerSettingsAppDelegate.m // PlayerSettings // // // #import "PlayerSettingsAppDelegate.h" #import "TestScene.h" NSString *result; ...

How to restart the game scene using alert view in cocos2d

Hi All, I am trying to the restart the same level of the game once it is completed. I am using alert view to display at the time of Finish. I'm using 2 buttons in AlertView (End and PlayAgain). Once end is touched it should end that is working fine. The problem is once playAgain is touched The AlertView is displayed once again but...

Reuse Cocos2d CocosNodes

I am trying to create a cool score counter in my iPhone game, where I created the digits 0 to 9 in photoshop and I want to update the score every second. What I am doing now is the following: In my init I load all the digit sprites into an array, so that the array has 10 items. I created a method which breaks down the current score (e...

Custom easing action with Cocos2D-iphone

How would one go about creating a custom action in Cocos2D that was able to perform a 'callback' over time, making each call to the callback progressively longer than the last call to it (using something similar to the EaseExponentialOut action already provided with Cocos2D. Something similar to this: (which does not work) id sequence ...

iPhone & cocos2d - Interval Action timing problem while running in device

I'm using the cocos2d framework for various of my applications, and have run into the following problem. I have set up a few sequences of actions and CallFuncNDs, the actions have durations set up and when I run it in the iPhone simulator, it works just like I expect it to: transitions take the amount of time I set them to and they go in...

cocos2d help find points on a circle

I am trying to solve a tricky math problem, in a cocos2d for iphone context. Basically I have a roullette wheel which is rotating over time. I want to have a Sprite latch onto the wheel at certain points (like compass ordinal points N, S, E, W) and bounce off at all other points. I have the image of the wheel rotating, and just need t...

cocos2d: LabelAtlas text alignment?

Is there a way in cocos2d 0.7.1 to specify the text alignment in a LabelAtlas? I'm using a LabelAtlas for a score (displayed in the upper right corner) but when the score goes above 10, the second digit is cut off. I can implement code to detect that and move the LabelAtlas, but is there a way to have cocos2d do it for me? Thanks. ...

Possible to change the alpha value of certain pixels on iPhone?

Is it possible to change just a portion of a Sprite's alpha in response to user interaction? A good example of what I mean is iFog or iSteam, where the user can wipe "steam" off the iPhone's screen. Swapping images out wouldn't be feasible due to the sheer number of possibilities where the user could touch and move... For example, say ...

Sprites appear blue using cocos 2d-iphone, but only in the simulator

I'm running this sample code located here: http://monoclestudios.com/cocos2d_whitepaper.html using cocos 2d-iphone 0.7.2, and the sprites are being drawn coloured blue. But this is only happening on the simulator. On an actual device, everything looks fine. Has anyone else run into this problem? ...

How to center align a sprite?

In cocos2d does anyone know how to center a sprite? Right now, I have a sprite that moves to where you touch on the screen. The problem is that the sprite is aligned to the lower left corner. This means that instead of moving down, if you touch just a little over the bottom the sprite will move up. Thanks in advance! Here is my code... ...

Detecting image touch (cocos2d)?

In cocos2d how would you detect a touch on an image? I'm having a lot of trouble with this so thanks in advance! ...