Search Results

Search found 560 results on 23 pages for 'cocos2d'.

Page 2/23 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • cocos2d-x - object creation and management in game design

    - by Jason
    How do others keep track of everything going on in their games? I am working on a new game and I am quickly realizing everything that I need to keep track of. Example: Maybe a layerManager that keeps track of all the layers and what is happening for a particular scene. Maybe a sceneManager for sharing objects among scenes But then getting to game play itself, what if you have 100 objects on the screen each with its own state and happenings, there needs tobe a way to keep track of all of that. Drawing everything out is really helping me. Can anyone share with me how they go about object tracking/management? I am seeing a few different managers and then maybe even a parent object that manages the managers..is my thinking way off? Any design patterns that may be useful for me to read about? Update: doing some reading and maybe a Factory pattern might apply.

    Read the article

  • Importing a windows project into android using cocos2d-x

    - by Ef Es
    What I am trying to do today is to import a full project to Android, but no tutorials are available for that that I have seen. My approach was to create a new android project, copy all the classes and resources in the folders and calling ./build_native.sh but I get an error because most of the files are not being included in the project. I tried opening the Android.mk and I can see why "LOCAL_SRC_FILES := AppDelegate.cpp \ HelloWorldScene.cpp" are the only files linked. Should I manually modify the make file or can it be automated by some way I don't know? Thank you. UPDATE: I manually added all files and headers to the make file and I get errors linking Box2D or cocosdenshion libraries.

    Read the article

  • Cocos2d copied actions not responding?

    - by Stephen
    I am running an animation on 2 sprites like so: -(void) startFootballAnimation { CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f]; spiral = [CCAnimate actionWithAnimation:footballAnim]; CCRepeatForever* repeat = [CCRepeatForever actionWithAction:spiral]; [self runAction:repeat]; [secondFootball runAction:[[repeat copy] autorelease]]; } The problem I am having is I call this method: - (void) slowAnimation { [spiral setDuration:[spiral duration] + 0.01]; } and it only slows down the first sprites animation and not the second one. Do I need to do something different with copied actions to get them to react to the slowing of the animation?

    Read the article

  • Cocos2d: Adding a CCSequence to a CCArray

    - by Axort
    I have a problem with an action performed by a sprite. I have one CCSequence in a CCArray and I have an scheduled method (is called every 5 seconds) that make the sprite run the action. The action is performed correctly only the first time (the first 5 seconds), after that, the action do whatever it wants lol. Here is the code: In .h - @interface PowerUpLayer : CCLayer { PowerUp *powerUp; CCArray *trajectories; } @property (nonatomic, retain) CCArray *trajectories; In .mm - @implementation PowerUpLayer @synthesize trajectories; -(id)init { if((self = [super init])) { [self createTrajectories]; self.isTouchEnabled = YES; [self schedule:@selector(spawn:) interval:5]; } return self; } -(void)createTrajectories { self.trajectories = [CCArray arrayWithCapacity:1]; //Wave trajectory ccBezierConfig firstWave, secondWave; firstWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width + 30, [[CCDirector sharedDirector] winSize].height / 2);//powerUp.sprite.position.x, powerUp.sprite.position.y); firstWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width - ([[CCDirector sharedDirector] winSize].width / 4), 0); firstWave.endPosition = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2); secondWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2); secondWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width / 4, [[CCDirector sharedDirector] winSize].height); secondWave.endPosition = CGPointMake(-30, [[CCDirector sharedDirector] winSize].height / 2); id bezierWave1 = [CCBezierTo actionWithDuration:1 bezier:firstWave]; id bezierWave2 = [CCBezierTo actionWithDuration:1 bezier:secondWave]; id waveTrajectory = [CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]; [self.trajectories addObject:waveTrajectory]; //[powerUp.sprite runAction:bezierForward]; // [CCMoveBy actionWithDuration:3 position:CGPointMake(-[[CCDirector sharedDirector] winSize].width - powerUp.sprite.contentSize.width, 0)] //[powerUp.sprite runAction:[CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]]; } -(void)setInvisible:(id)sender { if(powerUp != nil) { [self removeChild:sender cleanup:YES]; powerUp = nil; } } This is the scheduled method: -(void)spawn:(ccTime)dt { if(powerUp == nil) { powerUp = [[PowerUp alloc] initWithType:0]; powerUp.sprite.position = CGPointMake([[CCDirector sharedDirector] winSize].width + powerUp.sprite.contentSize.width, [[CCDirector sharedDirector] winSize].height / 2); [self addChild:powerUp.sprite z:-1]; [powerUp.sprite runAction:((CCSequence *)[self.trajectories objectAtIndex:0])]; } } I don't know what is happening; I never modify the content of the CCSequence after the first time. Thanks!

    Read the article

  • Crash when using Cocos2d

    - by ipodfreak0313
    Sorry about the poor question title, it's just that this seems to big for a title. So here's the dirt: I am making a game (obviously) and I want the enemies to shoot (not necessarily at the player). I want the shoot method to be in the Enemies file, so as not to clutter up my HelloWorldLayer.m file even more. Here's what I'm using right now: HelloWorldLayer.m -(void)addEnemy:(BigAndStrongEnemy *)enemy { enemy = nil; if((arc4random() % 4) == 3) { enemy = [BigAndStrongEnemy enemy]; } else { enemy = [SmallAndFastEnemy enemy]; } if(buffDude.position.y > character.position.y || buffDude.position.y < (character.position.y + 10)) { } int rand = arc4random() % 320; if((arc4random() % 2 == 1)) { [enemy setPosition:ccp(0,rand)]; }else{ [enemy setPosition:ccp(480,rand)]; } [self animateEnemy:enemy]; [self addChild:enemy]; } -(void)animateEnemy:(BigAndStrongEnemy *)enemy2 { float randX = arc4random() % 480; float randY = arc4random() % 320; int rand = arc4random() % 320; CGPoint moveToPoint = CGPointMake(randX, (randY - rand)); [enemies addObject:enemy2]; action = [CCSequence actions: [CCMoveBy actionWithDuration:1 position:ccpMult(ccpNormalize(ccpSub(moveToPoint, enemy2.position)), 75)], [CCMoveBy actionWithDuration:3 position:ccp(buffDude.position.x,buffDude.position.y)], nil]; CCCallFuncO *a = [CCCallFuncO actionWithTarget:self selector:(@selector(shoot:)) object:enemy2]; CCSequence *s = [CCSequence actions:action,a, nil]; CCRepeatForever *repeat = [CCRepeatForever actionWithAction:s]; [enemy2 runAction:repeat]; } And here's the Shoot info from the Enemies class: Enemies.m: -(void)shoot:(id)sender { self = (BigAndStrongEnemy *)sender; [self shoot]; } -(void)spriteMoveFinished:(id)sender { CCSprite *b = (CCSprite *)sender; [self removeChild:b cleanup:YES]; } -(void)shoot { self = [CCSprite spriteWithFile:@"bigAndStrongEnemy.gif"]; CCSprite *b = [CCSprite spriteWithFile:@"bullet.gif"]; b.position = ccp(self.position.x,self.position.y); b.tag = 2; [self addChild:b]; [bullets addObject:b]; CGSize winSize = [[CCDirector sharedDirector] winSize]; CGPoint point = CGPointMake((winSize.width - (winSize.width - self.position.x)),0); [b runAction:[CCSequence actions: [CCMoveBy actionWithDuration:0.5 position:point], [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)], nil]]; } Every time the 3 seconds goes by, the app crashes, and goes to the breakpoint in the CCCallFuncO file. I haven't touched it, is the thing. I am completely confused. Any help is greatly appreciated.

    Read the article

  • Splashing Liquid Using Cocos2d

    - by Maverick
    I am new to game development in iOS. My problem is that I want to give a water splash effect on the screen as like someone has just randomly thrown water from any corner of the screen. I will be grateful to know any tutorials, or libraries that wil help me achieving this effect. Thanks in advance. Edit: Sample Liquid Simulation I wanted to simulate the behavior like this IMAGE. Like a liquid is poured in glass. I hope it clears what I asked. Thanks for your precious time.

    Read the article

  • How to pause and unpause the Particular action of a sprite?

    - by user1609578
    My game has a sprite representing a character. When the character picks up an item, the sprite should stop moving for a period of time. I use CCbezier to make the sprite move, like this: sprite->runaction(x) Now I want the sprite to stop its current action (moving) and later resume it. I can make the sprite stop by using: sprite->stopaction(x) but if I do that, I can't resume the movement. How can I do that?

    Read the article

  • How to pause and unpause the animation of a sprite?

    - by user1609578
    My game has a sprite representing a character. When the character picks up an item, the sprite should stop moving for a period of time. I use CCbezier to make the sprite move, like this: sprite->runaction(x) Now I want the sprite to stop its current action (moving) and later resume it. I can make the sprite stop by using: sprite->stopaction(x) but if I do that, I can't resume the movement. How can I do that?

    Read the article

  • How does Game Salad compare with Cocos2D in terms of 2D game development?

    - by jih
    I want to make some 2d games for iOS. I first come across cocos2d and kobold but then wanted something more graphical for rapid prototyping. I then found Game Maker which doesn't support iOS but is fairly easy to learn and then found Game Salad which supports iOS as well as other platforms. I know this question has been ask before but I want to know in terms of the types of games I want to develop what an learning investment path would be best. The types of games genre I am interest are: Side scrollers Simple games like diamond dash or ninja fruits, shanghai, etc Old fashioned zelda or dragonquest type (nintendo fan here:-) 2d adventure RPG games (real time or turn based) Mystery turn based games like carmen sandiego, wizardry, myst etc. So now the question becomes for me becomes which game development environment should I invest my time in learning. Game Salad or cocos2d? To make that decision I was wondering if experienced game programmers and help with some pointers: It would seem game salad would be great for quickies being graphical but in terms of 2d platform games etc would there be speed/performance/feature penalties? Are there certain 2d games genre of the 4 above that Game salad is better at while certain type cocos2d would be better at?

    Read the article

  • Has anyone used game salad before and how does it compare with cocos2d in terms of 2d game development

    - by jih
    First a short intro. I am new to the game development space and want to make some 2d games for iOS. I first come across cocos2d and kobold but then wanted something more graphical for rapid prototyping. I then found Game Maker which doesn't support iOS but is fairly easy to learn and then found Game Salad which supports iOS as well as other platforms. I know this question has been ask before but I want to know in terms of the types of games I want to develop what an learning investment path would be best. The types of games genre I am interest are: Side scrollers Simple games like diamond dash or ninja fruits, shanghai, etc Old fashioned zelda or dragonquest type (nintendo fan here:-) 2d adventure RPG games (real time or turn based) Mystery turn based games like carmen sandiego, wizardry, myst etc. So now the question becomes Which game development environment should I invest my time in learning. Game Salad or cocos2d? It would seem game salad would be great for quickies being graphical but in terms of 2d platform games etc would there be speed/performance/feature penalties? Are there certain 2d games genre of the 4 above that Game salad is better at while certain type cocos2d would be better at? Anyone with experience of both can share some pointers? Thanks. inexperienced jih

    Read the article

  • How do I rotate a sprite with ccbezierTo in cocos2d-x?

    - by user1609578
    In cocos2d-x, I move a sprite with ccbezierTo like this: // use for ccbezierTo bezier.controlPoint_1 = ccp(m_fish->getPositionX() + 200, visibleSize.height/2 + 300); bezier.controlPoint_2 = ccp(m_fish->getPositionX() + 400, visibleSize.height/2 - 300); bezier.endPosition = ccp(m_fish->getPositionX() + 600,visibleSize.height/2); bezier1.controlPoint_1 = ccp(m_fish->getPositionX() + 800, visibleSize.height/2 + 300); bezier1.controlPoint_2 = ccp(m_fish->getPositionX() + 1000, visibleSize.height/2 - 300); bezier1.endPosition = ccp(m_fish->getPositionX() + 1200,visibleSize.height/2); bezierForward = CCBezierTo::create(6, bezier); nextBezier = CCBezierTo::create (6,bezier1); m_fish->runAction(CCSequence::create( bezierForward, nextBezier, NULL)); How can I make my sprite rotate while moving it with CCBezierTo?

    Read the article

  • Using polygons instead of quads on Cocos2d

    - by rraallvv
    I've been looking under the hood of Cocos2d, and I think (please correct me if I'm wrong) that although working with quads is a key feature of the engine, it should't be dificult to make it work with arrays of vertices (aka polygons) instead of quads, being the quads a special case of an array of four vertices by the way, does anyone have any code that makes cocos2d render a texture filled polygon inside a batch node? the code posted here (http://www.cocos2d-iphone.org/forum/topic/8142/page/2#post-89393) does a nice job rendering a texture filled polygon but the class doesn't work with batch nodes

    Read the article

  • Cannot find the Cocos2d templates

    - by PeterK
    I am about to upgrade to the last version of Cocos2d and would like to uninstall my current Cocos2d templates before installing the new one but cannot find the templates to delete. I have looked at a number of web comments on this such as Uninstall Cocos2D ans another uninstall example but to no avail. However, I still see Cocos2d in my Xcode (4.5) framework. I have been searching my directories but cannot find it. Is there anyone out there who can give me a hint where to find it so i can delete in?

    Read the article

  • Detect touch Cocos2d-x

    - by James Dunay
    I'm using Cocos2d-x and trying to detect touches in my HelloWorld project. Though I'm having no luck. .h class HelloWorld : public CCLayer{ private: CCSpriteBatchNode * _batchNode; CCSprite *_turkey; virtual void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event); .ccp void HelloWorld::ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event){ CCLog("this"); } but the thing is that when I click the screen 'this' never shows up in the log. What am i missing here? thanks!

    Read the article

  • how to connect facebook sdk with cocos2d

    - by iPhone Fun
    hi all, As we all know face book is providing SDK to add face book in our applications. In simple applications it's easy to add such sdk as all things are known, but how to add face book sdk in cocos2d applications. I am new to this thing, so if any one can help me out , how to add face book adk with cocos2d?? I've done the same in simple applications, but I am not able to work with cocos2d. Thanks in advance.

    Read the article

  • Change the background image in cocos2d

    - by Viral
    Hi all, I am making a game using cocos2d. in that I want to change the background after each second of time. I don't know how to do this in cocos2d. I am having 15 different images and one by one each image will be shown, i.e. after1 second next image will appear. I am new to cocos2d so, If any one can help me??? thank you in advance to all.

    Read the article

  • How to achieve 'forward' movement (into the screen) using Cocos2D?

    - by lemikegao
    I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world (left, right, up, down) via gyroscope control. I plan to only use 2D sprites and no 3D models. My first attempt was to increase the scale of layers to make it appear as if the player was moving toward the objects but I'm not sure how to make it seem as if the player is passing around the objects (instead of running into them). If there are extensions that I should take a look at (like Cocos3D), please let me know. Thanks for the help! Note: I've only created 2D games so was hoping to get guided into the right direction

    Read the article

  • recommended book for cocos2d?

    - by Paul Sanwald
    I'm an experienced programmer that recently got into iOS development by working through the big nerd ranch book by Aaron Hillegass and Joe Conway. I loved the way the book was structured in terms of typing in the code and doing the challenges. I'm interested in learning more about iOS gaming and cocos2d, but am a complete newbie in terms of game development/design. there are a number of books on amazon on cocos2d, can anyone recommend one in particular?

    Read the article

  • Rendering shadow sprites in cocos2d-x

    - by lukeluke
    I am writing a 2D game with cocos2d-x. I want to put a "shadow" sprite on a background sprite using the equation: MAX(0, Cd*1 - Cs*S) where Cd is the destination color (that is, a background pixel), Cs is the source color (the shadow pixel) , S is the scale factor (between 0 and 1). The MAX() function is used to avoid negative results. This is a lighting effect: when the shadow sprite pixel is 0, there is no effect on the background pixel, otherwise, the background pixel becomes darker. Now, the only way that comes to my mind is to change the blending equation to GL_FUNC_SUBTRACT, but it doesn't compile with cocos2d-x (can't found it)... I would subclass the CCSprite class in order to implement the draw() method in order to change, when needed, the blending equation, call the original draw() method and restore the blending equation to its previous state at the end of the method. So my questions are two: how to use glBlendEquation() with cocos2d-x? Keep in mind that i am writing a game for iphone/android/windows. are shadows handled this way in 2D games? Thx

    Read the article

  • Will buy simple Cocos2D bubbles iPad game for private use (source)

    - by boliva
    Hi, First of all, sorry if this is the wrong place for posting this kind of request. IDK if is there already a marketplace on the stack community. I'm a fairly experienced iPhone/iPad developer with several Apps already published. I have a deep understanding of Objective-C and the Cocoa framework, as well as with the iPhone development tools. However, I have never used Cocos2d (or any other gaming engine for that matter) as I've mostly specialized in utilities/productivity Apps. I am in the urgent need of developing a really simple iPad game (for which I will provide all of the media assets - graphics and sounds) that needs to be deployed in about a week from now. Basically the game should allow the user to pop bubbles of different size and speed as they move from the bottom to the top of the screen. While I could take the time to read the documentation and start working on this game myself, I'm currently with a couple of other projects that I need to finish soon, so I would like to ask for the help of some other more experienced Cocos2D developer which could develop this game on its basic form for me. If you think you can help, please send me your quote, timing and, if possible, samples of previous work done with Cocos2D that would be similar to what I need. I can provide more detail upon request. Best and thank you all.

    Read the article

  • Running cocos2d with iPhone SDK 4 GM

    - by the_great_monkey
    I tried to build my (cocos2d 0.99.0-based) project with iPhone SDK 4 GM which was just released today. The reason is because I want to incorporate iAds in my apps. However I got 20 error messages which looks like errors in library calling. Can anyone tell me whether we can actually use cocos2d 0.99.0? I'm aware that 99.3 was released but they didn't mention any iOS 4 compatibilities.

    Read the article

  • Animating an image in cocos2d

    - by iPhone Fun
    hi all, I am making a game in cocos2d, in that some images of water drops are coming from the top of the screen. My problem is, when that image will reach to bottom of the screen it should be animated like spreading water or something like sparking occur. I don't know how to do animation in cocos2d, if any one knows please tell me. My project is remain due to this thing only. Thanks in advance.

    Read the article

  • how to learn "Animations in COCOS2D"

    - by iPhone Fun
    hi all friends, I am new to cocos2d animations and I want to learn it , as always I stops at the point of animation while making iPhone games in cocos2d. Can any one suggest me the way to learn such animations, so that games animation creating will become easy to make. Thanks.

    Read the article

  • Thread-safety in Cocos2d-iPhone?

    - by Malax
    After tinkering a bit with cocos2d, I discovered that there is no classic game loop and everything is more-or-less event driven. I guess I can wrap my head around that, no problem. But I cannot find anything about thread safety. Say, I schedule something to occur every two seconds, which Thread will run the code? Given that I cannot find anything about that, I guess there is just one Cocos2d Thread and everything will be fine. Nevertheless, this implicit assumption does not give me a good feeling. Knowing is better than guessing. ;-) Can anyone shed some light onto that topic?

    Read the article

  • What is the best way to learn Cocos2D?

    - by Joey Green
    I've messed around with iPhone development for a couple years now. I've done some contract work. I want to get into Cocos2D to develop a game idea that I have. I was wondering what might be the best/quickest way to get up in running in cocos2d? I've thought about a book, but I wondering if that is needed? I'm the type of guy that just wants to know what everything does and is suppose to be used for. Any ideas?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >