ccsprite

Sharp edged sprites

时间秒杀一切 提交于 2020-01-16 18:41:27
问题 Im new to cocos2D and I would like to draw as I tried using CCSprite and also tired to resolve it using [brush setBlendFunc:(ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}]; [brush.texture setAliasTexParameters]; But I got only image as in which the edges are blunt/blur. How I can make the blur edged images as sharp as the first one? Can someone suggest me the right way?? The code I use to generate the above image is brush = [CCSprite spriteWithFile:@"sketch.png"]; [brush setColor:ccc3(0, 0, 0)

CCSprite Fadeout with children

社会主义新天地 提交于 2020-01-11 09:18:10
问题 I'm using a CCSprite with a few other CCSprite objects added as children, the other animations I'm using (scale and rotate) work great and the children are animated too. But when I'm using CCFadeOut , it only fades the parent. I've read that fadeout doesn't apply to the children. Is there any way other than iterating over every child and calling the fadeout on each of them? 回答1: This answer is rendered obsolete by Gregory Johnson Answer Well, I guess your choices are (Ranked from simplest to

CCSprite: Batched sprites should use the same texture as the batchnode?

谁说我不能喝 提交于 2020-01-02 10:02:58
问题 I keep getting a crash that says: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite: Batched sprites should use the same texture as the batchnode' I am not quite sure what this means. I googled the crash but got no results. Also this only happens when I go back to my first scene after coming back from the second scene in my game. I double checked my code and I make sure all the images in my sprite sheets are added as children to the batch node

How do I properly use CCSpriteFrameCache and CCSpriteBatchNode?

谁说胖子不能爱 提交于 2020-01-01 09:06:07
问题 I do not understand what I do exactly when I add a CCSpriteFrameCache or CCSpriteBatchNode to my cocos2d application. Can somebody please explain the following points (it would be helpful if you could explain a few; please write the corresponding letter in front of your answer according to which question you are answering): [all questions imply the achievement of best performance and lowest memory-use] a) Is it crucial to create spritesheets for every single layer ? (For example: Menu - own

Swift Cocos2d3.x CCSprite applyImpulse not giving proper jump

坚强是说给别人听的谎言 提交于 2019-12-25 06:56:23
问题 I am using Cocos2d3.x with SpriteBuilder in Swift language. I want to make some animation like bouncing ball on Polls as seen in this GIF: https://www.dropbox.com/s/43vwlbjoazaxe7u/jumpyBall_15_jul_15.gif?dl=0 If you have noticed in the GIF file, each second jump is half of the previous jump. So, it seems pattern of 1,0.5,1,0.5,1,0.5,... Following are my settings: Polls: Physics Enabled Density: 1.0 Static Body Collision Type: Platform Circle: Physics Enabled Density: 1.0 Dynamic Body

How to resize the the animating sprite in cocos2d-x

ⅰ亾dé卋堺 提交于 2019-12-25 05:51:00
问题 I want to change the size of a Sprite which is animating. How can I do this ? I tried to change its size by using setScale property but it is not working here. where I am doing wrong ? CCArray* frames = CCArray::createWithCapacity(3); CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); char file[100] = {0}; for (int i = 0; i < 3; i++) { sprintf(file, "bird%d.png", i); CCSpriteFrame* frame = frameCache->spriteFrameByName(file); frames->addObject(frame); } CCAnimation

How velocity impacts on CCSprite in Cocos2d Chipmunk?

浪子不回头ぞ 提交于 2019-12-24 14:05:04
问题 I am in need of the basic understanding of how velocity changing works? i.e. how CCSprite is able to jump at particular height when some velocity is set? Let me give you an example on which I am working currently. I am preparing a demo like flappy bird, in which I wanted my bird to land on vertical pipes. So, it is like, my birdy jumps from the pipe to another pipe :smile:. Check the gif I place here: https://www.dropbox.com/s/n46vak6qy5wu4x4/jumpyBall_15_jul_152.gif?dl=0 I am using Sprite

[cocos2dx android]Rendering CCSprite using raw data from Bitmap

自作多情 提交于 2019-12-21 20:56:26
问题 I am trying to fetch an image from a URL into a Bitmap and then using the raw data from the Bitmap am trying to create a CCSprite. The issue here is that the image is corrupted when I display the sprite. I created a standalone android only application(no cocos2dx) and used the same code to fetch and display the Bitmap and its displayed correctly. Any reason why the image is not being properly rendered in cocos2dx? My code to fetch the image from the URL is: String urlString = "http://www

Getting absolute position of CCSprite in cocos2d

↘锁芯ラ 提交于 2019-12-21 05:27:07
问题 In my game, I have a CCSprite that orbits another CCSprite , much like an electron orbiting a nucleus. I have the electron as a child of the nucleus, to make animation much simpler. All I have to do is rotate the nucleus and the electron follows suite quite nicely. However, my problem comes from wanting to have the orbit animation appear a little snazzier, by either adding something like a particle system trail, or a ribbon effect following the path of the electron. I cannot simply add a

How to detect collision of sprite in cocos2d [closed]

半世苍凉 提交于 2019-12-13 12:52:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i want to detect collision of a sprite with another sprite. but i want to check whether the sprite is touched with left part of other sprite or touched with right part of sprite. i am using below code for detecting collision. but this detect the overall collision(sprite touched to at any point of other sprite).