public TMXReadWriteTest() { m_gid = 0; CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/orthogonal-test2"); addChild(map, 0, TileMapTestScene.kTagTileMap); CCSize s = map.contentSize; ////----UXLOG("ContentSize: %f, %f", s.width,s.height); CCTMXLayer layer = map.layerNamed("Layer 0"); layer.Texture.setAntiAliasTexParameters(); map.scale = 1; CCSprite tile0 = layer.tileAt(new CCPoint(1, 63)); CCSprite tile1 = layer.tileAt(new CCPoint(2, 63)); CCSprite tile2 = layer.tileAt(new CCPoint(3, 62));//ccp(1,62)); CCSprite tile3 = layer.tileAt(new CCPoint(2, 62)); tile0.anchorPoint = new CCPoint(0.5f, 0.5f); tile1.anchorPoint = new CCPoint(0.5f, 0.5f); tile2.anchorPoint = new CCPoint(0.5f, 0.5f); tile3.anchorPoint = new CCPoint(0.5f, 0.5f); CCActionInterval move = CCMoveBy.actionWithDuration(0.5f, new CCPoint(0, 160)); CCActionInterval rotate = CCRotateBy.actionWithDuration(2, 360); CCActionInterval scale = CCScaleBy.actionWithDuration(2, 5); CCActionInterval opacity = CCFadeOut.actionWithDuration(2); CCActionInterval fadein = CCFadeIn.actionWithDuration(2); CCActionInterval scaleback = CCScaleTo.actionWithDuration(1, 1); CCActionInstant finish = CCCallFuncN.actionWithTarget(this, removeSprite); CCFiniteTimeAction seq0 = CCSequence.actions(move, rotate, scale, opacity, fadein, scaleback, finish); CCActionInterval seq1 = (CCActionInterval)(seq0.copy()); CCActionInterval seq2 = (CCActionInterval)(seq0.copy()); CCActionInterval seq3 = (CCActionInterval)(seq0.copy()); tile0.runAction(seq0); tile1.runAction(seq1); tile2.runAction(seq2); tile3.runAction(seq3); m_gid = layer.tileGIDAt(new CCPoint(0, 63)); ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid); schedule(updateCol, 2.0f); schedule(repaintWithGID, 2.0f); schedule(removeTiles, 1.0f); ////----UXLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); ////----UXLOG("++++children: %d", layer->getChildren()->count() ); m_gid2 = 0; }
public SpriteColorOpacity() { CCSprite sprite1 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121)); CCSprite sprite2 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121)); CCSprite sprite3 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121)); CCSprite sprite4 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121)); CCSprite sprite5 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121)); CCSprite sprite6 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 1, 85, 121)); CCSprite sprite7 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 2, 121 * 1, 85, 121)); CCSprite sprite8 = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 1, 85, 121)); CCSize s = CCDirector.sharedDirector().getWinSize(); sprite1.position = new CCPoint((s.width / 5) * 1, (s.height / 3) * 1); sprite2.position = new CCPoint((s.width / 5) * 2, (s.height / 3) * 1); sprite3.position = new CCPoint((s.width / 5) * 3, (s.height / 3) * 1); sprite4.position = new CCPoint((s.width / 5) * 4, (s.height / 3) * 1); sprite5.position = new CCPoint((s.width / 5) * 1, (s.height / 3) * 2); sprite6.position = new CCPoint((s.width / 5) * 2, (s.height / 3) * 2); sprite7.position = new CCPoint((s.width / 5) * 3, (s.height / 3) * 2); sprite8.position = new CCPoint((s.width / 5) * 4, (s.height / 3) * 2); CCActionInterval action = CCFadeIn.actionWithDuration(2); CCActionInterval action_back = (CCActionInterval)action.reverse(); CCAction fade = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(action, action_back))); CCActionInterval tintred = CCTintBy.actionWithDuration(2, 0, -255, -255); CCActionInterval tintred_back = (CCActionInterval)tintred.reverse(); CCAction red = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintred, tintred_back))); CCActionInterval tintgreen = CCTintBy.actionWithDuration(2, -255, 0, -255); CCActionInterval tintgreen_back = (CCActionInterval)tintgreen.reverse(); CCAction green = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintgreen, tintgreen_back))); CCActionInterval tintblue = CCTintBy.actionWithDuration(2, -255, -255, 0); CCActionInterval tintblue_back = (CCActionInterval)tintblue.reverse(); CCAction blue = CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(tintblue, tintblue_back))); sprite5.runAction(red); sprite6.runAction(green); sprite7.runAction(blue); sprite8.runAction(fade); // late add: test dirtyColor and dirtyPosition addChild(sprite1, 0, (int)kTagSprite.kTagSprite1); addChild(sprite2, 0, (int)kTagSprite.kTagSprite2); addChild(sprite3, 0, (int)kTagSprite.kTagSprite3); addChild(sprite4, 0, (int)kTagSprite.kTagSprite4); addChild(sprite5, 0, (int)kTagSprite.kTagSprite5); addChild(sprite6, 0, (int)kTagSprite.kTagSprite6); addChild(sprite7, 0, (int)kTagSprite.kTagSprite7); addChild(sprite8, 0, (int)kTagSprite.kTagSprite8); schedule(removeAndAddSprite, 2); }
public Atlas4() { m_time = 0; // Upper Label CCLabelBMFont label = CCLabelBMFont.labelWithString("Bitmap Font Atlas", "fonts/fnt/bitmapFontTest"); addChild(label); CCSize s = CCDirector.sharedDirector().getWinSize(); label.position = new CCPoint(s.width / 2, s.height / 2); label.anchorPoint = new CCPoint(0.5f, 0.5f); CCSprite BChar = (CCSprite)label.getChildByTag(0); CCSprite FChar = (CCSprite)label.getChildByTag(7); CCSprite AChar = (CCSprite)label.getChildByTag(12); CCActionInterval rotate = CCRotateBy.actionWithDuration(2, 360); CCAction rot_4ever = CCRepeatForever.actionWithAction(rotate); CCActionInterval scale = CCScaleBy.actionWithDuration(2, 1.5f); CCFiniteTimeAction scale_back = scale.reverse(); CCFiniteTimeAction scale_seq = CCSequence.actions(scale, scale_back); CCAction scale_4ever = CCRepeatForever.actionWithAction((CCActionInterval)scale_seq); CCActionInterval jump = CCJumpBy.actionWithDuration(0.5f, new CCPoint(), 60, 1); CCAction jump_4ever = CCRepeatForever.actionWithAction(jump); CCActionInterval fade_out = CCFadeOut.actionWithDuration(1); CCActionInterval fade_in = CCFadeIn.actionWithDuration(1); CCFiniteTimeAction seq = CCSequence.actions(fade_out, fade_in); CCAction fade_4ever = CCRepeatForever.actionWithAction((CCActionInterval)seq); BChar.runAction(rot_4ever); BChar.runAction(scale_4ever); FChar.runAction(jump_4ever); AChar.runAction(fade_4ever); // Bottom Label CCLabelBMFont label2 = CCLabelBMFont.labelWithString("00.0", "fonts/fnt/bitmapFontTest"); addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2); label2.position = new CCPoint(s.width / 2.0f, 80); CCSprite lastChar = (CCSprite)label2.getChildByTag(3); lastChar.runAction((CCAction)(rot_4ever.copy())); //schedule( schedule_selector(Atlas4::step), 0.1f); base.schedule(step, 0.1f); }
public override void onEnter() { base.onEnter(); centerSprites(2); m_tamara.Opacity = 0; CCActionInterval action1 = CCFadeIn.actionWithDuration(1.0f); CCFiniteTimeAction action1Back = action1.reverse(); CCActionInterval action2 = CCFadeOut.actionWithDuration(1.0f); CCFiniteTimeAction action2Back = action2.reverse(); m_tamara.runAction(CCSequence.actions(action1, action1Back)); m_kathia.runAction(CCSequence.actions(action2, action2Back)); }
public MainLayer() { base.isTouchEnabled = true; CCSprite sprite = CCSprite.spriteWithFile(ClickAndMoveTest.s_pPathGrossini); CCLayer layer = CCLayerColor.layerWithColor(new ccColor4B(255, 255, 0, 255)); addChild(layer, -1); addChild(sprite, 0, ClickAndMoveTest.kTagSprite); sprite.position = new CCPoint(20, 150); sprite.runAction(CCJumpTo.actionWithDuration(4, new CCPoint(300, 48), 100, 4)); layer.runAction(CCRepeatForever.actionWithAction( (CCActionInterval)(CCSequence.actions( CCFadeIn.actionWithDuration(1), CCFadeOut.actionWithDuration(1))) )); }