zoukankan      html  css  js  c++  java
  • Cocos2d JS 之消灭星星(六) 创建星星类

     1 /*
     2  * 创建星星类(所有的星星都在这里创建,星星拥有的所有性都在这里实现)
     3  */
     4 var GameCreateStar = ccui.ImageView.extend(
     5 {
     6     type:0,//星星的类型(不同数字代表不同颜色的星星);
     7     normalType:null,//星星的类型(不同数字代表不同颜色的星星);主要作用是当两次选择的星星列表不一样时,还原初始type值
     8     isSelected:false,//是否选中
     9     col:null,//水平方向排列位置(0-9)
    10     row:null,//竖直方向排列位置(0-9)
    11     normal:null,//通常状态图片纹理
    12     selected:null,//选中状态图片纹理
    13     count:0,//纪录当前选中次数,主要作用是当选择好要消除的星星后,实现再点一次则消灭星星
    14     ctor:function(normal, type, selected, col, row)
    15     {
    16         this.type = type;
    17         this.normalType = type;
    18         this._super();
    19         this.col = col;
    20         this.row = row;
    21         this.normal = normal;
    22         this.selected = selected;
    23         this.loadTexture(normal);
    24         this.setAnchorPoint(0, 0);
    25     },
    26     //当点击星星的时候,加载不同状态的图片纹理
    27     updateTexture:function()
    28     {
    29         if(this.isSelected)
    30         {
    31             this.loadTexture(this.selected);
    32         }
    33         else
    34         {
    35             this.loadTexture(this.normal);
    36         }
    37     }
    38 });
  • 相关阅读:
    Js实现页面跳转的几种方式
    android给View设置上下左右边框
    mac下安装tomcat
    Series.str方法
    loc() iloc() at() iat()函数
    sudo: pip:找不到命令
    杀死进程方法
    unique()与nunique()
    object数据类型
    set_index()与reset_index()函数
  • 原文地址:https://www.cnblogs.com/zfsSuperDream/p/4063572.html
Copyright © 2011-2022 走看看