Search Results

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

Page 12/23 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • When we should use pushScene and replaceScene in cocos2d ?

    - by srikanth rongali
    Hi, I cocos2d, I am using pushScene and replaceScene to move to next scene. But, I am confused which we should use? When I am using replaceScene in some places app is crashing and giving errors like -[UITextView length]: unrecognized selector sent to instance 0x842a750 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITextView length]: unrecognized selector sent to instance 0x842a750' But, in my program I am not passing length to UITextView. My program is in this way In scene1 I have UITextView, and I am replacing this scene with scene2. Then -(id)buttonPressed:(id)sender { [description removeFromSuperview]; // It is the textView(description) CCScene *Scene = [CCScene node]; CCLayer *Layer = [scene2 node]; [Scene addChild:Layer]; [[CCDirector sharedDirector] setAnimationInterval:1.0/60]; [[CCDirector sharedDirector] replaceScene: Scene]; } But, when I am using pushScene in presence of replaceScene it is working good. Please clarify me which one should use in which cases ? Thank You

    Read the article

  • How can I write a scrolling text in cocos2d ?

    - by srikanth rongali
    I have a text and it should be abled to scrolled only up and down to see entire text. and my application is a game and written in cocos2d. So, I have layers. There is also an image(CCSprite) adjacent to text. The text should be scrolled and the image have a touchesEnded: property. I used CCLabel for text and CCParallaxNode to add the text. But the text appears like a continues paragraph. But, my text should have different lines. My text is like this. //text starts Hey Player. Do you want to play the game right now then play. Do you want to practice or Play? what want to do? ...text continues //text ends What should I use for this ? Thank you.

    Read the article

  • how can we count the time interval of the animation in cocos2d ?

    - by srikanth rongali
    Hi, I am doing my program in cocos2d. I am using NSDate to get the current time of the start of animation. And I know my animation takes 3 seconds. So I can get the time at completion of animation by using NSInterval and using the previous time and animation time. But, if If the animation time interval is not fixed how can I calculate the time interval of the animation and time at the completion of the animation ? I am animating a sprite. Please help how can I make it. Thank You.

    Read the article

  • In cocos2D how to write a selector for a sprite.

    - by srikanth rongali
    Hello, I got problem in cocos2D application. I have a sprite and text in one screen. The text should be able to move up/down when we swipe. And when we select on the sprite it should take to next scene. So, both should have the istouchEnabled to YES. But text should take the touchesMoved and sprite should take touchesEnded. But my problem is either one is working. If am able to swipe the text, I am not able to select the sprite.( touchesEnded for sprite is not called). Please guide me, I am stuck here.

    Read the article

  • Do, custom fonts work in UITextView that was loaded in cocos2d layer ?

    - by srikanth rongali
    Do, custom fonts work in UITextView ? I loaded UITextView *textView in cocos2d layer. And I trying to set the font of the text as Copperplate Gothic Bold. I downloaded the font file Coprgtb.TTF. But, the text is not adjusting to this font. The system fonts are working, but the custom fonts are not working ? I added the font file in resources folder. what can I do to make them work ? Thank You.

    Read the article

  • Why is iPhone 5 briefly Letterboxing and displaying Default.png in Cocos2d?

    - by The Learner
    I have [email protected] which loads fine. However, (on the actual device) after it shows the iPhone 5 then displays Default.png, in letter box mode. It then loads the 1136 × 640 px Title Screen - which is fine and what it's supposed to do. I'm using the default Cocos2d HelloWorld template. I haven't changed anything in the plist or otherwise. Any ideas? Why does it load the Default.png and how do you fix this? Thanks. In the IntroLayer we have -(void) onEnter if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) { background = [CCSprite spriteWithFile:@"Default.png"]; background.rotation = 90; } Which is why Default.png is showing up. How do you keep showing [email protected] if you are using the iPhone 5?

    Read the article

  • How to convert from wav or mp3 to raw PCM [on hold]

    - by Komyg
    I am developing a game using Cocos2d-X and Marmalade SDK, and I am looking for any recommendations of programs that can convert audio files in mp3 or wav format to raw PCM 16 format. The problem is that I am using the SimpleAudioEngine class to play sounds in my game and in Marmalade it only supports files that are encoded as raw PCM 16. Unfortunately I've been having a very hard time finding a program that can do this type of conversion, so I am looking for a recommendation.

    Read the article

  • How to attach an object to a rotating circle?

    - by armands
    I am trying to make an object get attached on a collision point to a circle that is rotating, but the player needs to get attached with a constant point on the player. For example the player is moving back and forth and when the user touches the screen and the player jumps up but what I need is that when the player collides with the circle it attaches it's legs to it and continues rotating with the circle. So I wanted to know how to make this kind of collision joint in Cocos2d Box2d?

    Read the article

  • Behavior Trees and Animations

    - by Tom
    I have started working on the AI for a game, but am confused how I should handle animations. I will be using a Behavior Tree for AI behavior and Cocos2D for my game engine. Should my "PlayAnimationWalk" just be another node in the tree? Something similar to this: [Approach Player] - Play Walk animation - Move Towards player - Stop Walk animation Or should the node just update an AnimationState in the blackboard and have some type of animation handler/component reference this for which animation should be playing? This has been driving me nuts :)

    Read the article

  • How to split up levels? (cocos2d,box2d,iphone) to save CPU and memory?

    - by cocos2dbeginner
    Hi, so I'm going to create large levels. But there's a problem: There's much unseen space (it's a jump'n run like mario bros.) and this will use memory + cpu. so how could I split up my levels? I'm using Box2D+ cocos2d for iphone. Any ideas? Mayby just set the visible property to NO? But it would be still in the memory :(. But what with the box2d bodies? Destroy and recreate them would be to heavy for the FPS, because I have physics built in which should not be recreated. Should I make fix points where i want to split the level up, than if the player is 200 px away it should preload it. and if the player is 200 px away from the last part of the level I unload it. But there would be the problem with the physics, because on the start of the level it has a unique movement and later if i destroy and recreate it it would do the same. but i don't want that. other ideas?

    Read the article

  • how can I store the current status of the game in cocos2d ?

    - by srikanth rongali
    I am writing a shooting game in cocos2d. And each enemy enters the screen after the current one is dead. I have stores the enemies and their properties in plist. I need to save the current state of the game. If any phone call comes the game should be started from the current state. So, I usedNsUserDefaults in this way, - (void) applicationDidFinishLaunching:(UIApplication*)application { ... NSUserDefaults *myDefaultOptions = [[myDefaultOptions stringForKey:@"enemyNumber"]intValue] ; //tempCount4 is the current Enemy number. It was declared in another class. I am using extern and using the value here. tempCount4 = [[myDefaultOptions stringForKey:@"enemyNumber"]intValue] ; } - (void)applicationWillTerminate:(UIApplication *)application { [[CCDirector sharedDirector] end]; [myDefaultOptions setObject:tempCount4 forKey:@"enemyNumber"]; } The control is not entering in to the (void)applicationWillTerminate:(UIApplication *)application when I pressed the Home button. And when I touched the game icon on the screen the game is running from first screen and in log (terminal )it is not showing any values. And what should I store to resume my game from stored state. Can you explain where I was wrong ? Thank You.

    Read the article

  • Issue with TurnBased Multiplayer Game in Game-kit

    - by Nirav
    I am working with cocos2d game in which i am implementing Game-kit. My game supports multiplayer option. Actually as given example Raywenderlich link. I am GKTurnBasedMultiplayer class from Game-kit. But now the issue when first player connected to game center and will select option of "Play Now" it automatches for another player. but issue is it directly connects and starts the match, and doesn't wait for another player. I am using [[GCTurnBasedMatchHelper sharedInstance] findMatchWithMinPlayers:2 maxPlayers:4 viewController:viewConroller]; for connecting and playing with other players but directly connects the match. I want to wait for another player. That is the issue. I am also using GCTurnBasedMatchHelper Class.

    Read the article

  • Objective - Gestures while finger touches screen

    - by marcg11
    I'm creating a space cocos2d game with objetive-c. I have in the bottom left 2 arrows to move the sprite left or right. I also implemented a swipe gesture to change weapon, however it only happens when I'm not touching the screen. I would like the player to change weapons while he's moving the sprite and not have to lift the finger from the arrows and stop moving the sprite to change weapons. Is there any way I can detect Gestures while having a finger pressed un a buton in thes screen?

    Read the article

  • How do I break an image into 6 or 8 pieces of different shapes?

    - by Anil gupta
    I am working on puzzle game, where the player can select an image from iPhone photo gallery. The selected image will save in puzzle page and after 3 second wait the selected image will be broken into 6 or 8 parts of different shapes. Then player will arrange these broken parts of images to make the original image. I am not getting idea how to break the image and merged so that player arrange the broken part. I want to break image like this below frame. I am developing this game in cocos2d.

    Read the article

  • Wait till all CCActions have completed

    - by tGilani
    I am developing a simple cocos2d game in which I want to animate two CCSprites simultaneously, and for this purpose I simply set CCActions on respective `CCSprite's as follows. [first runAction:[CCMoveTo actionWithDuration:1 position:secondPosition]]; [second runAction:[CCMoveTo actionWithDuration:1 position:firstPosition]]; Now I want to wait till the animations are complete, so I can perform the next step. How should I wait for these animations to finish? There are actually two method calls, the first one animates the objects via the code above and second call does the other animation. I need to delay the second method call until the animations in first are complete. (I would not like to use CCCallFunc blocks as I want to call the second method from the same caller as the first one.

    Read the article

  • Sending a android.content.Context parameter to a function with JNI

    - by Ef Es
    I am trying to create a method that checks for internet connection that needs a Context parameter. The JNIHelper allows me to call static functions with parameters, but I don't know how to "retrieve" Cocos2d-x Activity class to use it as a parameter. public static boolean isNetworkAvailable(Context context) { boolean haveConnectedWifi = false; boolean haveConnectedMobile = false; ConnectivityManager cm = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = cm.getAllNetworkInfo(); for (NetworkInfo ni : netInfo) { if (ni.getTypeName().equalsIgnoreCase("WIFI")) if (ni.isConnected()) haveConnectedWifi = true; if (ni.getTypeName().equalsIgnoreCase("MOBILE")) if (ni.isConnected()) haveConnectedMobile = true; } return haveConnectedWifi || haveConnectedMobile; } and the c++ code is JniMethodInfo methodInfo; if ( !JniHelper::getStaticMethodInfo( methodInfo, "my/app/TestApp", "isNetworkAvailable", "(android/content/Context;)V")) { //error return; } CCLog( "Method found and loaded!"); methodInfo.env->CallStaticVoidMethod( methodInfo.classID, methodInfo.methodID); methodInfo.env->DeleteLocalRef( methodInfo.classID);

    Read the article

  • CCUserDefault, iOS/Android and game updates

    - by Luke
    My game uses cocos2d-x and will be published on iOS platform first, later on Android. I save a lot of things with CCUserDefault (scores, which level was completed, number of coins taken, etc...). But now I have a big doubt. What will happen when the game will receive its first update? CCUserDefault uses an XML file stored somewhere in the app storage space. This file is created and retained until one uninstalls the app. I am wondering what happens when the app is updated. Will the old XML file be maintained? Because if not, how should I handle app updates (updates in the sense that 2, 3 or more new level packages will be added, but the informations about the old ones, like scores, which level was finished and which not, number of coins, etc., need absolutely not to be lost)?

    Read the article

  • how can i move static box2d object.

    - by user5198
    how can i move static box2d sprites. i have tried this tutorial from . http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12. I managed to add another "paddle" object with box2d body, but i can seam to be able to make the code to move the second "paddle" body. Can anyone direct me how to do it? Is there a way to move a "b2_staticBody" box 2d object? i have tried, but i can only move it when i use "b2_dynamicBody" if i used "b2_staticBody" i can move it at all.

    Read the article

  • Getting isometric grid coordinates from standard X,Y coordinates

    - by RoryHarvey
    I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform. For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584) So the question really is what formula gets (20,21) from (640,584)?

    Read the article

  • How do you maintain content size vs. content quality in a mobile application?

    - by PeterK
    I am developing my first Cocos2d iPhone/iPad game that includes quite a few sprites, I would need approximately 80 different. As this is for both normal and HD displays I have 2x of each sprite. I am using TexturePacker to optimize the thing. I would like to ask if there are any rules-of-thumb, tricks, ideas etc. to adjust to in regards to size of content, quality and how you maintain high-quality HD-based graphics due to its size vs. the device memory sizes? Also, is it a good idea to only have one copy of the sprites and scale it using code?

    Read the article

  • Different iPhone screen resolutions and game graphics

    - by Luke
    We are developing a 2D game for iPhone using cocos2d-x. The artists are drawing the raster graphic for a resoluion of 640x960. For older iPhone devices, those that have a resolution of 320x480, should we provide a completely new set of graphics, to be adapted to the smaller resolution? I was thinking of simply scaling the whole scene of a factor of 2. That would save us the time to write a specific set of graphic elements for the smaller resolution. What is the best practices? How do you guys handle the different screen resolution w.r.t. the graphic part of the game?

    Read the article

  • How do you maintain content size vs. content quality in an application?

    - by PeterK
    I am developing my first Cocos2d iPhone/iPad game that includes quite a few sprites, I would need approximately 80 different. As this is for both normal and HD displays I have 2x of each sprite. I am using TexturePacker to optimize the thing. I would like to ask if there are any rules-of-thumb, tricks, ideas etc. to adjust to in regards to size of content, quality and how you maintain high-quality HD-based graphics due to its size vs. the device memory sizes? Also, is it a good idea to only have one copy of the sprites and scale it using code?

    Read the article

  • C++ Framework for iOS [closed]

    - by myrkos
    I am looking for a simple and easy C++ framework for iOS. Specifically, what I want it to wrap in a C++ API: Simple GUI system 2D Graphics User touch input and accelerometer Networking (UDP sockets) What I'm trying to do is port a multiplayer game to the iOS. I've seen cocos2d-x, but I don't know how stable it is and I don't think it supports networking. Oh, and I want it to be free and open source if possible. Android support is a plus but definitely not required.

    Read the article

  • Simple 2D Flight Physics with Box2D

    - by MarkPowell
    I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and Box2D. I have a basic system working, but just can't get the physics feeling correct. I am applying force to the plane (which is a b2CircleShape) based on the user's input. So, basically, if the user pushes up, body_->ApplyForce(b2Vec2(10,30), body_->GetPosition()) is called. Similarly, for down -30 is used. This works and the plane flys along with up/down causing it to dive or climb. But it just doesn't feel right. There is no slowdown on climbs, nor speed up during dives. My simple solution is far to simple. How can I get a better feel for a plane climbing/diving? Thanks!

    Read the article

  • BOX2D Kinematic Platform with parallax layer

    - by Marcell
    I am using a kinematic body for my moving platform on x-axis, so I set the linear velocity to b2vec2(5,0). When the player jump on the platform, it works like it is suppose to. But the thing is that my platform is on the obstacle layer and I am moving it with the parallax layer. So if I setTransform the kinematic platform to follow the obstacle layer than it's physics will not work and the player will slip-off the platform. I'm developing for iOS and using cocos2d api. Anyway around this?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >