Questions tagged [cocos2d-iphone]

1

votes
0

answer
54

Views

Cocos2d 2.0 worked code not working in Cocos2d 2.2

In my project below code used. It worked in iOS9 - Cocos2d 2.0. Now in Cocos2d 2.2 same code not working...no crash but platform image not coming...How to fix this for Cocos2d 2.2 ? -(CCSprite *)stripedSpriteWithColor1:(ccColor4F)c1 color2:(ccColor4F)c2 textureWidth:(float)textureWidth textureHeight...
iPhoneProcessor
1

votes
1

answer
1.4k

Views

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 cou...
user21293
1

votes
2

answer
1.8k

Views

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....
1

votes
4

answer
571

Views

Run-Time Dynamic Length Actions list for Sequence

Cocos2D defines the static method 'actions' for the Sequence class as such: +(id) actions: (FiniteTimeAction *) action1, ... { /* omitted */ } How could I build a list of actions to perform at run-time, perhaps read from a disk file or such? I read that the variable length argument list can be trans...
David Higgins
1

votes
1

answer
3.1k

Views

cocos2d moving objects

Im trying to move an object around the screen like in the game geometry wars. I can rotate the object just fine, however I cant seem to get it to move based on the direction it is facing. I have this code here which i think is right for doing this but I keep getting syntax errors: spriteObject.x =...
Bramble
1

votes
2

answer
2.6k

Views

Sprite backgrounds

I use cocos2d for iphone and in my game I'm using a sprite as static background image. I've noticed that when removing code for adding the sprite the framerate goes from ~30fps to over 40fps. Is it any other way to show a static background that is less expensive? I'm not moving the background sprite...
Mattias Akerman
1

votes
2

answer
1k

Views

how can i draw something on my Sprite?

i am using cocos2d to develop a game, now have a sprite loaded from image, and i would like to draw something on it like square? how can i do that?
1

votes
1

answer
758

Views

Releasing a CocosNode and adding its children to Layer in Cocos2d

I'm working on a Tetris clone in Cocos2d for the iPhone and I'm using a Block class of Sprites for the individual blocks and a Tetromino CocosNode class that the user controls in order to move the Blocks. All of these Blocks move around in a 20 by 10 grid of empty Blocks on the GameBoardLayer. When...
Josh Vera
1

votes
1

answer
821

Views

Generating graphics at runtime with Cocos2D - How to display?

I'm trying to create dynamic graphics for my game, which I'm building with Cocos2D. The graphics generation will occur at predictable, finite points, such as level loading. I'm having a hard time figuring out how to actually draw this at runtime. From what I can tell, the easiest way would be to dra...
jasonh
1

votes
2

answer
837

Views

How to move object using animation?

I am implementing game application.In which there is some mosquito(object).They moves randomly on the screen.but i want to move this object like real animation.can u advice me which animation i have to use.And should i have to use cocos2d or quartz core?Please give me advice.
MD.
1

votes
1

answer
686

Views

Cocos2d 0.8.2 (from 0.7.2)

I am switching from cocos2d 0.7.2 to 0.8.2 for cocosdenshion, but now i get 7 errors! Undefined symbols: '_OBJC_IVAR_$_TransitionScene.inSceneOnTop', referenced from: _OBJC_IVAR_$_TransitionScene.inSceneOnTop$non_lazy_ptr in PageTurnTransition.o '_inflateEnd', referenced from: _inflateMemory_ in Zip...
techy
1

votes
2

answer
515

Views

Error, could not create MachMessagePort for database doctor (com.apple.addressbook.migrationdaemon) starting in process migration

