本文整理汇总了C#中cocos2d.CCSprite类的典型用法代码示例。如果您正苦于以下问题:C# CCSprite类的具体用法?C# CCSprite怎么用?C# CCSprite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCSprite类属于cocos2d命名空间,在下文中一共展示了CCSprite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SpriteZOrder
public SpriteZOrder()
{
m_dir = 1;
CCSize s = CCDirector.SharedDirector.WinSize;
float step = s.Width / 11;
for (int i = 0; i < 5; i++)
{
CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121));
sprite.Position = (new CCPoint((i + 1) * step, s.Height / 2));
AddChild(sprite, i);
}
for (int i = 5; i < 10; i++)
{
CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 0, 85, 121));
sprite.Position = new CCPoint((i + 1) * step, s.Height / 2);
AddChild(sprite, 14 - i);
}
CCSprite sprite1 = new CCSprite("Images/grossini_dance_atlas", new CCRect(85 * 3, 121 * 0, 85, 121));
AddChild(sprite1, -1, (int)kTagSprite.kTagSprite1);
sprite1.Position = (new CCPoint(s.Width / 2, s.Height / 2 - 20));
sprite1.Scale = 6;
sprite1.Color = new CCColor3B(Color.Red);
Schedule(reorderSprite, 1);
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:29,代码来源:SpriteZOrder.cs
示例2: InitWithOurOwnProperties
void InitWithOurOwnProperties(string theFileNameToAnimate,
int theFrameToStartWith,
int theNumberOfFramesToAnimate,
int theX,
int theY,
bool flipOnX,
bool flipOnY,
bool doesItLoop,
bool doesItUseRandomFrameToLoop)
{
this.fileNameToAnimate = theFileNameToAnimate;
this.frameToStartWith = theFrameToStartWith;
this.currentFrame = frameToStartWith;
this.framesToAnimate = theNumberOfFramesToAnimate;
this.animationFlippedX = flipOnX;
this.animationFlippedY = flipOnY;
this.doesTheAnimationLoop = doesItLoop;
this.useRandomFrameToLoop = doesItUseRandomFrameToLoop;
this.someSprite = new CCSprite(String.Format("{0}_000{1}.png", fileNameToAnimate, currentFrame));
AddChild(someSprite);
someSprite.PositionX = theX;
someSprite.PositionY = theY;
someSprite.FlipX = animationFlippedX;
someSprite.FlipY = animationFlippedY;
Schedule(RunMyAnimation, 1.0f / 60.0f);
}
开发者ID:CasperWollesen,项目名称:AngryNinjas,代码行数:33,代码来源:CustomAnimation.cs
示例3: RenderTextureTest
public RenderTextureTest()
{
//if (CCConfiguration.sharedConfiguration().getGlesVersion() <= GLES_VER_1_0)
//{
// CCMessageBox("The Opengl ES version is lower than 1.1, and the test may not run correctly.", "Cocos2d-x Hint");
// return;
//}
CCSize s = CCDirector.sharedDirector().getWinSize();
// create a render texture, this is what we're going to draw into
m_target = CCRenderTexture.renderTextureWithWidthAndHeight((int)s.width, (int)s.height);
if (null == m_target)
{
return;
}
m_target.position = new CCPoint(s.width / 2, s.height / 2);
// note that the render texture is a cocosnode, and contains a sprite of it's texture for convience,
// so we can just parent it to the scene like any other cocos node
addChild(m_target, 1);
// create a brush image to draw into the texture with
m_brush = CCSprite.spriteWithFile("Images/stars.png");
//m_brush.retain();
ccBlendFunc bf = new ccBlendFunc { src = 1, dst = 0x0303 };
m_brush.BlendFunc = bf;
m_brush.Opacity = 20;
isTouchEnabled = true;
}
开发者ID:Openxlive,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:RenderTextureTest.cs
示例4: updateQuantityOfNodes
public override void updateQuantityOfNodes()
{
CCSize s = CCDirector.SharedDirector.WinSize;
// increase nodes
if (currentQuantityOfNodes < quantityOfNodes)
{
for (int i = 0; i < (quantityOfNodes - currentQuantityOfNodes); i++)
{
CCSprite sprite = new CCSprite(batchNode.Texture, new CCRect(0, 0, 32, 32));
batchNode.AddChild(sprite);
sprite.Position = new CCPoint(Random.Next() * s.Width, Random.Next() * s.Height);
}
}
// decrease nodes
else if (currentQuantityOfNodes > quantityOfNodes)
{
for (int i = 0; i < (currentQuantityOfNodes - quantityOfNodes); i++)
{
int index = currentQuantityOfNodes - i - 1;
batchNode.RemoveChildAtIndex(index, true);
}
}
currentQuantityOfNodes = quantityOfNodes;
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:27,代码来源:IterateSpriteSheet.cs
示例5: OnEnter
public override void OnEnter()
{
//
// This test MUST be done in 'onEnter' and not on 'init'
// otherwise the paused action will be resumed at 'onEnter' time
//
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCLabelTTF l = new CCLabelTTF("After 5 seconds grossini should move", "arial", 16);
AddChild(l);
l.Position = (new CCPoint(s.Width / 2, 245));
//
// Also, this test MUST be done, after [super onEnter]
//
CCSprite grossini = new CCSprite(s_pPathGrossini);
AddChild(grossini, 0, kTagGrossini);
grossini.Position = (new CCPoint(200, 200));
CCAction action = new CCMoveBy (1, new CCPoint(150, 0));
CCDirector.SharedDirector.ActionManager.AddAction(action, grossini, true);
Schedule(unpause, 3);
}
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:27,代码来源:PauseTest.cs
示例6: NodeToWorld
public NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite back = new CCSprite(TestResource.s_back3);
AddChild(back, -10);
back.AnchorPoint = (new CCPoint(0, 0));
CCSize backSize = back.ContentSize;
CCMenuItem item = new CCMenuItemImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect);
CCMenu menu = new CCMenu(item);
menu.AlignItemsVertically();
menu.Position = (new CCPoint(backSize.Width / 2, backSize.Height / 2));
back.AddChild(menu);
CCActionInterval rot = new CCRotateBy (5, 360);
CCAction fe = new CCRepeatForever (rot);
item.RunAction(fe);
CCActionInterval move = new CCMoveBy (3, new CCPoint(200, 0));
var move_back = (CCActionInterval) move.Reverse();
CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back);
CCAction fe2 = new CCRepeatForever ((CCActionInterval) seq);
back.RunAction(fe2);
}
开发者ID:KogleDK,项目名称:cocos2d-xna-1,代码行数:28,代码来源:NodeToWorld.cs
示例7: SpriteBatchNodeZOrder
public SpriteBatchNodeZOrder()
{
m_dir = 1;
// small capacity. Testing resizing.
// Don't use capacity=1 in your real game. It is expensive to resize the capacity
CCSpriteBatchNode batch = CCSpriteBatchNode.Create("Images/grossini_dance_atlas", 1);
AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);
CCSize s = CCDirector.SharedDirector.WinSize;
float step = s.Width / 11;
for (int i = 0; i < 5; i++)
{
CCSprite sprite = new CCSprite(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121));
sprite.Position = (new CCPoint((i + 1) * step, s.Height / 2));
batch.AddChild(sprite, i);
}
for (int i = 5; i < 10; i++)
{
CCSprite sprite = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 0, 85, 121));
sprite.Position = new CCPoint((i + 1) * step, s.Height / 2);
batch.AddChild(sprite, 14 - i);
}
CCSprite sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 3, 121 * 0, 85, 121));
batch.AddChild(sprite1, -1, (int)kTagSprite.kTagSprite1);
sprite1.Position = (new CCPoint(s.Width / 2, s.Height / 2 - 20));
sprite1.Scale = 6;
sprite1.Color = new CCColor3B(Color.Red);
Schedule(reorderSprite, 1);
}
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:34,代码来源:SpriteBatchNodeZOrder.cs
示例8: RenderTextureSave
public RenderTextureSave()
{
CCSize s = CCDirector.SharedDirector.WinSize;
// create a render texture, this is what we are going to draw into
m_pTarget = CCRenderTexture.Create((int) s.Width, (int) s.Height, SurfaceFormat.Color, DepthFormat.None, RenderTargetUsage.PreserveContents);
m_pTarget.Position = new CCPoint(s.Width / 2, s.Height / 2);
// It's possible to modify the RenderTexture blending function by
//CCBlendFunc tbf = new CCBlendFunc (OGLES.GL_ONE, OGLES.GL_ONE_MINUS_SRC_ALPHA);
//m_pTarget.Sprite.BlendFunc = tbf;
// note that the render texture is a CCNode, and contains a sprite of its texture for convience,
// so we can just parent it to the scene like any other CCNode
AddChild(m_pTarget, -1);
// create a brush image to draw into the texture with
m_pBrush = new CCSprite("Images/fire");
// It's possible to modify the Brushes blending function by
CCBlendFunc bbf = new CCBlendFunc (OGLES.GL_ONE, OGLES.GL_ONE_MINUS_SRC_ALPHA);
m_pBrush.BlendFunc = bbf;
m_pBrush.Color = new CCColor3B (Color.Red);
m_pBrush.Opacity = 20;
TouchEnabled = true;
// Save Image menu
CCMenuItemFont.FontSize = 16;
CCMenuItem item1 = CCMenuItemFont.Create("Save Image", saveImage);
CCMenuItem item2 = CCMenuItemFont.Create("Clear", clearImage);
var menu = new CCMenu(item1, item2);
AddChild(menu);
menu.AlignItemsVertically();
menu.Position = new CCPoint(s.Width - 80, s.Height - 30);
}
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:35,代码来源:RenderTextureSave.cs
示例9: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCSize s = CCDirector.SharedDirector.WinSize;
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini.plist");
CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini-generic.plist");
CCLayerColor layer1 = CCLayerColor.Create(new CCColor4B(255, 0, 0, 255), 85, 121);
layer1.Position = new CCPoint(s.Width / 2 - 80 - (85.0f * 0.5f), s.Height / 2 - (121.0f * 0.5f));
AddChild(layer1);
sprite1 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName("grossini_dance_01.png"));
sprite1.Position = (new CCPoint(s.Width / 2 - 80, s.Height / 2));
AddChild(sprite1);
sprite1.FlipX = false;
sprite1.FlipY = false;
CCLayerColor layer2 = CCLayerColor.Create(new CCColor4B(255, 0, 0, 255), 85, 121);
layer2.Position = new CCPoint(s.Width / 2 + 80 - (85.0f * 0.5f), s.Height / 2 - (121.0f * 0.5f));
AddChild(layer2);
sprite2 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName("grossini_dance_generic_01.png"));
sprite2.Position = (new CCPoint(s.Width / 2 + 80, s.Height / 2));
AddChild(sprite2);
sprite2.FlipX = false;
sprite2.FlipY = false;
Schedule(startIn05Secs, 1.0f);
counter = 0;
}
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:35,代码来源:ZwoptexGenericTest.cs
示例10: Test6
public Test6()
{
CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
CCSprite sp11 = new CCSprite(TestResource.s_pPathSister1);
CCSprite sp2 = new CCSprite(TestResource.s_pPathSister2);
CCSprite sp21 = new CCSprite(TestResource.s_pPathSister2);
sp1.Position = (new CCPoint(100, 160));
sp2.Position = (new CCPoint(380, 160));
CCActionInterval rot = new CCRotateBy (2, 360);
var rot_back = rot.Reverse() as CCActionInterval;
CCAction forever1 = new CCRepeatForever ((CCActionInterval)CCSequence.FromActions(rot, rot_back));
var forever11 = (CCAction) (forever1.Copy());
var forever2 = (CCAction) (forever1.Copy());
var forever21 = (CCAction) (forever1.Copy());
AddChild(sp1, 0, CocosNodeTestStaticLibrary.kTagSprite1);
sp1.AddChild(sp11);
AddChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2);
sp2.AddChild(sp21);
sp1.RunAction(forever1);
sp11.RunAction(forever11);
sp2.RunAction(forever2);
sp21.RunAction(forever21);
Schedule(addAndRemove, 2.0f);
}
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:31,代码来源:Test6.cs
示例11: RenderTextureSave
public RenderTextureSave()
{
CCSize s = CCDirector.sharedDirector().getWinSize();
// create a render texture, this is what we are going to draw into
m_pTarget = CCRenderTexture.renderTextureWithWidthAndHeight((int)s.width, (int)s.height);
//m_pTarget->retain();
m_pTarget.position = new CCPoint(s.width / 2, s.height / 2);
// note that the render texture is a CCNode, and contains a sprite of its texture for convience,
// so we can just parent it to the scene like any other CCNode
this.addChild(m_pTarget, -1);
// create a brush image to draw into the texture with
m_pBrush = CCSprite.spriteWithFile("Images/fire.png");
//m_pBrush->retain();
m_pBrush.Opacity = 20;
//this->setIsTouchEnabled(true);
isTouchEnabled = true;
// Save Image menu
CCMenuItemFont.FontSize = 16;
CCMenuItem item1 = CCMenuItemFont.itemFromString("Save Image", this, saveImage);
CCMenuItem item2 = CCMenuItemFont.itemFromString("Clear", this, clearImage);
CCMenu menu = CCMenu.menuWithItems(item1, item2);
this.addChild(menu);
menu.alignItemsVertically();
menu.position = new CCPoint(s.width - 80, s.height - 30);
}
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:28,代码来源:RenderTextureSave.cs
示例12: SpriteBatchNodeColorOpacity
public SpriteBatchNodeColorOpacity()
{
// small capacity. Testing resizing.
// Don't use capacity=1 in your real game. It is expensive to resize the capacity
CCSpriteBatchNode batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 1);
AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);
CCSprite sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121));
CCSprite sprite2 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
CCSprite sprite3 = new CCSprite(batch.Texture, new CCRect(85 * 2, 121 * 1, 85, 121));
CCSprite sprite4 = new CCSprite(batch.Texture, new CCRect(85 * 3, 121 * 1, 85, 121));
CCSprite sprite5 = new CCSprite(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121));
CCSprite sprite6 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
CCSprite sprite7 = new CCSprite(batch.Texture, new CCRect(85 * 2, 121 * 1, 85, 121));
CCSprite sprite8 = new CCSprite(batch.Texture, new CCRect(85 * 3, 121 * 1, 85, 121));
CCSize s = CCDirector.SharedDirector.WinSize;
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 = new CCFadeIn (2);
CCActionInterval action_back = (CCActionInterval)action.Reverse();
CCAction fade = new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(action, action_back)));
CCActionInterval tintred = new CCTintBy (2, 0, -255, -255);
CCActionInterval tintred_back = (CCActionInterval)tintred.Reverse();
CCAction red = new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(tintred, tintred_back)));
CCActionInterval tintgreen = new CCTintBy (2, -255, 0, -255);
CCActionInterval tintgreen_back = (CCActionInterval)tintgreen.Reverse();
CCAction green = new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(tintgreen, tintgreen_back)));
CCActionInterval tintblue = new CCTintBy (2, -255, -255, 0);
CCActionInterval tintblue_back = (CCActionInterval)tintblue.Reverse();
CCAction blue = new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(tintblue, tintblue_back)));
sprite5.RunAction(red);
sprite6.RunAction(green);
sprite7.RunAction(blue);
sprite8.RunAction(fade);
// late add: test dirtyColor and dirtyPosition
batch.AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1);
batch.AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2);
batch.AddChild(sprite3, 0, (int)kTagSprite.kTagSprite3);
batch.AddChild(sprite4, 0, (int)kTagSprite.kTagSprite4);
batch.AddChild(sprite5, 0, (int)kTagSprite.kTagSprite5);
batch.AddChild(sprite6, 0, (int)kTagSprite.kTagSprite6);
batch.AddChild(sprite7, 0, (int)kTagSprite.kTagSprite7);
batch.AddChild(sprite8, 0, (int)kTagSprite.kTagSprite8);
Schedule(removeAndAddSprite, 2);
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:60,代码来源:SpriteBatchNodeColorOpacity.cs
示例13: performanceRotationScale
private void performanceRotationScale(CCSprite pSprite)
{
CCSize size = CCDirector.SharedDirector.WinSize;
pSprite.Position = new CCPoint((Random.Next() % (int)size.Width), (Random.Next() % (int)size.Height));
pSprite.Rotation = Random.Float_0_1() * 360;
pSprite.Scale = Random.Float_0_1() * 2;
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:7,代码来源:SpritePerformTest3.cs
示例14: SpriteBatchNodeAliased
public SpriteBatchNodeAliased()
{
CCSpriteBatchNode batch = CCSpriteBatchNode.Create("Images/grossini_dance_atlas", 10);
AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);
CCSize s = CCDirector.SharedDirector.WinSize;
CCSprite sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
sprite1.Position = (new CCPoint(s.Width / 2 - 100, s.Height / 2));
batch.AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1);
CCSprite sprite2 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121));
sprite2.Position = (new CCPoint(s.Width / 2 + 100, s.Height / 2));
batch.AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2);
CCActionInterval scale = new CCScaleBy(2, 5);
CCActionInterval scale_back = (CCActionInterval)scale.Reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(scale, scale_back));
CCAction repeat = new CCRepeatForever (seq);
CCAction repeat2 = (CCAction)(repeat.Copy());
sprite1.RunAction(repeat);
sprite2.RunAction(repeat2);
}
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:25,代码来源:SpriteBatchNodeAliased.cs
示例15: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
int idx = (int)(CCMacros.CCRandomBetween0And1() * 1400.0f / 100.0f);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));
AddChild(sprite);
sprite.Position = p;
CCActionInterval action;
float random = CCMacros.CCRandomBetween0And1();
if (random < 0.20)
action = new CCScaleBy(3, 2);
else if (random < 0.40)
action = new CCRotateBy (3, 360);
else if (random < 0.60)
action = new CCBlink (1, 3);
else if (random < 0.8)
action = new CCTintBy (2, 0, -255, -255);
else
action = new CCFadeOut (2);
object obj = action.Reverse();
CCActionInterval action_back = (CCActionInterval)action.Reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(action, action_back));
sprite.RunAction(new CCRepeatForever (seq));
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:30,代码来源:Sprite1.cs
示例16: TableCellAtIndex
public virtual CCTableViewCell TableCellAtIndex(CCTableView table, int idx)
{
string str = idx.ToString();
var cell = table.DequeueCell();
if (cell == null) {
cell = new CustomTableViewCell();
var sprite = new CCSprite("Images/Icon");
sprite.AnchorPoint = CCPoint.Zero;
sprite.Position = new CCPoint(0, 0);
cell.AddChild(sprite);
var label = new CCLabelTTF(str, "Helvetica", 20.0f);
label.Position = CCPoint.Zero;
label.AnchorPoint = CCPoint.Zero;
label.Tag = 123;
cell.AddChild(label);
}
else
{
var label = (CCLabelTTF)cell.GetChildByTag(123);
label.Label = (str);
}
return cell;
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:26,代码来源:TableViewTestScene.cs
示例17: StressTest2
public StressTest2()
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCLayer sublayer = new CCLayer();
CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
sp1.Position = (new CCPoint(80, s.Height / 2));
CCActionInterval move = new CCMoveBy (3, new CCPoint(350, 0));
CCActionInterval move_ease_inout3 = new CCEaseInOut((CCActionInterval) (move.Copy()), 2.0f);
var move_ease_inout_back3 = (CCActionInterval) move_ease_inout3.Reverse();
CCFiniteTimeAction seq3 = CCSequence.FromActions(move_ease_inout3, move_ease_inout_back3);
sp1.RunAction(new CCRepeatForever ((CCActionInterval) seq3));
sublayer.AddChild(sp1, 1);
CCParticleFire fire = CCParticleFire.Create();
fire.Texture = (CCTextureCache.SharedTextureCache.AddImage("Images/fire"));
fire.Position = (new CCPoint(80, s.Height / 2 - 50));
var copy_seq3 = (CCActionInterval) (seq3.Copy());
fire.RunAction(new CCRepeatForever (copy_seq3));
sublayer.AddChild(fire, 2);
Schedule((shouldNotLeak), 6.0f);
AddChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1);
}
开发者ID:KogleDK,项目名称:cocos2d-xna-1,代码行数:29,代码来源:StressTest2.cs
示例18: Create
/** Creates a switch with a mask sprite, on/off sprites for on/off states, a thumb sprite and an on/off labels. */
public static CCControlSwitch Create(CCSprite maskSprite, CCSprite onSprite, CCSprite offSprite, CCSprite thumbSprite, CCLabelTTF onLabel,
CCLabelTTF offLabel)
{
var pRet = new CCControlSwitch();
pRet.InitWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);
return pRet;
}
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:8,代码来源:CCControlSwitch.cs
示例19: OnEnter
public override void OnEnter()
{
base.OnEnter();
CCActionInterval effect = (CCSequence.FromActions(new CCDelayTime (2.0f), CCShaky3D.Create(16, false, new CCGridSize(5, 5), 5.0f)));
// cleanup
CCNode bg = GetChildByTag(EffectAdvanceScene.kTagBackground);
RemoveChild(bg, true);
// background
CCLayerColor layer = CCLayerColor.Create(new CCColor4B(255, 0, 0, 255));
AddChild(layer, -10);
CCSprite sprite = new CCSprite("Images/grossini");
sprite.Position = new CCPoint(50, 80);
layer.AddChild(sprite, 10);
// foreground
CCLayerColor layer2 = CCLayerColor.Create(new CCColor4B(0, 255, 0, 255));
CCSprite fog = new CCSprite("Images/Fog");
var bf = new CCBlendFunc {Source = OGLES.GL_SRC_ALPHA, Destination = OGLES.GL_ONE_MINUS_SRC_ALPHA};
fog.BlendFunc = bf;
layer2.AddChild(fog, 1);
AddChild(layer2, 1);
layer2.RunAction(new CCRepeatForever (effect));
}
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:28,代码来源:Issue631.cs
示例20: OnEnter
public override void OnEnter()
{
base.OnEnter();
m_grossini = new CCSprite(TestResource.s_pPathGrossini);
m_tamara = new CCSprite(TestResource.s_pPathSister1);
m_kathia = new CCSprite(TestResource.s_pPathSister2);
AddChild(m_grossini, 3);
AddChild(m_kathia, 2);
AddChild(m_tamara, 1);
var s = CCDirector.SharedDirector.WinSize;
m_grossini.Position = new CCPoint(60, 50);
m_kathia.Position = new CCPoint(60, 150);
m_tamara.Position = new CCPoint(60, 250);
var label = new CCLabelTTF(title(), "arial", 32);
AddChild(label);
label.Position = new CCPoint(s.Width / 2, s.Height - 50);
var item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
var item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
var item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);
var menu = new CCMenu(item1, item2, item3);
menu.Position = CCPoint.Zero;
item1.Position = new CCPoint(s.Width / 2 - 100, 30);
item2.Position = new CCPoint(s.Width / 2, 30);
item3.Position = new CCPoint(s.Width / 2 + 100, 30);
AddChild(menu, 1);
}
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:33,代码来源:EaseActionsTest.cs
注:本文中的cocos2d.CCSprite类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论