我使用CreateJs使用五行的老虎机游戏,但我想为此游戏添加更多行。我能够成功地添加更多行,但无法更改行的位置。请参阅图像(https://ibb.co/nnnctf(。创建行的代码在下面。
//LINE 1
var oBut = new CBetBut( 334 + oSprite.width/2, 282 + oSprite.height/2,oSprite,true);
oBut.addEventListenerWithParams(ON_MOUSE_UP, this._onBetLineClicked, this,1);
_aLinesBut[0] = oBut;
//LINE 2
oBut = new CBetBut( 334 + oSprite.width/2, 180 + oSprite.height/2,oSprite,true);
oBut.addEventListenerWithParams(ON_MOUSE_UP, this._onBetLineClicked, this,2);
_aLinesBut[1] = oBut;
//LINE 3
oBut = new CBetBut( 334 + oSprite.width/2, 432 + (oSprite.height/2),oSprite,true);
oBut.addEventListenerWithParams(ON_MOUSE_UP, this._onBetLineClicked, this,3);
_aLinesBut[2] = oBut;
我尝试通过更改上述线路的值,但什么也不会发生。?谢谢
很难确切地根据上述代码绘制行(例如,什么是cbetbut?(。
如果您使用的是图形,则可以保存单个命令,然后以后修改它们。例如:
var g = new createjs.Graphics();
g.beginStroke("red").setStrokeStyle(3).moveTo(0,0);
var p1 = g.lineTo(10,10).command;
var p2 = g.lineTo(20,20).command;
// Later
p1.y = 20;
p2.y = 10;
希望有帮助。您可以在创建JS博客上阅读更多信息。http://blog.createjs.com/new-command-apphacch-to-easeljs-graphics/