展开

关键词

cocos2dx 钢琴

Scene* Piano::createScene(){ Scene* scene = Scene::create(); Piano* layer = Piano::create(); scene->addChild (button1); menu1->setPosition((1-1)*size.width7,0); addChild(menu1); CocosDenshion::SimpleAudioEngine (button2); menu2->setPosition((2 - 1)*size.width 7, 0); addChild(menu2); CocosDenshion::SimpleAudioEngine (button3); menu3->setPosition((3 - 1)*size.width 7, 0); addChild(menu3); CocosDenshion::SimpleAudioEngine (button4); menu4->setPosition((4 - 1)*size.width 7, 0); addChild(menu4); CocosDenshion::SimpleAudioEngine

56330

cocos2d-x AnchorPoint锚点

(255,0,0,255), 300, 200);  CCLayer* layer2 = CCLayerColor::create(ccc4(255,255,0,255), 100, 100);   addChild (layer1);  layer1->addChild(layer2);  ? (p1);  p1->addChild(p2);   p2作为p1的子节点 setPosition(200,200);   Layer 的原点移到200,200 ? (layer1);      layer1->addChild(layer2);  *  layer1->ignoreAnchorPointForPosition(false);*     layer1 (p1);  p1->addChild(p2);  p2->setAnchorPoint(ccp(1,1));  setPosition(200,200);  ?

73270
  • 广告
    关闭

    90+款云产品免费体验

    提供包括云服务器,云数据库在内的90+款云计算产品。打造一站式的云产品试用服务,助力开发者和企业零门槛上云。

  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    FlashFlex学习笔记(51):3维旋转与透视变换(PerspectiveProjection)

    Sprite();containerSprite.addChild(imgSprite);imgSprite.x = img.width 2;imgSprite.y = img.height 2; addChild (txtX);addChild(txtY);addChild(txtZ);addChild(txtPosZ);addChild(txtFieldOfView);addChild(txtInfo);addChild (txtCenter);addChild(txtFocusLength);addChild(silderX);addChild(silderY);addChild(silderZ);addChild(silderPosZ );addChild(silderFieldOfView);addChild(silderCenterPos);addChild(silderFocusLength); silderX.addEventListener doPerspectiveProjection(); var txtAuthor:TextField = new TextField();txtAuthor.htmlText =by 菩提树下的杨过;addChild

    37380

    FlashFlex学习笔记(46):正向运动学

    (_back); _handle = new Sprite () ; _handle.buttonMode=true; addChild(_handle); _handle.addEventListener (segment0); segment0.x=200; segment0.y=200; segment1=new Segment(100,20); addChild(segment1); segment1 (segment0); segment0.x=200; segment0.y=50; segment1=new Segment(100,20); addChild(segment1); segment1 (segment0); segment0.x=200; segment0.y=100; segment1=new Segment(50,10); addChild(segment1); segment1 ); thighRangeSlider.x=30; thighRangeSlider.y=10; thighBaseSlider=new SimpleSlider(0,180,90); addChild

    33260

    PixelBender(着色器)初体验

    FlatButton; private var isApply:Boolean=false; public function Demo1():void { im=new image as Bitmap; addChild (im); sl = new Slider(); addChild(sl); sl.scaleX=sl.scaleY=2.0; sl.x=stage.stageWidth2-sl.width2; sl.y (im); sl = new Slider(); addChild(sl); sl.scaleX=sl.scaleY=2.0; sl.x=stage.stageWidth2-sl.width2; sl.y (slRadius); addChild(slCenterX); addChild(slCenterY); addChild(sAngle); slRadius.scaleX=slRadius.scaleY (im); addChild(im2); sl = new Slider(); addChild(sl); sl.minimum=0; sl.maximum=1; sl.snapInterval=0.01

    42560

    cocos2dx 打灰机

    Scene* GamePlane::createScene(){ auto scene = Scene::create(); auto layer = GamePlane::create(); scene->addChild bg = Sprite::create(background.png); bg->setAnchorPoint(Vec2(0, 0)); bg->setPosition(0, 0); layer->addChild = Sprite::create(background.png); bg->setAnchorPoint(Vec2(0, 0)); bg->setPosition(0, HEIGH); layer->addChild (bg); addChild(layer); auto plane = PlaneSprite::createPlane(Point(180, 100)); plane->setTag(PLANE); addChild(plane); for (int i = 0; i < BULLE; ++i) { bullets = Bullet::createBullet(Point(0, 660)); addChild

    1.2K60

    cocos2dx 象棋

    0:9)); addChild(chesses); ++i; int flag = 0; for (int times = 0; times < 2; ++times,++flag) { chesses 0:9)); addChild(chesses); ++i; chesses = Chess::createChess((TAG)tag, TYPE::XIANG, Vec2(rand() % HEIGHT 0 : 9)); addChild(chesses); ++i; chesses = Chess::createChess((TAG)tag, TYPE::MA, Vec2(rand() % HEIGHT 0 : 9)); addChild(chesses); ++i; chesses = Chess::createChess((TAG)tag, TYPE::CHE, Vec2(rand() % HEIGHT 2:7)); addChild(chesses); ++i; } flag = 0; for (int times = 0; times < 5; ++times,++flag) { chesses =

    56490

    “AS3.0高级动画编程”学习:第二章转向行为(上)

    (_seeker); _pursuer = new SteeredVehicle(0xff0000); addChild(_pursuer); _target = new Vehicle(0x000000 (_pursuer); _evader=new SteeredVehicle(0x00ff00); addChild(_evader); _target=new SteeredVehicle(0x000000 ); _target.velocity.length=15; addChild(_target); _seeker=new SteeredVehicle(0xff00ff); addChild(_seeker ); _fleer=new SteeredVehicle(0xffff00); addChild(_fleer); _pursuer2 = new SteeredVehicle(); addChild( (_evader); _target=new SteeredVehicle(0x000000);目标(黑色) _target.velocity.length = 20; addChild(_target

    35460

    cocos2dx 2048

    Scene* GameLayer::createScene(){ auto scene = Scene::create(); auto layer = GameLayer::create(); scene->addChild ScoreBoard::createBoard(0, 90, 90, high, Vec2(150, size.height - 100), Color4B(209, 168, 168, 255)); addChild ScoreBoard::createBoard(0, 90, 90, score, Vec2(255, size.height - 100), Color4B(50, 100, 209, 255)); addChild < VCARDS; ++j) { cards = CardSprite::createCard(0, 90, Vec2(90 * i + CARDBORDER 2, 90 * j + 80)); addChild (label); addChild(bg); return true;} int CardSprite::getNumber(){ return number;}bool CardSprite::setNumber

    64380

    cocos2dx-v3.5 2048 (二): GameTool的设计与实现

    (label);this->addChild(layerIcon); 代码分析: 背景创建: LayerColor::create(Color4B(230, 230, 0, 255), 100, 60) …)), setString(…),  setPosition(Vec2(60, 30)); 对于设置位置需要记住Label的锚点是在正中心,因此其坐标不应该设置为父节点的(0,0)处 添加子节点: addChild (label); this->addChild(layerIcon); initScore(); }while(0); return true;} bool GameTool::initScore(){ (scoreLabel); this->addChild(scoreIcon); auto bestIcon = LayerColor::create(Color4B(186, 172, 159, 255 (bestLabel); this->addChild(bestIcon); 首次从文件中读取最高分 loadScore(UserDefault::getInstance()->getIntegerForKey

    32450

    浏览器窗口尺寸改变时的图片自动重新定位

    LoaderInfo; var bmp:Bitmap = li.content as Bitmap; bmp.height = _imgHeight; bmp.width = _imgWidth; addChild bottom_right = new LoadImage(bottom_right.jpg,100,150); _center = new LoadImage(center.jpg,200,300); addChild (_top_left); addChild(_top_right); addChild(_bottom_left); addChild(_bottom_right); addChild(_center)

    32790

    cocos2dx 连连看

    Scene* GameLink::createScene(){ auto scene = Scene::create(); auto layer = GameLink::create(); scene->addChild ; auto map = TMXTiledMap::create(rec.tmx); map->setAnchorPoint(Vec2(0, 0)); map->setPosition(0, 0); addChild LayerColor::create(Color4B(255, 255, 255, 255)); bg->setAnchorPoint(Vec2(0, 0)); bg->setPosition(0, 0); addChild , -1); timeOut = false; time = FULLTIME; bar = CountDownBar::createCountDownBar(Vec2(0, 360), 480); addChild (button, NULL); menu->setAnchorPoint(Vec2(0, 0)); menu->setScale(0.4); menu->setPosition(560, 100); addChild

    50350

    发布一个轻量级的滑块控件

    SimpleSlider; public function SliderTest() { var slider_V:SimpleSlider=new SimpleSlider(100, 200, 180); addChild =slider_V.y=10; slider_V.value=120; 测试赋值 var slider_H:SimpleSlider=new SimpleSlider(0.0, 1.0, 0.5); addChild slider_H.x=30; slider_H.value=0.3; 测试赋值 带进度条的滑块 slider_Progress=new SimpleSlider(0, 100, 33, true); addChild _progress=new Sprite(); addChild(_progress); this. _tri = new Sprite(); addChild(_tri); _handle=new Sprite(); _handle.buttonMode=true; addChild(_handle)

    53680

    FlashFlex学习笔记(56):矩阵变换

    startX:Number = stage.stageWidth2 ;var startY:Number = stage.stageHeight2 ;box.x = startX;box.y = startY;addChild startX:Number = stage.stageWidth2;var startY:Number = stage.stageHeight2;box.x = startX;box.y = startY;addChild startX:Number = stage.stageWidth2 ;var startY:Number = stage.stageHeight2 ;box.x = startX;box.y = startY;addChild (box); var box2:Box = new Box(100,75,0xff6600); box2.x = startX;box2.y = startY;addChild(box2); silder_Angle.addEventListener startX:Number = stage.stageWidth2 ;var startY:Number = stage.stageHeight2 ;box.x = startX;box.y = startY;addChild

    335100

    组合模式(Composite)

    实现代码: Component:public abstract class Component { public abstract void doSomething(); public void addChild list.forEach(element -> element.doSomething()); }else { System.out.println(元素为空); } } @Override public void addChild Leaf(裙子); Component leaf4 = new Leaf(套装); 按照树的结构来组合组合对象和叶子对象 root.addChild(c1); root.addChild(c2); c1.addChild (leaf1); c1.addChild(leaf2); c2.addChild(leaf3); c2.addChild(leaf4); 调用根对象的输出功能来输出整棵树 root.doSomething

    16720

    【Cocos2d-x】开发基础-Node与Node层级架构

    (){ 创建场景对象 auto scene = Scene::create(); 创建层对象 auto layer = HelloWorld::create(); 把层放到场景里 scene->addChild (layer); 返回这个场景 return scene;}创建场景以及HelloWord这个层,然后把层放到场景里 通过addChild这个方法,把子节点加到父节点里面去 以此类推,可以把Layer 添加到Scene里,也可以这样把精灵,菜单等添加到层里 this->addChild(menu, 1);把菜单放到当前层把标签加入到层中this->addChild(label, 1);把图片精灵加入到层中 this->addChild(sprite, 0);代码在HelloWord.cpp中可以看到 所以,最开始的图上的层次结构,是通过add的这个方法添加上来的 既然有添加,那么就有移除方法,后面再介绍。 ( Node * child) virtual void addChild ( Node * child,int localZOrder) virtual void addChild ( Node *

    14220

    flashflex 与 FluorineFx通讯之Hello World!

    TextField(); lblInput.text=请输入参数:; lblInput.selectable=false; lblInput.autoSize=TextFieldAutoSize.RIGHT; addChild (lblInput); lblInput.height=20; lblInput.x=10; lblInput.y=10; addChild(lblInput); txtInput=new TextField TextFieldType.INPUT; txtInput.text=菩提树下的杨过; txtInput.y=lblInput.y; txtInput.x=lblInput.x + lblInput.width + 5; addChild (txtInput); btn=new CustomSimpleButton(60, 20, 调 用 ); addChild(btn); btn.y=txtInput.y; btn.x=txtInput.x + txtInput.width + 10; txtResult=new TextField(); addChild(txtResult); txtResult.x=lblInput.x; txtResult.y

    43260

    AS3初学者容易迷糊的几个问题

    addChildremoveChild影响简单点讲:Sprite或MovieClip对象一旦为其添加了Enter_Frame事件监听,对应的Enter_Frame处理函数将会马上被调用,并一直执行下去(不管你是否将其addChild 同样:MovieClip一旦被new出来,就会自动播放(在未用任何代码stop()的前提下),不管你是否将其addChild或removeChild注:其它事件也类似,在AS3的世界中,事件一旦被监听, 程序执行到这里就会一直不停的跑onSpriteEnterFrame了 function onSpriteEnterFrame(e:Event):void{ trace(我是_Sprite,getTimer());} addChild { trace(onRemoved:,e);} function onRemovedFromStage(e:Event):void { trace(onRemovedFromStage:,e);} addChild 当子对象从自身移除时触发,REMOVED_FROM_STAGE是自身从显示列表中移除时触发;ADDEDREMOVED事件会冒泡,而ADDED_TO_STAGEREMOVED_FROM_STAGE不冒泡,也就是说每次addChild

    26950

    Android游戏开发十日通(6)- 太空大战

    (spacedust1, 0, dustSpeed, ccp(0,visibleSize.height2) );  2  backgroundNode->addChild(spacedust2, 0,  dustSpeed, ccp( spacedust1->getContentSize().width,visibleSize.height2));    backgroundNode->addChild (galaxy, -1, bgSpeed, ccp(0, visibleSize.height * 0.7));    backgroundNode->addChild(planetsunrise, - 1 , bgSpeed, ccp(600, visibleSize.height * 0));    backgroundNode->addChild(spacialanomaly, -1, bgSpeed , ccp(900, visibleSize.height * 0.3));    backgroundNode->addChild(spacialanomaly2, -1, bgSpeed, ccp(

    26820

    flash开发中如何实现界面代码分离

    = new ButtonPause() as SimpleButton; trace(btnTest,btnTest is SimpleButton);Demo_ButtonPause0,true addChild btnTestClick); var btnTest2:SimpleButton = new ButtonPlay() as SimpleButton; trace(btnTest2);Demo_ButtonPlay1 addChild MouseEvent.CLICK,btnTest2Click); var bmd:Bitmap = new LogoImage() as Bitmap; trace(bmd);Demo_LogoImage2 addChild (bmd); bmd.x = bmd.y = 200; var testMovie:MovieClip = new TestMovie() as MovieClip; addChild(testMovie

    51670

    扫码关注云+社区

    领取腾讯云代金券