cocos2d-iphone

What is the general architecture of an endless runner game?

天涯浪子 提交于 2019-12-23 03:11:05
问题 I am confused as to how endless runner games actually work, conceptually, as far as having a never-ending canvas. Sprite Kit is under NDA, so I am going to use Cocos2D as my framework. There are some tutorials on the web that are specific to other languages, and tools, but I just need to figure out basically: If I create a scene with a specific size, how do I create the illusion of a never-ending background? Do I just animated backgrounds behind the scene, or do I somehow dynamically add

cocos2d-android: how to display score

谁说胖子不能爱 提交于 2019-12-23 01:43:51
问题 I added CCLabel in my update method to display my game score. It works well before score raise to 5000. After that logCat shows the messege: 02-08 11:47:37.476: E/dalvikvm-heap(4190): 1048576-byte external allocation too large for this process. 02-08 11:47:37.476: E/dalvikvm(4190): Out of memory: Heap Size=14343KB, Allocated=13585KB, Bitmap Size=2078KB java.lang.reflect.InvocationTargetException...... caused by java.lang.OutOfMemoryError My code is: countScore++ ; Log.e("total Score:", "" +

CCShaky3D turns the background black

时光怂恿深爱的人放手 提交于 2019-12-22 18:15:39
问题 I'm trying to make my sprite have a shake effect. However, while the sprite does shake, the entire background turns black. Can anybody help me with this? Here's the code that I've written to add the sprite to my layer along with the action that I run right after. CCSprite * picture = [CCSprite spriteWithFile:@"picture.png"]; picture.position = ccp(winsize.width/4, picture.contentSize.height * 0.8); [self addChild:picture]; CCShaky3D * shake = [CCShaky3D actionWithRange:4 shakeZ:NO grid:ccg(12

Count the number of times a method is called in Cocoa-Touch?

前提是你 提交于 2019-12-22 18:10:32
问题 I have a small app that uses cocos2d to run through four "levels" of a game in which each level is exactly the same thing. After the fourth level is run, I want to display an end game scene. The only way I have been able to handle this is by making four methods, one for each level. Gross. I have run into this situation several times using both cocos2d and only the basic Cocoa framework. So is it possible for me to count how many times a method is called? 回答1: Can you just increment an

How do i use cocos2d with Xcode?

元气小坏坏 提交于 2019-12-22 16:47:07
问题 I downloaded the lastest version of cocos2d but I am confused as to how to use it with my current project. Can anyone show me how to use it with xcode. I'm looking to design a 2D maze. Do i have to import something ? Any sort of help would be appreciated. 回答1: Yes, you need to drag the cocos2d files into your project, then they will be available. This is a very helpful step-by-step resource on how to do that. http://monoclestudios.com/cocos2d_whitepaper.html As far as designing your game, get

Cocos2d, iOS: what is the correct way to remove sprites from cache?

*爱你&永不变心* 提交于 2019-12-22 14:57:08
问题 I got a GameScene class that is not a singleton instance. Hence I allocate and deallocate it every time the user chooses a new level and keep the "static"/"shared" data in a different singleton class (E.g. GameManager). I am using ARC . I would like to understand if my approach is correct under the memory management point of view. In other words, is it enough to call "removeUnusedSpriteFrames" at cleanup? Will this remove all sprites in game-art-forLevelOne-hd.plist? Should I do something

how to determine when specific animation frames are running

不羁岁月 提交于 2019-12-22 13:56:59
问题 I would like to know when certain frames of an animation are running in order to set various conditions. In the code below, how can I use a counter or set conditions to determine when specific animation frames, say 3rd and 8th are currently running? NSMutableArray *frameArray = [NSMutableArray array]; for(int i = 1; i < 12; i++) { CCLOG(@"item %d added", i); [frameArray addObject: [birdSpriteFrameCache spriteFrameByName: [NSString stringWithFormat:@"Sprite%d.png", i]]]; } //Starting the

How to add Animated Image In Cocos2D without use of TexturePacker?

烈酒焚心 提交于 2019-12-22 13:56:36
问题 I am New at iOS Development. I am also starting to learn Cocos2D. I've read this tutorial: http://www.raywenderlich.com/tutorials#cocos2d It is a superb tutorial for beginners, but I'm also interested in animating the image. How can I accomplish animation? So I read tutorial (describe from Above Link) about how to put animated image with simple Project. In This tutorial I used TexturePacker and it's working... but I want to know more about how to animate images without using TexturePacker .

Authenticate with Google App Engine from an Iphone Native Client

纵饮孤独 提交于 2019-12-22 13:54:03
问题 I want to create an Iphone game where users can log in with their facebook credentials and authenticate with my server running on Google App Engine. I have gotten Facebook connect working on both the iPhone and Google App Engine. However, it seems that Facebook connect for the iPhone only authenticates you with Facebook's server and allows you to access the Facebook Api from . The reason I want to do this, is so that I can store extra user data associated with a user account on GAE, but also

CocosDenshion music fade out

折月煮酒 提交于 2019-12-22 12:36:11
问题 I'm using cocos denshion for the music in my game. I'm currently playing background music with the code: [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"backSong.mp3"]; However, when the game ends, I need the background music to fade out gradually. How can I fade out the background music, is there a way to do this? Thanks in advance! Additionally, is ObjectAL any better than CocosDenshion? If so, what are the differences/advantages? 回答1: The only way i found of doing that is to