cocos2d-iphone

Detect touch point on circle , Cocos2d

半世苍凉 提交于 2020-01-06 18:08:20
问题 I have created a circle with draw function in cocos2d, I am trying to detect touch point on circle line, lets say user touches bottom of the circle I want to print 270, if user touches top of the circle I want to print 90 etc.... I have looked this questions but they detect a sprite first then just compare if touches inside or outside of the circle http://www.cocos2d-iphone.org/forum/topic/21629 how to detect touch in a circle - (void) draw { CGSize winSize = [[CCDirector sharedDirector]

Cocos2d v.2 to v.3: All my resources scale up like crazy

半腔热情 提交于 2020-01-06 14:51:30
问题 I´ve just created an new cocos2d 3.3 project using SpriteBuilder. I imported my art resources and code from my cocos2d v2 project and got it to run, but all my resources scale up to about 3x their original size and the positions I set seems to be and all touch handling seems to be broken. I only have one sprite sheet and it does not have any suffix (like -hd). I´ve commented out [CCBReader configureCCFileUtils]; in AppDelegate.m but that didn´t change anything. Do I have to add a suffix or

Cocos2d Bubble Shooting Game

杀马特。学长 韩版系。学妹 提交于 2020-01-06 09:56:34
问题 I have worked with cocos2d before, that was simple game with moving objects (CCSprite), but now I want to make a bubbleshooter game , Can anyone briefly give me idea how it will work, the flow of game and what should I use, like as I think there will be on layer, and CCSprite over it, but still not clear idea in mind I would be thankful if someone will describe the whole flow, and classes, more briefly I will specify some major points What are bubbles used in game? (Image with CCSprites or

Cocos2d: creating an instance of CCRenderTexture crashes my App but can't figure out how to debug this

て烟熏妆下的殇ゞ 提交于 2020-01-06 08:52:26
问题 EDIT (shorter version after additional testing): I only added: CGSize winSize = [[CCDirector sharedDirector] winSize]; CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height]; to my BulletCache in my game project (that has a GameScene where an instance of BulletCache is added) and now the app does crash whilst trying to load the gamescene instance (before this I had no problems with this crash). NOTE: I added a breakpoint in the init method of

Cocos2d: creating an instance of CCRenderTexture crashes my App but can't figure out how to debug this

好久不见. 提交于 2020-01-06 08:52:13
问题 EDIT (shorter version after additional testing): I only added: CGSize winSize = [[CCDirector sharedDirector] winSize]; CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height]; to my BulletCache in my game project (that has a GameScene where an instance of BulletCache is added) and now the app does crash whilst trying to load the gamescene instance (before this I had no problems with this crash). NOTE: I added a breakpoint in the init method of

Speed increase when ApplyForce and LinearImpuls apply both using in Game

▼魔方 西西 提交于 2020-01-06 07:53:27
问题 In my game i am using LinearImpuls for jump player body and ApplyForce for movement left-right .But the problem is that when player jump at that time if movement occur then player speed so increases its just look like running on air. So what to do to resolve this problem?? Thanks in advance 回答1: I think keeping a check by boolean variable in code that at one time only one action can be performed either jump or moving left and right will solve the problem until and unless it does not affect

Speed increase when ApplyForce and LinearImpuls apply both using in Game

限于喜欢 提交于 2020-01-06 07:53:17
问题 In my game i am using LinearImpuls for jump player body and ApplyForce for movement left-right .But the problem is that when player jump at that time if movement occur then player speed so increases its just look like running on air. So what to do to resolve this problem?? Thanks in advance 回答1: I think keeping a check by boolean variable in code that at one time only one action can be performed either jump or moving left and right will solve the problem until and unless it does not affect

How to change the image in a cocos2d sprite from an array?

心不动则不痛 提交于 2020-01-06 06:48:33
问题 I'm trying to change the image that a sprite from an array is displaying. Here is the code I'm using: ((Sprite *)[enemiesArray objectAtIndex:index]).image = baseImage; I get the error message: error: request for member 'image' in something not a structure or union What am I doing wrong? Thanks for reading. 回答1: I don't think that this is the way to do this. Rather than that you should call one of the init methods: - (id) initWithCGImage:(CGImageRef)image; - (id) initWithTexture:(Texture2D*)

How to Change CCTexture2D Color

核能气质少年 提交于 2020-01-06 02:22:41
问题 I have a polygon that I fill using a texture and glDrawArray (using the method described in this tutorial: http://www.raywenderlich.com/32954/how-to-create-a-game-like-tiny-wings-with-cocos2d-2-x-part-1). I want to be able to fill my polygon using a solid color, which is generated at random during gameplay. To do this using the technique from the tutorial, I need to dynamically create a texture that is just a solid color (for example, I might want to generate a 1x1 red square and use that to

quartz 2d / openGl / cocos2d image distortion in iphone by moving vertices for 2.5d iphone game

醉酒当歌 提交于 2020-01-06 01:58:29
问题 We are trying to achieve the following in an iphone game: Using 2d png files, set-up a scene that seems 3d. As the user moves the device, the individual png files would warp/distort accordingly to give the effect of depth. example of a scene: an empty room, 5 walls and a chair in the middle. = 6 png files layered. We have successfully accomplished this using native functions like skew and scale. By applying transformations to the various walls and the chair, as the device is tilted moved, the