Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 32/196 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • What is the correct way to implement hit detection with non-rectangular sprites?

    - by hogni89
    What is the correct way to implement hit or touch detection for non-rectangular sprites in Cocos2d? I am working on a jigsaw puzzle, so our sprites have some strange forms (jigsaw puzzle bricks). As of now, we have implemented the "detection" this way: - (void)selectSpriteForTouch:(CGPoint)touchLocation { CCSprite * newSprite = nil; // Loop array of sprites for (CCSprite *sprite in movableSprites) { // Check if sprite is hit. // TODO: Swap if with something better. if (CGRectContainsPoint(sprite.boundingBox, touchLocation)) { newSprite = sprite; break; } } if (newSprite != selSprite) { // Move along, nothing to see here // Not the problem } } - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint touchLocation = [self convertTouchToNodeSpace:touch]; [self selectSpriteForTouch:touchLocation]; return TRUE; } I know that the problem is in the keyword "sprite.boundingBox". Is there a better way of implementing this, or is it a limitation when using sprites based on .png's? If so, how should I proceed?

    Read the article

  • What is the the best way to become an iPhone developer?

    - by Noah89
    I have no experience as a programmer but I'd like to become a iPhone developer. Some people tell me to learn java because it is a Object Oriented Language. Other people tell me to go with C++. However, everyone advises me to actually learn any language and learn what programming is all about before I actually develop for iPhone. Please, let me know what would be the best choice and what books would be good for a total beginner and any website that offers any good tutorials. Thanks in advance for all the feedback.

    Read the article

  • Touching a CGRect

    - by Coder404
    In my cocos2d app I am trying to determine when a CCSprite is touched Here is what I have: -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{ NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init]; for (CCSprite *target in _targets) { CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2), target.position.y - (target.contentSize.height/2), 27, 40); CGPoint touchLocation = [self convertTouchToNodeSpace:touch]; if (CGRectContainsPoint(targetRect, touchLocation)) { NSLog(@"Moo cheese!"); } } return YES; } For some reason it does not work. Can someone help me?

    Read the article

  • Managing large downloadable content on mobile devices

    - by larromba
    This is a general question of how to best manage large downloadable content on mobile devices. Lets consider a situation whereby a mobile app needs to download a number of very large content items, like HD videos, that are over 500MB but under 2GB. Now, lets assume this content delivery system should be scalable. Would it be a fair assumption that: A reputable cloud service would be needed - if so, what is a reliable and cost effective cloud service for mobile devices based on anyone's experience? Large content downloads should only be attempted over a wifi connection, so the end user doesn't incur large costs, e.g. when travelling. Downloads should carry on in the background if possible, as the user won't want to wait in an app for long periods. If the downloads don't finish, or the OS quits the app, all downloads should carry on when the app is next activated? Are there any other pitfalls anyone may have experienced when managing large content on mobile devices? Thanks.

    Read the article

  • Best strategy for supporting multiple server communication from iPhone/android app?

    - by tipycalFlow
    I'm making an app that will be used in multiple hospitals in the US. As per HIPAA compliance requirement, every hospital will have its own server that complies with these requirements of ensuring patient data security, etc. Now the task is that the app should communicate with a particular server based on the login info. An additional requirement is that new hospitals(servers) are likely to be added along the way, even after the app is available on the market. So basically, according to some login credentials, the app should communicate with the server of the hospital assigned to that person. One pretty crude way is to set up our own server which links the hospitals with the login info and accordingly, provides a base-url for data exchange. Is there a more efficient way to handle this?

    Read the article

  • Do you prefer building your interfaces in IB or programmatically? and why?

    - by LolaRun
    I've been using Xcode and building iPhone apps for two months, but I'm finding it really hard to grasp good application design. I always face problems—like you can't put your tabbarcontroller in another custom viewcontroller, for example—that 'sometimes', of course, would work if you did the creation of the views/viewcontrollers programmatically. So I don't know if I should start writing the creation of my objects or use Interface Builder. What are your experiences?

    Read the article

  • Designing object oriented programming

    - by Pota Onasys
    Basically, I want to make api calls using an SDK I am writing. I have the following classes: Car CarData (stores input values needed to create a car like model, make, etc) Basically to create a car I do the following: [Car carWithData: cardata onSuccess: successHandler onError: errorHandler] that basically is a factory method that creates instance of Car after making an API call request and populating the new Car class with the response and passes that instance to the successHandler. So "Car" has the above static method to create that car, but also has non-static methods to edit, delete cars (which would make edit, delete API calls to the server) So when the Car create static method passes a new car to the successHandler by doing the following: successHandler([[Car alloc] initWithDictionary: dictionary) The success handler can go ahead and use that new car to do the following: [car update: cardata] [car delete] considering the new car object now has an ID for each car that it can pass to the update and delete API calls. My questions: Do I need a cardata object to store user inputs or can I store them in the car object that would also later store the response from all of the api calls? How can I improve this model? With regards to CarData, note that there might be different inputs for the different API calls. So create function might need to know model, make, etc, but find function might need to know the number of items to find, the limit, the start id, etc.

    Read the article

  • Copies of GameScene created when called additional times

    - by Orin MacGregor
    I have a game with a level select managed by a SceneManager, which basically just uses ReplaceScene. The first time I load a level everything works fine. On subsequent calls, for example: completing the level and continuing to the next, things blow up. The level loads fine, but when I try to pan the map or try to move the player the game crashes. Debugging through I found that there are multiple occurrences of self and related children like player and mapLayer. As a test, I put this code in my ccTouchesBegan: NSLog(@"test %i", [self retainCount]); The first time a level is loaded, it gives: test 2 The second time I load a level it gives: test 2 test 1 as in it spits out both values by looping through twice, not just appending an output to the last. It continues with this pattern for each subsequent load. So the third time will give 2 1 1. Particular code that causes the game to crash involve calling _tileMap.tileSize because there is a second GameScene with a tileMap that was supposedly destroyed, so it has tileSize and mapSize of 0. I noticed dealloc doesn't really ever get called, so I tried to manage some things with -(void) onExit -(void) onExit { [self unscheduleAllSelectors]; [_player stopAllActions]; //stop any animations just in case. normally handled in ccTouchesEnded [self removeAllChildrenWithCleanup:YES]; } I never replace the GameScene while I'm in a GameScene; if the level is completed it goes to a GameOver scene, or I use a back button that goes to the LevelSelect scene. This is [the relevant parts of] my init, in case something like the adding of children matters: -(id) init { _mapLayer = [CCLayer node]; //load data for level GameData *gameData = [GameDataParser loadData]; int selectedChapter = gameData.selectedChapter; int selectedLevel = gameData.selectedLevel; Levels *chapterLevels = [LevelParser loadLevelsForChapter:selectedChapter]; //loop until we get selected level, then do stuff for (Level *level in chapterLevels.levels) { if (level.number == selectedLevel) { //load the level map _tileMap = [CCTMXTiledMap tiledMapWithTMXFile:level.file]; } } _background = [_tileMap layerNamed:@"Background"]; _foreground = [_tileMap layerNamed:@"Foreground"]; _meta = [_tileMap layerNamed:@"Meta"]; _meta.visible = NO; //initialize Spawn Point object and place player there CCTMXObjectGroup *objects = [_tileMap objectGroupNamed:@"Objects"]; NSAssert(objects != nil, @"'Objects' object group not found"); NSMutableDictionary *spawnPoint = [objects objectNamed:@"SpawnPoint"]; NSAssert(spawnPoint != nil, @"SpawnPoint object not found"); int x = [[spawnPoint valueForKey:@"x"] intValue] / retinaScaling; int y = [[spawnPoint valueForKey:@"y"] intValue] / retinaScaling; //setup animations [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"MouseRightAnim_24x21.plist"]; CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"MouseRightAnim_24x21.png"]; [_mapLayer addChild:spriteSheet z:1]; NSMutableArray *rightAnimFrames = [NSMutableArray array]; for(int i = 1; i <= 3; ++i) { [rightAnimFrames addObject: [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"MouseRight%d_24x21.png", i]]]; } CCAnimation *rightAnim = [CCAnimation animationWithSpriteFrames:rightAnimFrames delay:0.1f]; self.player = [CCSprite spriteWithSpriteFrameName:@"MouseRight2_24x21.png"]; _player.position = ccp(x, y); self.rightAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:rightAnim]]; rightAnim.restoreOriginalFrame = NO; [spriteSheet addChild:_player]; //get map size in pixels mapHeight = _tileMap.contentSize.height; mapWidth = _tileMap.contentSize.width; //setup defaults //this value works well for the calculation later, trial and error really distance = 150; lastGoodDistance = 150; mapScale = 1; [self setViewpointCenter:_player.position]; [_mapLayer addChild:_tileMap]; [self addChild:_mapLayer z:-1]; self.isTouchEnabled = YES; } return self; } And here's the SceneManager code for replacing scenes: +(void) goGameScene { CCLayer *gameLayer = [GameScene node]; [SceneManager go:gameLayer:[GameHUD node]]; } //this is what every call looks like besides the GameScene one above +(void) goLevelSelect { [SceneManager go:[LevelSelect node]:nil]; } +(void) go:(CCLayer *)layer: (CCLayer *)hudLayer { CCDirector *director = [CCDirector sharedDirector]; CCScene *newScene = [SceneManager wrap:layer:hudLayer]; if ([director runningScene]) { [director replaceScene:newScene]; } else { [director runWithScene:newScene]; } } +(CCScene *) wrap:(CCLayer *)layer: (CCLayer *)hudLayer { CCScene *newScene = [CCScene node]; [newScene addChild: layer]; if (hudLayer != nil) { [newScene addChild: hudLayer z:1]; } return newScene; } Any ideas why I'm getting these fatal artifacts? I'm hoping this isn't considered too localized since it basically combines 3 tutorials that anyone could end up following. (Ray Wenderlich Animations, Tim Roadley Scene Manager, Pan and Zoom with Tiled Maps.

    Read the article

  • Apple WWDC : la Beta d'iOS 6 disponible en téléchargement pour les développeurs, plus de 200 nouvelles fonctionnalités

    Apple WWDC : la Beta d'iOS 6 disponible en téléchargement Pour les développeurs, plus de 200 nouvelles fonctionnalités Apple vient de présenter iOS 6 à la keynote d'ouverture de la WWDC, sa conférence annuelle pour développeurs. En Beta, cette nouvelle itération du système d'exploitation mobile est téléchargeable gratuitement à la condition d'avoir un compte iOS Developer et d'y associer l'appareil hôte. Retour sur les nouveautés présentées par Scott Forstall, vice président senior du software pour iPhone : iOS 6 est notamment marquée par une rupture avec Google pour tout ce qui est cartographie. Apple coupe le cordon avec Google Maps en faveur de sa propre applicat...

    Read the article

  • Exporting spritesheet for Cocos2d

    - by Terko
    I would like to know how people usually save the animations in order to load them easily in Cocos2d with as few hard-code as possible. E.G. The solution I thought of is to have one plist file containing information about each frame, and the second plist to contain information about each of the animation(name of the animation, which frames to play, and the delay probably). If this is the correct solution, how can I generate such plist files for spritesheet automatically?

    Read the article

  • What is the the best way to become an iPhone developer?

    - by Noah89
    I have no experience as a programmer but I'd like to become a iPhone developer. Some people tell me to learn java because it is a Object Oriented Language. Other people tell me to go with C++. However, everyone advises me to actually learn any language and learn what programming is all about before I actually develop for iPhone. Please, let me know what would be the best choice and what books would be good for a total beginner and any website that offers any good tutorials.

    Read the article

  • Cocos2D - Detecting collision

    - by Grace
    I am a beginner in cocos2d and im facing a problem with detecting collision for my coins. Sometimes it works sometimes it doesn't. So basically, im creating a game which the user (ship) have to avoid the obstacles and collect coins on the way. The collision of the obstacle works well but not for the coins. I was thinking maybe the loops for creating many coins is the problem but im not sure. Can anyone help? My codes: - (void)update:(ccTime)dt{ double curTime = CACurrentMediaTime(); if (curTime > _nextBridgeSpawn) { float randSecs = [self randomValueBetween:3.0 andValue:5.0]; _nextBridgeSpawn = randSecs + curTime; float randX = [self randomValueBetween:50 andValue:500]; float randDuration = [self randomValueBetween:8.0 andValue:10.0]; CCSprite *bridge = [_bridge objectAtIndex:_nextBridge]; _nextBridge++; if (_nextBridge >= _bridge.count) _nextBridge = 0; [bridge stopAllActions]; bridge.position = ccp(winSize.width/2, winSize.height); bridge.visible = YES; [bridge runAction:[CCSequence actions: [CCMoveBy actionWithDuration:randDuration position:ccp(0, -winSize.height)], [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]]; this is where i declare my coins (continued from the update method) int randCoin = [self randomValueBetween:0 andValue:5]; _coin = [[CCArray alloc] initWithCapacity:randCoin]; for(int i = 0; i < randCoin; ++i) { coin = [CCSprite spriteWithFile:@"coin.png"]; coin.visible = NO; [self addChild:coin]; [_coin addObject:coin]; } float randCoinX = [self randomValueBetween:winSize.width/5 andValue:winSize.width - (border.contentSize.width *2)]; float randCoinY = [self randomValueBetween:100 andValue:700]; float randCoinPlace = [self randomValueBetween:30 andValue:60]; for (int i = 0; i < _coin.count; ++i) { CCSprite *coin2 = [_coin objectAtIndex:i]; coin2.position = ccp(randCoinX, (bridge.position.y + randCoinY) + (randCoinPlace *i)); coin2.visible = YES; [coin2 runAction:[CCSequence actions: [CCMoveBy actionWithDuration:randDuration position:ccp(0, -winSize.height-2000)], [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]]; } } this is to check for collision (also in the update method) for (CCSprite *bridge in _bridge) { if (!bridge.visible) continue; if (CGRectIntersectsRect(ship.boundingBox, bridge.boundingBox)){ bridge.visible = NO; [ship runAction:[CCBlink actionWithDuration:1.0 blinks:5]]; } } } //this is the collision for coins which only work at times for (CCSprite *coin2 in _coin) { if (!coin2.visible) continue; if (CGRectIntersectsRect(ship.boundingBox, coin2.boundingBox)) { NSLog(@"Coin collected"); coin2.visible = NO; } } } Thank you.

    Read the article

  • Adding gesture recognizer (or dragging) to CCSprite

    - by user339946
    I'm trying to allow a CCSprite to be dragged across the screen. I've succeeded so far by doing it on a Layer level (from this tutorial). However, this only allows ONE sprite to be dragged at a time as the method implementation can only identify a single sprite to move at a time. I'd like to be able to perhaps add a gesture recognizer or somehow implement ccTouchesBegan/Moved in my own little CCSprite subclass. However, from what I understand, you can't just add gesture recognizers to CCSprites. ccTouchMoved are also not available on CCSprites?? Really confused as to how to implement touches on Cocos2D. What is the easiest way to add some position translation code to a CCSprite so it can be dragged around? Thanks!

    Read the article

  • World orientation in OpenGLES clarification

    - by Dev2rights
    I have a 3d tile map made up of individual billboards in OpenGLES. Each is a 2 triangles mesh and has a 3D Vector to determine its position and another defining its rotation from the origin at (0,0,0). Im trying to work out how to rotate the entire tile map around a point be that the origin or some arbitrary point in space. Im guessing i need to set up a Model Matrix instead for each tile. Then set up a world matrix for the world. Then on updating i would translate the world matrix and change the orientation and multiply it with each model matrix before rendering. Is this correct ?

    Read the article

  • Policies for deciding which mobile devices/OS versions to support? [on hold]

    - by bobfet1
    When developing for mobile devices, what are some strategies to go about determining which mobile devices and OS versions to support? Do some teams set a certain policy in place, like "support devices used by more than 2% of users" or "support OS versions with over 10% of users?" For example, a reoccurring challenge I am running into is the decision whether to support only new OS versions like iOS7 or KitKat, or continue support for older versions. It would be helpful to know how others approach this decision.

    Read the article

  • Xamarin 3 disponible en téléchargement, permet la construction d'UIs natives iOS, Android et Windows depuis une seule base de code commune en C#

    Xamarin 3 disponible en téléchargement, permet la construction d'UIs natives iOS, Android et Windows depuis une seule base de code commune en C# La troisième mouture de l'environnement de développement mobile multiplateformes Xamarin est désormais disponible. Parmi les nouveautés qui accompagnent cette version figure l'arrivée de Xamarin Designer pour iOS, un puissant outil de conception visuel pour la plateforme iOS qui permettra aux développeurs de mettre rapidement sur pied des interfaces...

    Read the article

  • Where actually did they spend money? [on hold]

    - by WannabeProgrammer
    I am a total beginner in the field of game development. Every time I saw or read an interview session with any indie developer they mention about the amount of money they spend on developing a game. I want to know where exactly did they spend the money ? Just imagine that you are making a game for mobile devices from scratch , where and all will you be spending your money to make one ? Is it possible to make games for mobile devices without spending any ? If yes , then it makes more sense for a indie game developer who is talented but comes from a very weak financial background. Thank you.

    Read the article

  • How to find collision detection side between two objects?

    - by user2362369
    I am using box2D and I have two objects, one is bouncy ball and the other one is block. I'd like to find which side of the block is collided with, so I can only make the ball bounce when it hits the top. I tried to implement many things like fixture data and by detecting position, using manifold but not get the accurate result. I also tried to calculate distance between two object but all went wrong.

    Read the article

  • Cocos2d push scene with parameter, the parameter is reset after push. How to troubleshoot? Thoughts?

    - by user72693
    In the helloWorldLayer.m, I push a scene with some parameter like this [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:0.2 scene:[RootLayer sceneWithInt:123]]]; where the RootLayer I have a modified method +(CCScene *) sceneWithInt:(int) i{ CCScene *scene = [CCScene node]; GameplayLayer *layer = [[GameplayLayer node] retain]; [layer setTestInt:i]; [scene addChild: layer z:0 tag:100]; return scene; } In the above, the "GameplayLayer" has an Int property "TestInt" which I would like to set it before this layer is push. However, the moment the GameplayLayer is loaded, that TestInt property is reset to 0. It is not passing correctly. I remember in my last project this can be done. How to troubleshoot this?

    Read the article

  • Directional Lights

    - by Setrio
    I'm working on a game idea (2D) that needs directional lights. Basically I want to add light sources that can be moved and the light rays interact with the other bodies on the scene. What I'm doing right now is some test where using sensors (box2d) and ccDrawLine I could achieve something similar to what I want. Basically I send a bunch of sensors from certain point and with raycast detect collisions, get the end points and draw lines over the sensors. Just want to get some opinions if this is a good way of doing this or is other better options to build something like this? Also I would like to know how to make a light effect over this area (sensors area) to provide a better looking light effect. Any ideas?

    Read the article

  • WWDC : Apple dévoile iOS 8 avec son SDK qui introduit plus de 4 000 nouvelles API, la version bêta disponible pour les développeurs

    WWDC : Apple dévoile iOS 8 avec son SDK qui introduit plus de 4 000 nouvelles API la version bêta disponible pour les développeursLe WWDC bat son plein. Apple a présenté lors de son événement dédié aux développeurs la prochaine version majeure de son système d'exploitation pour mobile iOS.iOS 8 introduit un nombre important de nouvelles fonctionnalités et améliorations pour séduire encore plus les fans des iDevices qui reposent sous le système d'exploitation.Son centre de notifications a été revu...

    Read the article

  • Organize a game set

    - by jncunha
    I'm developing a endless running game and I'm not really sure on how to make the set. The first approach was to make a BIG set like 10240x3072 pixels so that we have a nice portion of set. After having like 3 or 4 sets that go along with each other I would work on making their elements sequential and repeatable. However this is getting really heavy for the iPad 1 (it's running good in the iPad 2 and the New iPad) even though I'm splitting all the set in slices through Photoshop. For the implementation I'm using Cocos2D. Is there any better approach to make something like this but truly efficient for the iPad memory? Thank you.

    Read the article

  • Avoid loading unnecessary data from db into objects (web pages)

    - by GmGr
    Really newbie question coming up. Is there a standard (or good) way to deal with not needing all of the information that a database table contains loaded into every associated object. I'm thinking in the context of web pages where you're only going to use the objects to build a single page rather than an application with longer lived objects. For example, lets say you have an Article table containing id, title, author, date, summary and fullContents fields. You don't need the fullContents to be loaded into the associated objects if you're just showing a page containing a list of articles with their summaries. On the other hand if you're displaying a specific article you might want every field loaded for that one article and maybe just the titles for the other articles (e.g. for display in a recent articles sidebar). Some techniques I can think of: Don't worry about it, just load everything from the database every time. Have several different, possibly inherited, classes for each table and create the appropriate one for the situation (e.g. SummaryArticle, FullArticle). Use one class but set unused properties to null at creation if that field is not needed and be careful. Give the objects access to the database so they can load some fields on demand. Something else? All of the above seem to have fairly major disadvantages. I'm fairly new to programming, very new to OOP and totally new to databases so I might be completely missing the obvious answer here. :)

    Read the article

  • Returning an integer from a select box - JavaScript

    - by Ross
    Very simply, I want to be able to access the year from the select box as an integer. In my test, my alertbox is telling me the value is undefined. <form name="form1" method="post" action=""> <label>birth year <select name="birth year" id="dueYear"> <OPTION VALUE='' SELECTED>--Year--</OPTION> <OPTION VALUE='2011'>2011</OPTION> <OPTION VALUE='2010'>2010</OPTION> <OPTION VALUE='2009'>2009</OPTION></SELECT> </select> </label> </form> <script type="text/javascript"> var dueDateYear = parseInt(document.getElementById("dueYear")); </script> <button onclick="alert(dueDateYear)">Click Me!</button> All I want it to do, is tell me the year I have selected -- any help would be appreciated, I am a newbie :(

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >