cocos2d-iphone

Simple 2D Flight Physics with Box2D

℡╲_俬逩灬. 提交于 2021-02-11 12:20:37
问题 I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and Box2D. I have a basic system working, but just can't get the physics feeling correct. I am applying force to the plane (which is a b2CircleShape ) based on the user's input. So, basically, if the user pushes up, body_->ApplyForce(b2Vec2(10,30), body_->GetPosition()) is called. Similarly, for down

Detect transparent part on the sprite in cocos2d?

时光总嘲笑我的痴心妄想 提交于 2020-02-11 13:31:06
问题 I'm beginner in Cocos2d. I have a sprite, and I want to ignore touch on transparent area of that sprite. I'm aware of this answer Cocos2d 2.0 - Ignoring touches to transparent areas of layers/sprites, and also this great article http://www.learn-cocos2d.com/2011/12/fast-pixelperfect-collision-detection-cocos2d-code-1of2/. I was able to make it work with KKPixelMaskSprite, but only when sprite is used from file, but not from batch node. Whenever I use batch node (Sprite sheet), to get sprite ,

How to avoid a double-up of effort for retina, when using tile maps from Tiled with Cocos2d

僤鯓⒐⒋嵵緔 提交于 2020-02-05 08:19:47
问题 I've got retina tile maps working, 15x10 tiles, of 64x64 tiles. problem is for non-retina devices I will need to make a 15x10 tiles of 32x32 tiles. I don't want to recreate the Tile, is it just a case of changing the XML (.tmx) file? Is there an automated tool or another way around this? I've been looking online but not getting too much help. Thanks 回答1: You have to update the TMX file and scale certain attributes. Unless your TMX map is very simple this will be a tedious and error-prone task

How can i use MYSQL database connection in iphone application useing cocos2d?

邮差的信 提交于 2020-02-01 04:55:47
问题 I am working on project and i need to connect MYSQL database. I am success to connect SQLite in my project ( using cocos2d).But i can not connect MYSQL database in my project. I any one do like this than help me for how to connect . Give me the necessary information. 回答1: You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP. So, you will have something like this: iPhone POSTING a request to the WebServer

How can i use MYSQL database connection in iphone application useing cocos2d?

别来无恙 提交于 2020-02-01 04:55:07
问题 I am working on project and i need to connect MYSQL database. I am success to connect SQLite in my project ( using cocos2d).But i can not connect MYSQL database in my project. I any one do like this than help me for how to connect . Give me the necessary information. 回答1: You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP. So, you will have something like this: iPhone POSTING a request to the WebServer

filled antialiased poly cocos2d

给你一囗甜甜゛ 提交于 2020-01-30 09:45:33
问题 How can I draw filled poly in Cocos2D framework? Code below draws poly but without antialiasing.What should I change? void ccFillPoly( CGPoint *poli, int points, BOOL closePolygon ) { // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // Needed states: GL_VERTEX_ARRAY, // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY);

filled antialiased poly cocos2d

假如想象 提交于 2020-01-30 09:45:10
问题 How can I draw filled poly in Cocos2D framework? Code below draws poly but without antialiasing.What should I change? void ccFillPoly( CGPoint *poli, int points, BOOL closePolygon ) { // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // Needed states: GL_VERTEX_ARRAY, // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY);

How to move background in cocos 2d

时间秒杀一切 提交于 2020-01-29 05:34:05
问题 Hi i want to develop game like 'Doodle jump'.But i have some problem with the following features- 1.How to move background scene/image. 2.How to detect collision between object.Is it needed a physics engine like box2d or i should just use manual collision. 3.what should be the size of the background image. 4.In fact i have no idea how does background move .So i need a explanation from someone. 回答1: Background Movement A) You could create a TMX Tilemap and then make a very high Tiled-Map. B)

My cocos2d project stopped compiling! Over 40 errors! What to do? [closed]

こ雲淡風輕ζ 提交于 2020-01-26 04:28:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have had multiple snapshot and even reverting to them this thing just won't compile. It gives me over 40 errors! What can I do? I didn't change anything at all. As I say, even reverting to old snapshot doesn't

Pop Up Animation in Cocos2D game

左心房为你撑大大i 提交于 2020-01-25 09:12:05
问题 I want to create one game scene to make some object like pop up randmoly.. It shows to small when appear in screen at any time and any position.. It goes to big and come out to screen.. GameScene with objects shows pop up in screnn randmoly.. Like one game which has objects appear in jumping animation.. How its possible..? Any help should be appreciated.. Please... 回答1: Easy... To do those animations u must be in mind that the z value of your animated sprite should be higher the all the