Questions tagged [cocos2d-swift]

Cocos2D-Swift is an open-source framework for building cross-platform 2D games with Xcode and Objective-C

Cocos2d-Swift is written in swift language and its renamed from cocos2d-iphone.

http://www.cocos2d-swift.org

16 questions
18
votes
2 answers

EXC_BAD_ACCESS at lauch for EAGLContext renderbufferStorage: fromDrawable: in Cocos2d app whie debugging

Using default cocos2d-swift app I'm receiving the error EXC_BAD_ACCESS on my iPad Mini 2 at the line: BOOL rb_status = [_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer]; But if I try to launch the app without debug all works fine.…
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194
5
votes
1 answer

Cocos2d-Swift : Playing Sound Crashed

I used below code to play sound in Cocos2d-Swift, its crashed. OALSimpleAudio.sharedInstanceWithSources(32).playEffect("buttonUp_1.caf") How to resolve crash in swift code(not ObjC) ? Or Is there any other way to play sound in cocos2d-swift using…
iPhoneProcessor
  • 4,980
  • 6
  • 27
  • 49
5
votes
2 answers

Swift Version of Cocos2d Code : sprite1.colorRGBA

I used below cocos2d code and worked: CCSprite *sprite1 = [[CCSprite alloc] init]; sprite1.position = ccp(SW*0.1f, SH*0.82f); sprite1.normalMapSpriteFrame = normalMap; sprite1.effect = glass; sprite1.colorRGBA = [CCColor colorWithRed:0.0f green:0.0f…
iPhoneProcessor
  • 4,980
  • 6
  • 27
  • 49
1
vote
1 answer

CCActionSequence/CCActionDelay not delaying each action?

I have a function which creates a CCSprite and moves it across the screen: func fireWeapon(target: CGPoint) { let projectile = CCBReader.load("Projectile") as! CCSprite projectile.position = player.position; self.addChild(projectile); …
1
vote
2 answers

Cocos2d-Swift v3.x Sprite Builder : In iPad iPhone sd images are used. -ipad suffix ignored

Code: var bg = CCSprite(imageNamed:"Background.png") Images used in Resource: Background-hd.png Background-ipad.png Background-ipadhd.png Background-iphone5hd.png Background.png In all device Background.png(320x480) used, other images are…
Guru
  • 21,652
  • 10
  • 63
  • 102
1
vote
1 answer

CCClippingNode on Android not working

I started a new iOS project recently. I'd like to support also Android so I choose SpriteBuilder with newest cocos2d-iphone (cocos2d-swift). I use CCClippingNode for clipping contents. It needs 24bit depth buffer and 8 bit stencil buffer, so I…
Gergely
  • 3,025
  • 2
  • 14
  • 13
1
vote
0 answers

GPUImage giving multiple GL_INVALID_ errors as soon as any GPUImage class is used

I'm trying to integrate GPUImage in a cocos2d-swift (SpriteBuilder) project so that I can use the video filters within my app. I got GPUImage working fine in the samples so I moved on and added the framework and followed the README to get GPUImage…
0
votes
1 answer

CCSpine by cocos2d-objc-ext not working

I am trying to use CCSpine in my cocos2d-swift V3.3 project, there is a issue: not found CCDictionary.h Where is the CCDictionary.h? Dose it in a low version of coco2d-iphone?But I didn't find it.
luoyeshu
  • 15
  • 1
  • 5
0
votes
1 answer

cocos2d swift how to show a sprite?

So I have my scene presenting and am trying to display a sprite when I press a button. I know the function is called because of a NSLog but I can't get the sprite to show. func ShowShip() { var booster =…
shwick
  • 4,277
  • 6
  • 21
  • 28
0
votes
1 answer

Cocos2d-Swift : CCProgressNodeTypeBar not found in Swift

Here is ObjectiveC Code: CCSprite *progress = [CCSprite spriteWithImageNamed:@"progress.png"]; mProgressBar = [CCProgressNode progressWithSprite:progress]; mProgressBar.type = CCProgressNodeTypeBar; I Tried to Convert it to Swift: var progress…
Guru
  • 21,652
  • 10
  • 63
  • 102
0
votes
1 answer

CCActionCallBlock usage in Cocos2d Swift

I used below cocos2d-swift code, giving 1 error. See below image. var calBck = CCActionCallBlock.actionWithBlock({ self.showGlassEffect() }) as CCActionCallBlock var seq = CCActionSequence.actions(move, delay, calBck, nil)…
Guru
  • 21,652
  • 10
  • 63
  • 102
0
votes
2 answers

CCActionMoveTo sprite moving in wrong direction

Hi im currently working on a game where my player collects coins among other things. I have implemented collision detection for the coins and that is working, however when i collide with a coin i want to move the coin to the score label. The score…
Tony_89
  • 797
  • 11
  • 39
0
votes
1 answer

CCScrollView doesn't show ContentNode

I succeeded to show a contentNode on a scrollView published from SpriteBuilder. But couldn't show it on a scrollView made programatically. I just put these codes on didLordFromCCB MainScene.m. I did nothing with the SpriteBuilder…
ika_tarou
  • 13
  • 3
0
votes
1 answer

Swift Syntax Error : Type 'AnyObject' cannot be implicitly downcast

I used below code to create sprite in swift. var bg : CCSprite = CCSprite.spriteWithImageNamed("Default.png"); bg.position = ccp(SW*0.5, SH*0.5) self.addChild(bg) Please check image, its giving error for 1st line. Error : Type…
iPhoneProcessor
  • 4,980
  • 6
  • 27
  • 49
0
votes
0 answers

Using CCScrollView in Cocos2d V3

I'm wondering if anyone can help me with this. I want to add 4 CCScrollViews, that will scroll horizontally, on a CCNode. The CCNode, positioned and held on the device in portrait mode, will fill the entire screen with a normalized contentSize set…
Carl Hine
  • 1,817
  • 18
  • 24
1
2