Search Results

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

Page 18/23 | < Previous Page | 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Extremely slow MFMailComposeViewControllerDelegate

    - by Jeff B
    I have a bit of a strange problem. I am trying to send in-app email. I am also using Cocos2d. It works, so far as I get the mail window and I can send mail, but it is extremely slow. It seems to only accept touches every second or so. I checked the cpu usage, and it is quite low. I paused my director, so nothing else should be happening. Any ideas? I am pulling my hair out. I looked at some examples and did the following: Made my scene the mail delegate: @interface MyLayer : CCLayer <MFMailComposeViewControllerDelegate> { ... } And implemented the following function in the scenes: -(void) showEmailWindow: (id) sender { [[CCDirector sharedDirector] pause]; MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject: @"My subject here"]; NSString *emailBody = @"<h1>Here is my email!</h1>"; [picker setMessageBody:emailBody isHTML:YES]; [myMail presentModalViewController:picker animated:NO]; [picker release]; } I also implemented the mailComposeController, to handle the callback.

    Read the article

  • How to stop the targets generated by schedule:@selector(target:) interval:timeInterval ?

    - by srikanth rongali
    I am using [self schedule:@selector(target:) interval:timeInterval]; for generating bullets in shooting game in cocos2d. In target: I called method targetGenerate to generate for bullet. The enemy generates these bullets. After the player won or enemy won the game the bullets should stop. But, I could not make them stop. I used flags for this. But they did either work. If I set flag1 = 1; for game won. I am using [self schedule:@selector(update:)]; for updating the bullet position to know it hits the player or not ? And I tried like this -(id)init { if( (self = [super init]) ) { //code for enemy [self schedule:@selector(target:) interval:timeInterval]; [self schedule:@selector(update:)]; }return self; } -(void)target:(ccTime)dt { if(flag != 1) [self targetGenerate]; } -(void)targetGenerate { //code for the bullet to generate; CCSprite *bullet = … } -(void)update:(ccTime)dt { //code for to know intersection of bullet and player } But it was not working. How can I make the bullets to disappear after player won the game or enemy won the game ? Thank you.

    Read the article

  • curios about CCSpriteBatchNode's addchild method

    - by lzyy
    when diving into "learn cocos2d game development with ios5", in ch08 in EnemyCache.m -(id) init { if ((self = [super init])) { // get any image from the Texture Atlas we're using CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"monster-a.png"]; batch = [CCSpriteBatchNode batchNodeWithTexture:frame.texture]; [self addChild:batch]; [self initEnemies]; [self scheduleUpdate]; } return self; } so batch is with texture "monster-a.png" in EnemyEntity.m's initWithType method switch (type) { case EnemyTypeUFO: enemyFrameName = @"monster-a.png"; bulletFrameName = @"shot-a.png"; break; case EnemyTypeCruiser: enemyFrameName = @"monster-b.png"; bulletFrameName = @"shot-b.png"; shootFrequency = 1.0f; initialHitPoints = 3; break; case EnemyTypeBoss: enemyFrameName = @"monster-c.png"; bulletFrameName = @"shot-c.png"; shootFrequency = 2.0f; initialHitPoints = 15; break; default: [NSException exceptionWithName:@"EnemyEntity Exception" reason:@"unhandled enemy type" userInfo:nil]; } if ((self = [super initWithSpriteFrameName:enemyFrameName])) { //... } so the returned object may be in 3 different frame. since Only the CCSprites that are contained in that texture can be added to the CCSpriteBatchNode, obviously, 'monster-b.png' is not contained in 'monster-a.png', why the different enemy can still be added to the batch?

    Read the article

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

    - by Asen
    Hello there ! 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(b2Body *b = _world->GetBodyList(); b; b=b->GetNext()) { if (b-GetUserData() != NULL) { CCSprite *sprite = (CCSprite )b-GetUserData(); if (sprite.tag == 1) { b2Fixture f = b-GetFixtureList(); f-SetSensor(solid); } } } Where solid is bool. The first time when i change fixture to sensor everything is just fine but when i try to revert and change again to solid my app crashes with the following error : Assertion failed: (manifold-pointCount 0), function b2ContactSolver, file /Documents/myapp/libs/Box2D/Dynamics/Contacts/b2ContactSolver.cpp, line 58. Is it possible somehow to change fixture-SetSensor several times and if so ... how ? Any help is highly appreciated.

    Read the article

  • Create swipe controlled simple flipbook style animation in ObjC

    - by eco_bach
    Hi I am a beginner in Obj C development, though quite experienced (over 10 years) with other ECMAscript based languages and OOP development. I want to build a simple flipbook style animation, controlled through swiping motion. I'm sure extremely simple for any advanced ObjC coders. Can anyone with extensive ObjC-CocoaTouch experience give me some higher level recommendations? ie, 1 -general application design, should I start with a simple view based application, or navigation based or? 2 -should I use 3rd party animation frameworks such as Cocos2D, or stick with built in classes and methods? 3 -if using built in methods, classes, what is the recommended way of achieving a animation, that will be controlled via swipe and touch gestures? 4 -I want to eventually have multiple 'flipbooks' that I can 'instantly' swap with one another, ie to give the net effect of an object changing color, etc, but not sure how to approach this from a memory management point of view, related to #1 above Except for point 3 above, I'm not expecting any actual code examples. Just general guidelines to follow and perhaps, what are some next steps I should take in my goal as an ObjC code samurai.

    Read the article

  • How to stop the horizontal scrolling programmatically ?

    - by srikanth rongali
    I have a UITextView *textView in cocos2d's CCLayer. The text is scrolling in both the horizontal and vertical directions. But, I need it to scroll and bounce only in vertically. How to stop the horizontal scrolling programmatically ? UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(100,200, windowSize.height/2,windowSize.width/2)]; textView.backgroundColor = [UIColor clearColor]; textView.text = @"I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy I am First enemy"; [textView setEditable:NO]; textView.font = [UIFont fontWithName:@"Helvetica" size:24.0f]; CGPoint location = CGPointMake(200, 160); textView.showsHorizontalScrollIndicator = NO; //textView.bounces = NO; //textView.alwaysBounceVertical = YES; textView.center = location; textView.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS( 90.0f )); What should I do stop scrolling horizontally ? Thank You.

    Read the article

  • Problem of Sprites and labels are displayed by white boxes.

    - by srikanth rongali
    I am writing a game in cocos2d. I am using a function restartDirector in AppDelegate class. -(void)restartDirector{ [[CCDirector sharedDirector] end]; [[CCDirector sharedDirector] release]; if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] ) [CCDirector setDirectorType:CCDirectorTypeDefault]; [[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888]; [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888]; [[CCDirector sharedDirector] setAnimationInterval:1.0/60]; [[CCDirector sharedDirector] setDisplayFPS:YES]; [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft]; [[CCDirector sharedDirector] attachInView:window]; } This function I called in one of the game Scene . -(void)PracticeMethod:(id)sender { [MY_DELEGATE restartDirector]; CCScene *endPageScene = [CCScene node]; CCLayer *endPageLayer = [DummyScene node]; [endPageScene addChild:endPageLayer]; [[CCDirector sharedDirector] runWithScene:endPageScene]; // [[CCDirector sharedDirector] replaceScene:endPageScene]; } When used the replaceScene, there is no problem in game but the memory of abject allocation is high(I checked in leaks tool). So I used runWithScene. But , while using these when the scene DummyScene is loaded the sprites, labels in it are displayed by white boxes. I cannot see the sprites and labels. If I am using replaceScene everything thing is working fine but the memory allocation is high. this is my problem. Thank you.

    Read the article

  • iPad3 HD Black Screen in Portrait Orientation

    - by Jason Brooks
    I'm currently updating my game using XCode 4.3.1 and an iPad3. WHen iPAD HD mode is selected, I get a black screen when I change the scene from the AppDelegate. I'm using COCOS2d v1.0.1 My Game is portrait only mode, and I think I've tracked the problem down. If you create a new project with the default HelloWorld Layer, it works on the iPad3 and it's simulator in HD. However if you change the following code :- -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { ... #elif GAME_AUTOROTATION == kGameAutorotationUIViewController // // EAGLView will be rotated by the UIViewController // // Sample: Autorotate only in landscpe mode // // return YES for the supported orientations //return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) ); return ( UIInterfaceOrientationIsPortrait ( interfaceOrientation ) ); //return NO; ... } In RootViewController.m You see a black screen for the iPad3 real device and simulator. It works as expected on all devices, iPhone/iPod Touch, and iPad 1 and 2. If I change the statement back to return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) ); I get the Hello World rendered to the screen, but it is in landscape only on iPad3. Has anyone else encountered this and have any suggestions for a fix? The project is quite large to upgrade to the latest V1 Beta code.

    Read the article

  • How can I differentiate two different touches on a layer ?

    - by srikanth rongali
    I am writing an app in cocos2d. I hava a sprite and a text in my scene. I have written two separate classes for sprite and text. And I added both of them to another class. In sprite class I have written - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event And in text class I have written -(void) registerWithTouchDispatcher { [[CCTouchDispatcher sharedDispatcher]addTargetedDelegate:self priority:0 swallowsTouches:YES]; } -(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { return YES; } -(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event { NSLog(@"Recognized tOuches in Instructions");// CGSize windowSize = [[CCDirector sharedDirector] winSize]; CCNode *node = [self getChildByTag:kTagNode]; [node setPosition: ccp(text1.contentSize.width/2,text1.contentSize.height/2 - windowSize.height)]; } -(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint touchLocation = [touch locationInView: [touch view]]; CGPoint prevLocation = [touch previousLocationInView: [touch view]]; touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation]; prevLocation = [[CCDirector sharedDirector] convertToGL: prevLocation]; CGPoint diff = ccpSub(touchLocation,prevLocation); CCNode *node = [self getChildByTag:kTagNode]; CGPoint currentPos = [node position]; [node setPosition: ccpAdd(currentPos, diff)]; } But, only touches in the text are recognized and touch of sprite is not recognized ? How can I differentiate the two touches.

    Read the article

  • Square collision detection problem (iPhone).

    - by thyrgle
    Hi, I know I've probably posted three questions related to this then deleted them, but thats only because I solved them before I got an answer. But, this one I can not solve and I don't believe it is that hard compared to the others. So, with out further ado, here is my problem: So I am using Cocos2d and one of the major problem is they don't have buttons. To compensate for there lack in buttons I am trying to detect if when a touch ended did it collide with a square (the button). Here is my code: - (void)ccTouchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:touch.view]; NSLog(@"%f", 240-location.y); if (isReady == YES) { if (((240-location.y) <= (240-StartButton.position.x - 100) || -(240-location.y) >= (240-StartButton.position.x) + 100) && ((160-location.x) <= (160-StartButton.position.y) - 25 || (160-location.x) >= (160-StartButton.position.y) + 25)) { NSLog(@"Coll:%f", 240-StartButton.position.x); CCScene *scene = [PlayScene node]; [[CCDirector sharedDirector] replaceScene:[CCZoomFlipAngularTransition transitionWithDuration:2.0f scene:scene orientation:kOrientationRightOver]]; } } } Do you know what I am doing wrong?

    Read the article

  • iPhone app works hundreds of times, then crashes from memory error on startup, then never works unti

    - by peter
    I have a Cocos2d/openGL iPhone game. It's a universal app and I'm dealing with an occasional but nasty error on the iPad. We are loading a lot of textures up front (3 2048x2048 textures). I'm working on reducing this up front load, but what worries me is I really don't understand the root cause of this crash that permanently breaks the app. This is the deal: 1. App works fine for hundreds of plays on the iPad 2. Eventually (I'm guessing due to other programs using up some memory and not letting go or whatever) the app starts crashing on startup. It just closes again in the middle of loading. 3. The App will now never work again on that iPad, closing immediately every time, until the iPad is restarted. Obviously my app is demanding too much memory up front to work reliably every time, I get that. What I don't get is why when it fails once, it has failed forever until the iPad is restarted. Can anyone explain what is going on here? EDIT: forgot to add organizer crash lags just say low memory, like this every time (I changed my app name to MyAppName below). Again, I know it's low memory, but why does it stay low memory until restart?: Incident Identifier: E7A2507C-3FB1-4E3B-B315-09F094236541 CrashReporter Key: 0fda9d667f2c6073f20a76809aa25438b6854d15 OS Version: iPhone OS 3.2 (7B367) Date: 2010-04-30 16:59:44 -0400 Free pages: 437 Wired pages: 17228 Purgeable pages: 0 Largest process: MyAppName Processes Name UUID Count resident pages MyAppName <6307ce41802850944baa78d29224fa7f> 22385 (jettisoned) (active) mediaserverd <ea8bac28b06fe3980fdd44b5caceb563> 242 DTMobileIS <a0f651e43881e66f50f8a95abea72921> 5826 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 syslog_relay <4ceaed776d2df957fa130712f4ef21d0> 66 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 afcd <4f3c9566e33b4463f05603d990584e5d> 72 ptpd <83de0f774bd6553d513ae9e19b0f9b56> 181 syslogd <66247e305d5c0bf6f1ce1cc950653263> 81 lsd <a4d852c1c8da2b3d231bdc90887b52ba> 130 iapd <a8534cbde4b90ad5915dd26ab03ff3e3> 204 notifyd <5e9d5bee7c3eae1c8b494c79eb11406e> 71 BTServer <64e4a6ea6b1240db2331e05a29caa862> 108 CommCenter <97bf297944ac4bde19bcee96dd23bd5f> 181 SpringBoard <c7a5904c12db7b14334a4edaa4cabaa9> 5339 (active) configd <aca9fa3380322669164fd6b1a3864300> 373 fairplayd.K48 <2d997ffca1a568f9c5400ac32d8f0782> 84 locationd <dd1ea88105c62173908ce767db5c4d37> 599 mDNSResponder <820560222d47a1f2a0dce98a7f8a9721> 108 lockdownd <497fd54c79a680bf29f5d9320f514613> 303 MobileStorageMou <c277b79c2157c4dc5cfc5c3ca35bd5f2> 69 launchd <66972eee4d865c4383b33d985d22994b> 98 **End**

    Read the article

  • Global NSMutableArray doesn't seem to be holding values

    - by diatrevolo
    I have a Cocos2D iPhone application that requires a set of CGRects overlaid on an image to detect touches within them. "Data" below is a class that holds values parsed from an XML file. "delegateEntries" is a NSMutableArray that contains several "data" objects, pulled from another NSMutableArray called "entries" that lives in the application delegate. For some strange reason, I can get at these values without problems in the init function, but further down the class in question, I try to get at these values, and the application crashes without an error message (as an example, I put in the "ccTouchBegan" method which accessess this data through the "populateFieldsForTouchedItem" method. Can anyone see why these values would not be accessible from other methods? No objects get released until dealloc. Thanks in advance! @synthesize clicked, delegate, data, image, blurImage, normalImage, arrayOfRects, delegateEntries; - (id)initWithTexture:(CCTexture2D *)aTexture { if( (self=[super initWithTexture:aTexture] )) { arrayOfRects = [[NSMutableArray alloc] init]; delegateEntries = [[NSMutableArray alloc] init]; delegate = (InteractivePIAppDelegate *)[[UIApplication sharedApplication] delegate]; delegateEntries = [delegate entries]; data = [delegateEntries objectAtIndex:0]; NSLog(@"Assigning %@", [[delegateEntries objectAtIndex:0] backgroundImage]); NSLog(@"%@ is the string", [[data sections] objectAtIndex:0]); //CGRect rect; NSLog(@"Count of array is %i", [delegateEntries count]); //collect as many items as there are XML entries for(int i=0; i<[delegateEntries count]; i++) { if([[delegateEntries objectAtIndex:i] xPos]) { NSLog(@"Found %i items", i+1); [arrayOfRects addObject:[NSValue valueWithCGRect:CGRectMake([[[delegateEntries objectAtIndex:i] xPos] floatValue], [[[delegateEntries objectAtIndex:i] yPos] floatValue], [[[delegateEntries objectAtIndex:i] xBounds] floatValue], [[[delegateEntries objectAtIndex:i] yBounds] floatValue])]]; } else { NSLog(@"Nothing"); } } //remove the following once the NSMutableArray from above works (legacy) blurImage = [[NSString alloc] initWithString:[data backgroundBlur]]; NSLog(@"5"); normalImage = [[NSString alloc] initWithString:[data backgroundImage]]; clicked = NO; } return self; } And then: - (void)populateFieldsForTouchedItem:(TouchedRect)touchInfo { Data *touchDatum = [[Data alloc] init]; touchDatum = [[self delegateEntries] objectAtIndex:touchInfo.recordNumber]; NSLog(@"Assigning %@", [[[self delegateEntries] objectAtIndex:touchInfo.recordNumber] backgroundImage]); rect = [[arrayOfRects objectAtIndex:touchInfo.recordNumber] CGRectValue]; image = [[NSString alloc] initWithString:[[touchDatum sections] objectAtIndex:0]]; [touchDatum release]; } - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { TouchedRect touchInfo = [self containsTouchLocation:touch]; NSLog(@"Information pertains to %i", touchInfo.recordNumber); if ( !touchInfo.touched && !clicked ) { //needed since the touch location changes when zoomed NSLog(@"NOPE"); return NO; } [self populateFieldsForTouchedItem:touchInfo]; NSLog(@"YEP"); return YES; }

    Read the article

  • Keeping Velocity Constant and Player in Position - Sidescrolling

    - by user2904951
    I'm working on a Little Mobile Game with Cocos2D-X and Box2D. The Point where I got stuck is the movement of a box2d-body (the main actor) and the according Sprite. Now I want to : move this Body with a constant velocity along the x-axis, no matter if it's rolling (it's a circleshape) upwards or downwards keep the body nearly sticking to the ground on which it's rolling keep the Body and the according Sprite in the Center of the Screen. What I tried : in the update()- method I used body->SetLinearVelocity(b2Vec2(x,y)) to higher/lower values, if the Body was passing a constant value for his velocity I used to set very high y-Values in body->SetLinearVelocity(b2Vec2(x,y)) First tried to use CCFollow with my playerSprite, which was also Scrolling along the y-axis, as i only need to scroll along the x-axis, so I decided to move the whole layer which is containing the ambience (platforms etc.) to the left of my Screen and my Player Body & Player sprite to the right of the Screen, adjusting the speed values to Keep the Player in the Center of the Screen. Well... ...didn't work as i wanted it to, because each time i set the velocity manually (I also tried to use body->applyLinearImpulse(...) when the Body is moving upwards just as playing around with the value of velocityIterations in world->Step(...)) there's a small delay, which pushes the player Body more or less further of the Center of the Screen. ... didn't also work as I expected it to, because I needed to adjust the x-Values, when the Body was moving upwards to Keep it not getting slowed down, this made my Body even less sticky to the ground.... ... CCFollow did a good Job, except that I didn't want to scroll along the y-axis also and it Forces the overgiven sprite to start in the Center of the Screen. Moving the whole Layer even brought no good results, I have tried a Long time to adjust values of the movement Speed of the layer and the Body to Keep it negating each other, that the player stays nearly in the Center of the Screen.... So my question is : Does anyone of you have any Kind of new Approach for me to solve this cohesive bunch of Problems ? Cheers, Seb

    Read the article

  • How to edit .doc file in iPhone

    - by Ekra
    H Friends, I want to edit the .doc files in iPhone and retain its format. I know its possible as many applications like "Documents to go" supports this. I am able to view this type of files currently. Any hint in right direction would be highly appreciated. Thanks in advance

    Read the article

  • CGContext - PDF margin

    - by Manoj Khaylia
    Hi All I am showing PDF content on a view using this code using Quartz Sample // PDF page drawing expects a Lower-Left coordinate system, so we flip the coordinate system // before we start drawing. CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1.0, -1.0); // Grab the first PDF page CGPDFPageRef page = CGPDFDocumentGetPage(pdf, pageNo); // We're about to modify the context CTM to draw the PDF page where we want it, so save the graphics state in case we want to do more drawing CGContextSaveGState(context); // CGPDFPageGetDrawingTransform provides an easy way to get the transform for a PDF page. It will scale down to fit, including any // base rotations necessary to display the PDF page correctly. CGAffineTransform pdfTransform = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, self.bounds, 0, true); // And apply the transform. CGContextConcatCTM(context, pdfTransform); // Finally, we draw the page and restore the graphics state for further manipulations! CGContextDrawPDFPage(context, page); CGContextRestoreGState(context); Using this all works fine I want to set the margin for the PDF context, bydefault it showing 50 px margin in every side.. I have tried CGContext methods but not got the appropriate one. Can any body help me regarding this Thanks Monaj

    Read the article

  • Iphone openGlES models

    - by Gedeon
    Hi everybody What is best software for creating models , textures etc... for iphone development. From simplest to more complex programs. First thing that comes to my mind is blender , but I'm curious what everybody else is using and their opinions.

    Read the article

  • How to let the CCSprite handles Touch event?

    - by Tattat
    I created my OwnCCSprite, and it get the implemented CCStandardTouchDelegate protocol, and ccTouchesBegan event. But it seems not working. When I click the CCSprite, the ccTouchesBegan in the CCLayer is called, but the CCSprite's ccTouchesBegan can't called. How can I detect the CCSprite is being touched in CCLayer / OwnCCSprite? or I need to calculate the touch position, and compares it to the OwnCCSprite positions? Thz.....

    Read the article

  • Tranparent animated image in webview

    - by Amit Battan
    Hi All I am using animated image (gif image) in webview but problem is that it showing while background for transparent image. even I set the background color of webview is transparent. Is any way to do it transparent or any other way to show transparent animated image in Iphone SDk Thanks Amit Battan

    Read the article

  • Why the CCLayer can't use a for loop in draw method??

    - by Tattat
    I have a CClayer, that have a draw method, every second, it will call the draw method 60 times. So, I have method like this: -(void)draw{ glEnable(GL_LINE_SMOOTH); glColor4f(0.0f, 1.0f, 0.0f, 1.0f); glLineWidth(5.0f); ccDrawLine(ccp(300,20), CGPointZero); } I work great. but after I added a for looop, for example....: -(void)draw{ glEnable(GL_LINE_SMOOTH); glColor4f(0.0f, 1.0f, 0.0f, 1.0f); glLineWidth(5.0f); ccDrawLine(ccp(300,20), CGPointZero); for(int i=0; i<5; i++){ NSLog(@"Testing the loop, %i", i); } } It can't draw anything, the screen only black. But I can see the Testing the loop is keep calling.... Why? thank you.

    Read the article

  • Car physics in Chipmunk

    - by Richard Caetano
    Has anyone had experience with implementing car physics in chipmunk? Here's an example in Box2d: http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/ I'd like to port that over to chipmunk.

    Read the article

  • Implement looped movement animation with tap to cancel

    - by Nader
    Hi All; My app is based around a grid and an image that moves within a grid that is contained within a scrollview. I have an imageview that I am animating from one cell to another in time with a slow finger movement and recentering the scrollview. That is rather straight forward. I have also implement the ability to detect a swipe and therefore move the image all the way to the end of the grid and the uiscrollview recentering. I have even implemented the ability to detect a subsequent tap and freeze the swiped movement. The issue with the swipe movement is that the UIScrollView will scroll all the way to the end before the Image reaches the end and so I have to wait for the image to arrive. Also, when I freeze the movement of the image, I have to re-align the image to a cell (which I can do). I have come to the realization that I have to animate the image one cell at a time for swipes and recentering the uiscrollview before moving the image to the next cell. I have attempted to implement this but I cannot come up with a solution that works or works properly. Can anyone suggest how I go about implementing this? Even if you are able to put up code from a different example or sudo code, it would help a lot as I cannot workout how this should be done, should I be using selectors, a listener in delegates, I just simply lack the experience to solve this design pattern. Here is some code: Note that the sprite is an UIImageView - (void)animateViewToPosition:(SpriteView *)sprite Position:(CGPoint)pos Duration:(CFTimeInterval)duration{ CGMutablePathRef traversePath = CGPathCreateMutable(); CGPathMoveToPoint(traversePath, NULL, sprite.center.x, sprite.center.y); CGPathAddLineToPoint(traversePath, NULL, pos.x, pos.y); CAKeyframeAnimation *traverseAnimation = [CAKeyframeAnimation animationWithKeyPath:kAnimatePosition]; traverseAnimation.duration = duration; traverseAnimation.removedOnCompletion = YES; traverseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; traverseAnimation.delegate = sprite; traverseAnimation.path = traversePath; CGPathRelease(traversePath); [sprite.layer addAnimation:traverseAnimation forKey:kAnimatePosition]; sprite.center = pos; }

    Read the article

  • Implement looped movement animation with tap to cancel

    - by Nader
    Hi All; My app is based around a grid and an image that moves within a grid that is contained within a scrollview. I have an imageview that I am animating from one cell to another in time with a slow finger movement and recentering the scrollview. That is rather straight forward. I have also implement the ability to detect a swipe and therefore move the image all the way to the end of the grid and the uiscrollview recentering. I have even implemented the ability to detect a subsequent tap and freeze the swiped movement. The issue with the swipe movement is that the UIScrollView will scroll all the way to the end before the Image reaches the end and so I have to wait for the image to arrive. Also, when I freeze the movement of the image, I have to re-align the image to a cell (which I can do). I have come to the realization that I have to animate the image one cell at a time for swipes and recentering the uiscrollview before moving the image to the next cell. I have attempted to implement this but I cannot come up with a solution that works or works properly. Can anyone suggest how I go about implementing this? Even if you are able to put up code from a different example or sudo code, it would help a lot as I cannot workout how this should be done, should I be using selectors, a listener in delegates, I just simply lack the experience to solve this design pattern. Here is some code: Note that the sprite is an UIImageView - (void)animateViewToPosition:(SpriteView *)sprite Position:(CGPoint)pos Duration:(CFTimeInterval)duration{ CGMutablePathRef traversePath = CGPathCreateMutable(); CGPathMoveToPoint(traversePath, NULL, sprite.center.x, sprite.center.y); CGPathAddLineToPoint(traversePath, NULL, pos.x, pos.y); CAKeyframeAnimation *traverseAnimation = [CAKeyframeAnimation animationWithKeyPath:kAnimatePosition]; traverseAnimation.duration = duration; traverseAnimation.removedOnCompletion = YES; traverseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; traverseAnimation.delegate = sprite; traverseAnimation.path = traversePath; CGPathRelease(traversePath); [sprite.layer addAnimation:traverseAnimation forKey:kAnimatePosition]; sprite.center = pos;

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23  | Next Page >