Suljettu

Game development in Cocos creator

I encountered a problem in [login to view URL] game development.

I'm going to create new one sprite by combining same sprites with different offsets.

I work on cocos creator v.2.0.0

My basic code is as follows. Of course it is not work correctly.

..........................

var spriteUrl = "texture/brush";

var spriteOffsets = {

[login to view URL](5, 7),

[login to view URL](8, 10),

...

}

...

[login to view URL](spriteOffsets );

...

createOneSpriteWithdifferentOffsets(spriteOffsets ) {

var canvas, context, texture;

canvas = [login to view URL]('canvas');

[login to view URL] = max-width of offsets;

[login to view URL] = max-height of offsets;

context = [login to view URL]('2d');

for(var i = 0; i < spriteOffsets .length; i++){

context .drawImage(spriteUrl, spriteOffsets[i]);

}

texture = new [login to view URL]();

[login to view URL](canvas);

[login to view URL]();

let spriteFrame = new [login to view URL]();

[login to view URL](texture);

let node = new [login to view URL]();

let sprite = [login to view URL]([login to view URL]);

[login to view URL] = spriteFrame;

return node;

}

For more, see example.png.

I want to complete my idea as possible as quickly.

Taidot: Javascript

Näytä lisää: cocos creator linux, games made with cocos creator, cocos creator examples, cocos creator games, cocos creator download, cocos creator documentation, cocos creator tutorial, cocos creator c++, iphone game development, flash game development projects bid, flash cs3 game development, outsourcing iphone game development, iphone game development costs, game development j2me, isometric game development, game development projects, game development images, slot game development, game development freelance, iphone app game development

Tietoa työnantajasta:
( 3 arvostelua ) Sanhe, China

Projektin tunnus: #17741123