zoukankan      html  css  js  c++  java
  • cocos-lua基础学习(九)spite类学习笔记

    创建精灵

    local sprite = cc.Sprite:create("Images/grossini_dance_atlas.png", cc.rect(x,y,85,121) )
    layer:addChild( sprite )
    local BatchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 50)
    layer:addChild(BatchNode, 0, kTagSpriteBatchNode)
    local sprite = cc.Sprite:createWithTexture(BatchNode:getTexture(), cc.rect(x,y,85,121) )
    layer:addChild( sprite )
    local cache = cc.SpriteFrameCache:getInstance()
    
    cache:addSpriteFrames("animations/grossini.plist")
    cache:addSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray.png")
    cache:addSpriteFrames("animations/grossini_blue.plist", "animations/grossini_blue.png")
    
    SpriteFrameTest.m_pSprite1 = cc.Sprite:createWithSpriteFrameName("grossini_dance_01.png")
    SpriteFrameTest.m_pSprite1:setPosition( cc.p( s.width/2-80, s.height/2) )
    
    local spritebatch = cc.SpriteBatchNode:create("animations/grossini.png")
    spritebatch:addChild(SpriteFrameTest.m_pSprite1)
    
    function SpriteFrameTest.onExit()
        local cache = cc.SpriteFrameCache:getInstance()
        cache:removeSpriteFramesFromFile("animations/grossini.plist")
        cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
        cache:removeSpriteFramesFromFile("animations/grossini_blue.plist")
    end
  • 相关阅读:
    每日日报
    HTML相关
    60-Shiro功能扩展(记住我)
    60--Shiro安全框架
    服务器项目部署简单操作
    61--DB项目--修改密码模块设计
    59-SpringAOP --Cache操作(注解)
    58-Spring AOP 异步操作
    58-Spring-AOP事务管理
    Terminal 执行 java 命令
  • 原文地址:https://www.cnblogs.com/damowang/p/4943631.html
Copyright © 2011-2022 走看看