本文整理汇总了C#中cocos2d.CCPoint类的典型用法代码示例。如果您正苦于以下问题:C# CCPoint类的具体用法?C# CCPoint怎么用?C# CCPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCPoint类属于cocos2d命名空间,在下文中一共展示了CCPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ccTouchesMoved
public override void ccTouchesMoved(List<CCTouch> pTouches, CCEvent pEvent)
{
foreach (var it in pTouches)
{
CCTouch touch = it;
CCPoint touchLocation = touch.locationInView(touch.view());
touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
float nMoveY = touchLocation.y - m_tBeginPos.y;
CCPoint curPos = m_pItmeMenu.position;
CCPoint nextPos = new CCPoint(curPos.x, curPos.y + nMoveY);
CCSize winSize = CCDirector.sharedDirector().getWinSize();
if (nextPos.y < 0.0f)
{
m_pItmeMenu.position = new CCPoint(0, 0);
return;
}
if (nextPos.y > ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height))
{
m_pItmeMenu.position = new CCPoint(0, ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height));
return;
}
m_pItmeMenu.position = nextPos;
m_tBeginPos = touchLocation;
BugsTestScene.s_tCurPos = nextPos;
}
}
示例2: pointWithCCPoint
public static CCPointObject pointWithCCPoint(CCPoint ratio, CCPoint offset)
{
CCPointObject pRet = new CCPointObject();
pRet.initWithCCPoint(ratio, offset);
//pRet->autorelease();
return pRet;
}
示例3: StackObject
public StackObject(b2World world,
CCPoint location,
string spriteFileName,
bool breaksOnGround,
bool breaksFromNinja,
bool hasAnimatedBreakFrames,
bool damagesEnemy,
float density,
CreationMethod createHow,
int angleChange,
bool makeImmovable,
int points,
BreakEffect simpleScoreVisualFXType)
{
InitWithWorld(world,
location,
spriteFileName,
breaksOnGround,
breaksFromNinja,
hasAnimatedBreakFrames,
damagesEnemy,
density,
createHow,
angleChange,
makeImmovable,
points,
simpleScoreVisualFXType);
}
示例4: LayerLevels
public LayerLevels()
{
//�ؿ�ѡ���
CCPoint offset = new CCPoint(170, 180);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
//�ؿ��İ�ť
CCMenuItemSprite level = CCMenuItemSprite.itemFromNormalSprite(
CCSprite.spriteWithSpriteFrameName("btn_level1.png"),
CCSprite.spriteWithSpriteFrameName("btn_level2.png"),
this, click_level);
CCMenu menu = CCMenu.menuWithItems(level);
//λ����������ϵ�UI����
menu.position = CCDirector.sharedDirector().convertToUI(new CCPoint(offset.x + 160 * i, offset.y + 85 * j));
this.addChild(menu);
//����һ��MenuItem�������ı�����
CCMenuItem menuitem = new CCMenuItem();
//ָ��Arial��������������֤fonts����Arial.spritefont
var text = CCLabelTTF.labelWithString((j * 4 + i + 1).ToString(), "Arial", 12);
//����ɫָ��Ϊ��ɫ
text.Color = new ccColor3B();
menuitem.addChild(text);
menu.addChild(menuitem);
}
}
}
示例5: initWithCCPoint
public bool initWithCCPoint(CCPoint ratio, CCPoint offset)
{
m_tRatio = ratio;
m_tOffset = offset;
m_pChild = null;
return true;
}
示例6: Run
public void Run(CCPoint p_Point)
{
WordListLayer start = new WordListLayer();
start.position = p_Point;
addChild(start);
CCDirector.sharedDirector().replaceScene(this);
}
示例7: updateSize
public void updateSize(CCPoint touchLocation)
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCSize newSize = new CCSize(Math.Abs(touchLocation.X - s.Width / 2) * 2, Math.Abs(touchLocation.Y - s.Height / 2) * 2);
CCLayerColor l = (CCLayerColor)GetChildByTag(kTagLayer);
l.ContentSize = newSize;
}
示例8: addNewSprite
public void addNewSprite()
{
CCSize s = CCDirector.SharedDirector.WinSize;
CCPoint p = new CCPoint((float)(Random.NextDouble() * s.Width), (float)(Random.NextDouble() * s.Height));
CCSpriteBatchNode batch = (CCSpriteBatchNode)GetChildByTag((int)kTags.kTagSpriteBatchNode);
int idx = (int)(Random.NextDouble() * 1400 / 100);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = new CCSprite(batch.Texture, new CCRect(x, y, 85, 121));
batch.AddChild(sprite);
sprite.Position = (new CCPoint(p.X, p.Y));
CCActionInterval action;
float random = (float)Random.NextDouble();
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);
CCActionInterval action_back = (CCActionInterval)action.Reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(action, action_back));
sprite.RunAction(new CCRepeatForever (seq));
}
示例9: 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));
}
示例10: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
CCSpriteBatchNode BatchNode = (CCSpriteBatchNode)getChildByTag((int)kTags.kTagSpriteBatchNode);
int idx = (int)(rand.NextDouble() * 1400 / 100);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = CCSprite.spriteWithTexture(BatchNode.Texture, new CCRect(x, y, 85, 121));
BatchNode.addChild(sprite);
sprite.position = (new CCPoint(p.x, p.y));
CCActionInterval action = null;
float random = (float)rand.NextDouble();
if (random < 0.20)
action = CCScaleBy.actionWithDuration(3, 2);
else if (random < 0.40)
action = CCRotateBy.actionWithDuration(3, 360);
else if (random < 0.60)
action = CCBlink.actionWithDuration(1, 3);
else if (random < 0.8)
action = CCTintBy.actionWithDuration(2, 0, -255, -255);
else
action = CCFadeOut.actionWithDuration(2);
CCActionInterval action_back = (CCActionInterval)action.reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.actions(action, action_back));
sprite.runAction(CCRepeatForever.actionWithAction(seq));
}
示例11: Enemy
public Enemy(b2World world,
CCPoint location,
string spriteFileName,
bool isTheRotationFixed,
bool getsDamageFromGround,
bool doesGetDamageFromDamageEnabledStackObjects,
int breaksFromHowMuchContact,
bool hasDifferentSpritesForDamage,
int numberOfFramesToAnimateOnBreak,
float density,
CreationMethod createHow,
int points,
BreakEffect simpleScoreVisualFXType )
{
InitWithWorld( world,
location,
spriteFileName,
isTheRotationFixed,
getsDamageFromGround,
doesGetDamageFromDamageEnabledStackObjects,
breaksFromHowMuchContact,
hasDifferentSpritesForDamage,
numberOfFramesToAnimateOnBreak,
density,
createHow,
points,
simpleScoreVisualFXType );
}
示例12: CCPointApplyAffineTransform
public static CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t)
{
CCPoint p = new CCPoint();
p.x = (float)((double)t.a * point.x + (double)t.c * point.y + t.tx);
p.y = (float)((double)t.b * point.x + (double)t.d * point.y + t.ty);
return p;
}
示例13: addNewSpriteWithCoords
public void addNewSpriteWithCoords(CCPoint p)
{
int idx = (int)(ccMacros.CCRANDOM_0_1() * 1400.0f / 100.0f);
int x = (idx % 5) * 85;
int y = (idx / 5) * 121;
CCSprite sprite = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));
addChild(sprite);
sprite.position = p;
CCActionInterval action;
float random = ccMacros.CCRANDOM_0_1();
if (random < 0.20)
action = CCScaleBy.actionWithDuration(3, 2);
else if (random < 0.40)
action = CCRotateBy.actionWithDuration(3, 360);
else if (random < 0.60)
action = CCBlink.actionWithDuration(1, 3);
else if (random < 0.8)
action = CCTintBy.actionWithDuration(2, 0, -255, -255);
else
action = CCFadeOut.actionWithDuration(2);
object obj = action.reverse();
CCActionInterval action_back = (CCActionInterval)action.reverse();
CCActionInterval seq = (CCActionInterval)(CCSequence.actions(action, action_back));
sprite.runAction(CCRepeatForever.actionWithAction(seq));
}
示例14: resetAndScoreBallForPlayer
public void resetAndScoreBallForPlayer(int player)
{
m_ballStartingVelocity = new CCPoint(m_ballStartingVelocity.x * -1.1f, m_ballStartingVelocity.y * -1.1f);
m_ball.Velocity = m_ballStartingVelocity;
m_ball.position = new CCPoint(160.0f, 240.0f);
// TODO -- scoring
}
示例15: InitWithWorld
private void InitWithWorld( b2World world, CCPoint location, string spriteFileName)
{
this.theWorld = world;
this.initialLocation = location;
this.spriteImageName = spriteFileName;
CreateGround();
}