加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

markObject备份

发布时间:2020-12-15 06:57:10 所属栏目:百科 来源:网络整理
导读:? /** ?* ?* 棱形画法 : ?* ?* ?* import flash.display.*; ??? ??????? var star_commands:Vector.int = new Vector.int() ??????? star_commands.push(1,2,2); ?????? var? centerX:Number=200; var centerY:Number=200 var tileW:Number=60;//30 var til
?

/**
?*
?* 棱形画法 :
?*
?*
?* import flash.display.*;
???
??????? var star_commands:Vector.<int> = new Vector.<int>()
??????? star_commands.push(1,2,2);

??????


var? centerX:Number=200;
var centerY:Number=200
var tileW:Number=60;//30
var tileH:Number=30//15

var cors:Vector.<Number>=new Vector.<Number>()
cors.push(170,200,215,230,185);
graphics.clear()
? graphics.beginFill(0x003366);
??????? graphics.drawPath(star_commands,cors);
?*
?*
?*/

?

?

?

?

?

?

package utils.games.display
{
?//import flash.display.DisplayObject;
//?import flash.display.DisplayObjectContainer;
?
?import flash.display.Shape;
?import flash.geom.Point;
?
//?import mx.core.UIComponent;
?
?import utils.games.utils.GameConstant;
?import utils.games.utils.MapUtil;
?
?/**
? * ...
? * @author dreamnight
? *
? * //障碍物 点 和路点 的类?? 这类只用于 放点
? */
?public class MarkObject extends GameObject
?{
??private var _type:int;//值为0或者1 或者其他以后扩展用到的数? 值为GameConstant里的值
??private var _tilePosition:Point;
??private var tileWidth:int;
??private var tileHeight:int
??
??/*
?? * _x _y 是tile 逻辑坐标???????????? ????type? :??? GameConstant.BLOCK? ====0
?? * */
??public function MarkObject(tileW:int,tileH:int,_x:int,_y:int,myType:int=0)
??{
???super(tileW,tileH,_x,_y);
???this._type = myType;
??//?setTilePosition(_x,_y);
???tileWidth = tileW;
???tileHeight = tileH;
???setTileCneterPosition(_x,_y,tileWidth,tileHeight);
???
???drawMark(myType);
???
???
???
???///设置alpha
??this.alpha = 0.4;
???
??}
??
??
??//getter
??
??public function get type():int {
???
???
???return this._type;
???
???}
???
???
???// 为 0则画 红色的block 圆 为1则画蓝色的way 圆
???
???
???private function drawMark(_type:int):void {
????var col:uint;
???switch(_type){
???case GameConstant.BLOCK:?? //? 为0? block
????col = 0xFF0000;
????break;
????case GameConstant.WAY://1
????col = 0x00FF00;??? //绿色? 可走点
????break;
/*????case GameConstant.BARRIER:// 为2 barrier? 局部障碍
????col = 0xFF00FF;*/
????break;
????
????
????
????
????case? 2 :?????
????col = 0xFFD760;? //消隐点?? 除了可走之外 另外半透明化
????
????break;
????????///>=3 是通道跳转点
????case? 3 :
????col = 0x9D7FF5;
????
????break;
????
????case? 4 :
????col =0x0009A3;
????
????break;
????
????case? 5 :
????col = 0x60F7FF
????
????break;
????
????case? 6 :
????col = 0xF5A191
????
????break;
????
????case? 7 :
????col = 0xB390BA
????
????break;
????
????case? 8 :
????col = 0x6A443A
????break;
????
????case? 9 :
????
????col = 0x9498A3
????break;
????
????case? 10 :
????col = 0xA0BAB1
????
????break;
????
????case? 11 :
????col = 0x104847
????
????break;
????
????case 12 :
????col = 0x199CBA
????break;
????
????case 13:
????col = 0x398255
????break;
????
????case 14:
????col = 0x89E863;//
????break;
????
????case 15:
????col = 0xF6FF00;
????break;
????case 16:
????col = 0xFF4DD2;

????break;
????
????
????
????
????
????
????
???default :
??//?throw new Error("您输入的type值不符合要求");
??
??//为跳转点
??col = 0xffffff / _type;
??
??trace("MarkObject? default color");
??
???break;
??????
???}
???
???var shape:Shape = new Shape();
???/*var? circle:int = 10;
???shape.graphics.beginFill(col);
???shape.graphics.drawCircle(0,circle);
???shape.graphics.endFill();*/
??///?shape.graphics.clear();
???var star_commands:Vector.<int> = new Vector.<int>()
???var cors:Vector.<Number> = new Vector.<Number>();//坐标信息
???
???cors.push(-tileWidth*0.5,tileHeight*0.5,tileWidth*0.5,-tileHeight*0.5);
???star_commands.push(1,2);
???shape.graphics.clear();
???shape.graphics.beginFill(col);
???shape.graphics.drawPath(star_commands,cors);
???this.addChild(shape);
???
???
???
???
???
????
????}
???
????
??????/*
?? *? _x,_y 是tile坐标? 设置的是tile中心点的flash坐标
?? * */
??public function? setTileCneterPosition(_x:int,tileWidth:int,tileHeight:int):void {
???_tilePosition = new Point(_x,_y);
???var position:Point = MapUtil.getTileCenterByTilePoint(tileWidth,tileHeight,_y);
???this.x = position.x;
???this.y = position.y;
???
???}
???
???
??
??override?public function? getTilePosition():Point {
????
????return _tilePosition
????
????}
??
????
????
????
????override public function release():void {
?????
?????
?????super.release();
?????_tilePosition = null;
?????
?????}
????
??
??/// end class
?}

}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读