cocos2d-iphone

Repeating background in cocos2d has black edges!

孤者浪人 提交于 2019-12-30 05:04:06
问题 I am attempting to setup a tiled/repeating background for my iPhone app. The code "works" in that the background is repeating like it should be but I seem to have a black border around each repetition and I dont know why, the image is exactly 200x200. Here is a screenshot of how it looks along with the code: if ((self=[super init])) { CCSprite * bg = [CCSprite spriteWithFile:@"pattern11.jpg" rect:CGRectMake(0, 0, 1000, 520)]; [bg setPosition:ccp(0, 0)]; ccTexParams params = {GL_LINEAR,GL

Android.mk - build all source file in a directory

血红的双手。 提交于 2019-12-30 04:34:08
问题 I am using Android NDK to build my cocos2dx project, within the Android.mk, there is a definition for LOCAL_SRC_FILES where each of the cpp file are listed. Whenever I added a new source file, I'd need to add it there as well... it looks like this: LOCAL_SRC_FILES := hellocpp/main.cpp \ hellocpp/myclass.cpp \ hellocpp/mynextclass.cpp \ ../../Classes/Screens/LaunchScreen.cpp \ the header file, however, can specify the entire directory to include, it looks like this: LOCAL_C_INCLUDES := $(LOCAL

Android.mk - build all source file in a directory

て烟熏妆下的殇ゞ 提交于 2019-12-30 04:34:06
问题 I am using Android NDK to build my cocos2dx project, within the Android.mk, there is a definition for LOCAL_SRC_FILES where each of the cpp file are listed. Whenever I added a new source file, I'd need to add it there as well... it looks like this: LOCAL_SRC_FILES := hellocpp/main.cpp \ hellocpp/myclass.cpp \ hellocpp/mynextclass.cpp \ ../../Classes/Screens/LaunchScreen.cpp \ the header file, however, can specify the entire directory to include, it looks like this: LOCAL_C_INCLUDES := $(LOCAL

Drawing line on touches moved in COCOS2D

时光怂恿深爱的人放手 提交于 2019-12-30 00:42:06
问题 I'm developing a game for iPhone using COCOS2D . In that, I need to draw a line when user drag his finger from a point to another. As far as my knowledge is concern I need to do this in Touches Moved method from where I can get the points. But I don't know how to do this. Can anybody help me on this? 回答1: Kia ora. Boredom compels me to provide an answer on this topic. Layer part (i.e. @interface GetMyTouches : CCLayer): -(void) ccTouchesMoved:(NSSet *)inappropriateTouches withEvent:(UIEvent *

How to determine the collision of a circle with a rectangle? [duplicate]

北战南征 提交于 2019-12-29 07:52:16
问题 This question already has answers here : Rectangle and Circle collision detection (2 answers) Closed 5 years ago . I have looked EVERYWHERE for leads on how to get this to work (nicely) and so far every solution I have come up with has been ugly or didn't work. What I have is a circular sprite, the enemy. Then I have a sprite that is in the shape of an arrow. When checking for collision for the arrow in the enemy, I use CGRectIntersect(rect1, rect2) but... circles are not rectangles! The

iOS Graphical Issue

ε祈祈猫儿з 提交于 2019-12-29 07:17:27
问题 so I am creating a side scrolling shooter game but am having an issue with some of the graphics occasionally. I'm running into this mysterious line that appears. As you can see on the image below it appears on some but not all the sprites. How can I go about fixing this? Is this mine or the artists mistake? I am developing with Cocos2d and using a CCSpriteBatchNode and my sprite sheet is a .png, not sure if the information is relevant just thought I'd leave as much info possible. Any ideas???

Simple gun in cocos2d+box2d game

独自空忆成欢 提交于 2019-12-28 03:04:20
问题 I'm newbie in box2d. Can you help me? I want to make gun (touch, move, stopped, ball flew). I make detection and rotation of gun, but I can't make popping of ball. How can I count velocity, which I need to set to the ball? Thank you very much 回答1: The easiest way is to look at the direction the gun is pointing when you define the body, and use GetWorldVector to see how it has changed. For example if the gun is pointing directly upwards when you create the body, this would be the direction (0

Predicting collision before it happens with cocos2d

最后都变了- 提交于 2019-12-25 16:53:18
问题 I thought about writing a new question, because there were too many comments and some other people could not get the proper idea of my doubt. For this, I have posted my GameScene on Git: https://github.com/henriquesv/iOS_Tests/blob/master/GameScene.m Summerizing: This is a game where I have a few pipes connected and some pieces start already inside of them. The user can touch each piece at a time and slide them through the tubes. So, I have to be able to move each piece with a finger. The

Poor font quality in CCLabelBMFont

为君一笑 提交于 2019-12-25 13:16:57
问题 Scaled screenshot on iPhone 5S: CCLabelBMFont is on top and CCLabelTTF is at the bottom. Both strings use Helvetica Neue Light 17pt . As you can see there is some kind of a stroke in the first string, but all symbols in font image are white on transparent background. Is it possible to get rid of this effect and make CCLabelBMFont look just as good as CCLabelTTF ? I used bmGlyph and other free analogs for Bitmap font creation, results were always the same. 回答1: First, don't change the node's

Cocos2d - using getChildByTag from child classes to get objects in a scene

痴心易碎 提交于 2019-12-25 10:05:53
问题 I have a cocos2d scene that has several child objects that make up the screen display. Some of these child objects need to communicate with each other so that the display can be updated. I decided that instead of passing around references to objects in the scene graph I would tag all the cocos2d nodes, pass the tag values around and then whenever I need a scene object I would just use the director to retrieve the object using the tag. This means I don't have lots of references to objects