Menu
  • HOME
  • TAGS

Does SpriteBuilder override image override from “auto” or from the right bigger resolution?

android,ios,spritebuilder

If you override an image for a specific resolution, it will only apply to that specific resolution and device type. Example: If you were to assign an "egg" image to the tablet resolution, the egg would only appear on non-Retina tablet (ie iPad) devices. All others would show the metal...

How to start CCBFile animation on call in cocos2d?

ios,cocos2d-iphone,spritebuilder

The CCBAnimationManager is used for this. Let's say that you named your animation 'AnimationTest`. To stop it from running automatically, there's an option for it in the timeline properties (see here) // in the loaded ccb file's class CCBAnimationManager* animationManager = self.userObject; [animationManager runAnimationsForSequenceNamed:@"AnimationTest"]; ...

Temporary disable physics from CCSprite

ios,cocos2d-iphone,spritebuilder

I write the correct answer then: sprite.physicsBody.sensor = TRUE; ...

Problems with .ccb file for sprite in SpriteBuilder

ios,cocos2d-iphone,spritebuilder

This can happen if you didn't save the hero.ccb. Choose File -> Save All or simply Publish the project to have SpriteBuilder update all references.

Access CCB root node animation timeline - Cocos2D

ios,cocos2d-iphone,spritebuilder

First of all, when you add a CCB as child of another node you should use load: not loadAsScene: CCNode *hero = [CCBReader load:@"heros/panda"]; [_heroContainer addChild:hero]; With the above code hero will be the root node of the heros/panda CCB file. With your code using loadAsScene the root node is...

Spritebuilder how can I change the animation ( CCB file ) of a CCNode programmatically?

ios,animation,cocos2d-iphone,spritebuilder

setSpriteFrame is not the method you are looking. If you want to keep your current CCB setup you should be able to accomplish what you want by doing: CCSprite *wat = _player.children[0]; [wat removeFromParent]; CCNode *animar = [CCBReader load:@"ForwardDash"]; [_player addChild:animar]; While this works, I would recommend you try taking...

SpriteBuilder CCButton stretched images?

ios,cocos2d-iphone,spritebuilder

I just ended up subclassing CCSprite and just adding my own touch controls to that. Now it looks great!

Make an object appear in frame N and not frame 0 in SpriteBuilder

ios,cocos2d-iphone,spritebuilder

What you want to do can be done with a mix of Spritebuilder and code. It's not possible to animate/toggle any of the physics attributes in the Spritebuilder timeline, but you can set your own callbacks to achieve it. To add a callback in the timeline, you hold alt/option+left click...

CCClippingNode on Android not working

android,spritebuilder,cocos2d-iphone-3,cocos2d-swift

I found out where was the problem, so I'll answer my own question :) The whole problem was in misleading logs. We need to modify function setupView: in Platforms/Android/CCGLView.m. CCGLView is logging EGL values before calling eglChooseConfig which sets depth and stencil size to 0. Moving line logConfig(_eglDisplay, _eglConfiguration); after...

Spritebuilder “unrecognized selector sent to instance”

ios,objective-c,xcode,spritebuilder

In SpriteBuilder, you need to set your scene class to GameOverScene. This is likely why you're getting an error about the unrecognized selector (your error message suggests that it's trying to call the method on a CCNode instead of your subclass).

Go to keyframe of Spritebuilder timeline

objective-c,cocos2d-iphone,spritebuilder

I found the easy solution after a bit more looking So if you have a look in CCAnimationManager there is a method for this called: - (void)jumpToSequenceNamed:(NSString*)name time:(float)time; So with your node you can call [node.animationManager jumpToSequenceNamed:@"MyTimeline" time:1.0]; // 1 Second ...

CCPhysicsCollisionDelegate not called

cocos2d-iphone,spritebuilder

Should replace the "typeA", "typeB" of the delegate method to the actual types "smallBox" and "bigBox", so a valid callback would be this: -(void)ccPhysicsCollisionPostSolve:(CCPhysicsCollisionPair *)pair smallBox:(CCNode *)nodeA bigBox:(CCNode *)nodeB ...

Position of child of instance variable not updating

objective-c,cocos2d-iphone,spritebuilder

I am not sure about this, but I guess its issue with the threading. Give a try with this code: -(void)updateBoxDisplay:(int)newTutorialLevelNumber { dispatch_async(dispatch_get_main_queue(), ^{ if (newTutorialLevelNumber == 1) { textBox1.position = ccp(0,0); [self addChild:textBox1]; } else if (newTutorialLevelNumber == 2) { textBox1.position = ccp(100,100) } }); } ...

Play Spritebuilder animation from timeline - Cocos2d

ios,cocos2d-iphone,spritebuilder

The Animation Manager is not on the node you want to run the animation on, but always on the root node of the CCB. I tripped over that, too. :) For instance if your hero is part of GameScene.ccb then you would have to get a reference to the GameScene's...

CCProgressNode for Health Bar not working

ios,objective-c,cocos2d-iphone,spritebuilder

I do not completely understand your problem, I have just written a small working example for a Left -> Right Bar Type Progress Bar - (void) onEnter { [super onEnter]; CCSprite *sprite = [CCSprite spriteWithImageNamed:@"emma.png"]; _progressNode = [CCProgressNode progressWithSprite:sprite]; _progressNode.type = CCProgressNodeTypeBar; _progressNode.midpoint = ccp(0.0f, 0.0f); _progressNode.barChangeRate = ccp(1.0f, 0.0f);...

Tilemap displaying incorrectly on iOS using Cocos2D

ios,cocos2d-iphone,spritebuilder,tiled

The problem was that instead of using a tileset, I was using a collection of images as a tileset in Tiled. Apparently that causes weird results with the tilemap in Cocos2D. It worked fine after using a sprite sheet.

How to use CCSlider with Xcode v6.1.1 & SpriteBuilder v1.3.6

objective-c,cocos2d-iphone,spritebuilder

Select the Slider in SpriteBuilder and on the Code Connections tab enter the name of the selector (with trailing colon since your implementation takes a parameter - it would also work with a parameterless method): Be sure to have the method implemented in the document root node. The document root...

Cocos2D v3 CCTableView not scrolling

ios,cocos2d-iphone,spritebuilder,ccscrollview

You need to set multipleTouchEnabled to YES on your instance of CCTableView. I had this same problem and that worked for me.

Failed to set selector block for CCButton on a Layer

ios,objective-c,uibutton,spritebuilder

A possible solution would be to set your button target to 'Owner' (instead of 'Document root') in the 'Item code connections' tab on the right hand side in Spritebuilder. Then, load your popup scene with the load:owner method of CCBReader, like so: nextBlock = [CCBReader load: @"NextBlock" owner:self]; This should...

Where does the method didLoadFromCCB: come from in Cocos2d v3?

ios,objective-c,cocos2d-iphone,spritebuilder

CCBReader sends this message. You can search the project in xcode if you need to find its exact origin. The mistake is that this method wasn't declared in any of the CCBReader headers and isn't in a protocol either, therefore Xcode won't autocomplete it because it's considered a private method....

How to change the document type of a CCB file in SpriteBuilder?

spritebuilder

Officially SpriteBuilder doesn't allow you to change the document type of a file, however, there is a way around this. The information about the size type is stored in the CCB file. Close SpriteBuilder (to avoid that the cache overrides your changes to the CCB file) Open the CCB file...

How to replace Sprite Frame in CCNode?

objective-c,cocos2d-iphone,spritebuilder

It's likely that your CCSprite is a child of your CCNode Try something like this: CCSprite *sprite = yourCCNode.children[0]; [sprite setSpriteFrame: newFrame]; ...

play button for multiple players in a ios game using spritebuilder

ios,objective-c,spritebuilder

Here's what your code is doing in actuality: player1Play set isPlayer1Turn = YES set isPlayer1Turn = NO player2Play set isPlayer1Turn = YES NSLOG isPlayer1Turn I'm not sure why you are bothering with tracking playerTurn, since you have 2 buttons dedicated to the task, and don't prevent the button use if...

Why is my Code Block Instance Variable not Initializing and printing out a “NSGlobalBlock”?

ios,objective-c,uitextfield,spritebuilder

Are you sure what -(void)patterns was called? If YES, try change void(^whereToNext)(void); to @property(nonatomic, copy) void(^whereToNext)(void); UPD I think there is no problem with creation of block or with execution of the block. I think there is some logic problem in the code. May be exist some parent or child...

cocos2d v3.x Disable device rotation, set portrait mode only

objective-c,cocos2d-iphone,spritebuilder

I dont use sprite builder myself, but still there must be a line like this in AppDelegate.m (this is from one of my apps) : [self setupCocos2dWithOptions:@{ // Show the FPS and draw call label. CCSetupShowDebugStats : @(YES), // More examples of options you might want to fiddle with: //...

Nil label with spritebuilder, can't figure out how to fix it

ios,objective-c,spritebuilder

You need to declare your instance variables using curly brackets, i.e.: @implementation Gameplay { CCLabelTTF *_randNumLabel; } - (void)play { // rest of your code ... As a personal preference I would use a private property instead of an instance variable, e.g. @interface Gameplay () @property (nonatomic, strong) CCLabelTTF *randNumLabel;...

SpriteBuilder image file not found

ios,cocos2d-iphone,spritebuilder

Change @"Down.png" to @"Resources/Down.png" because you have to include the folders created in SpriteBuilder for any references to resource files managed by SpriteBuilder. Likewise if you had some.ccb in a subfolder named "Levels" you'd have to load it with the string @"Levels/some.ccb"....

Make a sprite only jump once

ios,cocos2d-iphone,spritebuilder

You can use a BOOL. Here is my code for a jump on touch: BOOL isInAir;//Make this global. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { /* Called when a touch begins */ UITouch *touch = [touches anyObject]; SKSpriteNode *node = [self nodesAtPoint:[touch locationInNode:self]]; if (isInAir == NO) { CGFloat impulseX = 0.0f;...