I'm working in address book for iphone. it generate address into UILabel. when I'm running the application everything goes well, but after showing about %30 of the addresses and sadenly stopped without any reason! Only in terminal shows: Error, could not create MachMessagePort for database doctor (c...
Alish
1

votes
2

answer
291

Views

how to release presentModelViewController stack in iphone?

I m Copying my code here below :- -(IBAction)referencewindow:(id)sender { frmReferences *reference = [[frmReferences alloc]initWithNibName:@'frmReferences' bundle:nil]; [self presentModalViewController:reference animated:YES]; } There are number of places I m using presentModelViewController and my...
AmanGupta007
1

votes
1

answer
719

Views

How can we detect a touch of a sprite?

I have two sprites in my app. Both should have touches enabled and both touches are independent of one another. And if I touch the screen (not on sprites) it should have different touches. My problem is all three sprite1, sprite2, remaining screen should have independent touches. But my program is t...
srikanth rongali
1

votes
1

answer
715

Views

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

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...
srikanth rongali
1

votes
1

answer
180

Views

Overloading framework methods in objective-c, or retaining local changes with framework updates

I am using cocos2d to build an iPhone game. It's mostly done, but along the way I came across some things that I would like to handle better. I am fairly new to Objective C, and honestly I do more Perl scripting in my day-to-day job than anything, so my C skills are a little rusty. One of them is...
Jeff B
1

votes
1

answer
182

Views

How to reset all the values after completion of the game, before starting it again?

I have writing a small shooting game in cocos2d. Winning the game is to eliminate all the 10 enemies. After that end screen comes showing 'You Won' and 'Play Again'. If I go for 'Play Again' option the game is starting from where I need. But, the problem is that the game is continuing from previousl...
srikanth rongali
1

votes
1

answer
1k

Views

Highlight Read-Along Text (in a storybook type app for iPhone)

I love this feature (well, my son loves it), and I would like to implement it in a kid's book app I am doing for iPhone, but I'm clueless where to begin. I'm using Cocos2d for all the animated sprite/transition stuff, but I'm not sure how to approach highlighting text as it is narrated. Example: '...
user317480
1

votes
1

answer
307

Views

How to reuse actions

Of the three parts I want to move, only the last one actually moves. I can't seem to 'recycle' the ease action I created. How is this done the correct way? - init { // initial setup [self moveParts]; } - (void)moveParts { id action = [CCMoveBy actionWithDuration:1 position:ccp(0,160)]; id ea...
Kriem
1

votes
2

answer
1.5k

Views

buttons and menu items in cocos2d/objective-c

In my app, I'd like a method called whenever the user taps the screen (anywhere on the screen). Normally, I'd make a transparent UIButton that covers the whole screen. If I'm using the cocos2d framework, what's the best way to do this? Is it good practice to still use UIButtons? I've been reading ab...
peter61
1

votes
1

answer
307

Views

Is it possible to change 2-3 times f->SetSensor()?

i use cocos2d-iphone-0.99.2 and integrated in it box2d. i have 2 kind of sprites with tags 1 and 2. Also i created bodies and shape definitions for them. what i'm trying to do is to make sprite1 kinds to act as solid or act as not solid when sprite2 colides with them. i tried this code : for(b2Bod...
Asen
1

votes
3

answer
258

Views

How can i detect whether a touch action touches on a sprite or not at zoom state?

First i have scaled the layer larger which contains the sprites. Now I need to sense touch on a sprite. I have tried as follows, but cant reach to goal- CGRect tRect= [[aSprite displayedFrame] rect]; if(CGRectContainsPoint(tRect, touchedPosition)) { NSLog(@'touched:>> touch at (%f,%f)',touchedPositi...
Sadat
1

votes
1

answer
1.3k

Views

Animating large sprites with cocos2d (ccspritesheet)

I'm working on an iPhone game using Cocos2d where the main character is approximately 194x114. the animation consists of 100+ frames making my spritesheets larger than the 1024x1024 limit. The obvious solution would be to separate the animation to several files and swapping spritesheets when necessa...
Jorge Cohen
1

votes
2

answer
519

Views

can i make the searchbar static in iphone application

I want that searchbar should also scroll with scrolling mean when i scroll down searchbar should be visible. as there anyway to do so... thanks. and sorry for my bad english..
Nauman.Khattak
1

votes
1

answer
467

Views

How to resume my game after call ended

I have developed a game. When i checked in iphone, i found that my game pause when an incoming call comes and restarts after attending and ending the call. How to make it resume instead of restart
Mythili
1

votes
3

answer
2.8k

Views

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, [spri...
Sadat
1

votes
2

answer
1k

Views

Cocos2d Animation Flickering

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?
Jorge Cohen
1

votes
2

answer
392

Views

Rotating 64 CCSprites more efficiently?

I have an 8 by 8 matrix of sprites that I need to be able to rotate all of them 90 degrees at once. The way I've done it is using nested for loops, and a 2 dimensional array of sprite pointers. for(row = 0;row
Cassie
1

votes
1

answer
1.5k

Views

Infinite maps/scrolling question

I'm using cocos2d for the iPhone to create an infinitely scrolling horizontal tile map. To achieve this, I've generated a library of 'segments', which are basically horizontal chunks of levels that I randomly choose from and append to the end of that particular levels tile map. When tiles scroll off...
ndg
1

votes
1

answer
551

Views

cocos2d button click boundary problem

i am new to iPhone and cocos2d in general, i m reading tutorials and tried to come up with application that contains a menu i m using cocos2d menu items the problem is that i found while testing my applications that the buttons respond to clicks on some area around the button (not only the button...
supperAly
1

votes
1

answer
488

Views

Making a Sprite unmovable…[Chipmunk & Cocos2D]

Im using Chipmunk with Cocos2d to make a gravity based puzzle game, however I have reached a part of my project whereby I need a sprite that once drawn does not move and cannot be moved by the other sprites within the environment. In essence... Can I create a static (non moving) sprite that is not a...
Candyfloss
1

votes
1

answer
485

Views

How to create iPad Application in cocos2d

I am new to iphone game development, i have recently install cocoas2d. But the problem i whenever i search it always result in iPhone game tutorials. I want my game to use iPad screen resolution. Thanks Inam
Inam Abbas
1

votes
2

answer
708

Views

anchorpoint issues with CCUIViewWrapper

I am having some issues understanding and using anchorPoint. As I understand it, the default anchor is (.5,.5) which applies transforms about the center of objects. However, when I placed a UIButton into a CCUIViewWrapper, I noticed that scaling it would scale about the right side of the object (i...
Joey
1

votes
1

answer
3.8k

Views

Problem with adding sprite using CCSprite array in cocos2d

I have problem with following code. mySpriteArray=[[NSMutableArray alloc] init]; star=[CCSprite spriteWithFile:@'22.png']; for(int i=0;i
russell
1

votes
1

answer
223

Views

iphone JSON Parsing.. How can i parse this data

this is the print screen of nsmutablearray. this 2409,2410,2412 is not fix key. it coming dynamically. { 2409 = ( { AltSelectionPrice = '2.00'; }, { AltSelectionPrice = '3.00'; } ); 2410 = ( { AltSelectionPrice = '7.00'; }, { AltSelectionPrice = '0.00'; } ); 2412 = ( { AltSelectionPrice...
Rakesh Bhatt
1

votes
1

answer
233

Views

Ccuiviewwrapper doesn't allow touch dispatcher to catch touches

When I use CCUIViewWrapper, I notice that my touch dispatcher doesn't catch any touches, even when the layers that need to have touches are added after the wrappers. Any idea how to remedy this?
Joey
1

votes
1

answer
1.9k

Views

Body moves too fast after ApplyLinearImpulse()

I have top-down game for iPhone (no gravity) and I'm using Cocos2d and Box2d. I try to move a bullet by this code: // 'targetPosition' is a point of touch b2Vec2 touchInWorld = b2Vec2(targetPosition.x/PTM_RATIO, targetPosition.y/PTM_RATIO); b2Vec2 direction = b2Vec2(touchInWorld.x - ballBodyDef.po...
mijo0
1

votes
2

answer
411

Views

Pathfinding / Deciding on direction

i'm making a simple iPhone game using cocos2d-iphone. I have an array of fiends, the 'fiendSet' which has to navigate around a field full of obstacles. I spent the last three nights trying to get my A* pathfinding to work. I found the actual A* implementation here on stackoverflow and it works brill...
Maciej Swic
1

votes
1

answer
124

Views

How do I handle extra top view when tethering, call

When we use tethering for use of 3G connectivity, the header appears twice as high. This means that the surface of my App being a little bit smaller. How do I handle this in my application in a good way? Should I measure header bar everytime view appears ? Or is that any delegate method for that...
f0rz
1

votes
1

answer
730

Views

Mirror iPhone on external display with cocos2d

I want to reproduce my iPhone display for demoing purposes. I've tried this and this, but both give me a black screen. Finally, I headed out to make my own solution. Here's what I have: // Check for external screen. if ([[UIScreen screens] count] > 1) { externalWindow = [[UIWindow alloc] initWithFr...
David Menard

View additional questions