Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser matrix rotate

 var matrix = [
        [ 1, 1, 1, 1, 1, 1 ],
        [ 2, 0, 0, 0, 0, 4 ],
        [ 2, 0, 1, 2, 0, 4 ],
        [ 2, 0, 3, 4, 0, 4 ],
        [ 2, 0, 0, 0, 0, 4 ],
        [ 3, 3, 3, 3, 3, 3 ]
];

// rotated matrix
matrix = Phaser.Utils.Array.Matrix.RotateRight(matrix);
Comment

phaser rotate matrix 180

function create ()
{
    this.add.text(10, 10, 'Click to rotate the array matrix 180', { font: '16px Courier', fill: '#ffffff' });

    var text = this.add.text(200, 200, '', { font: '32px Courier', fill: '#00ff00' });

    var matrix = [
        [ 1, 1, 1, 1, 1, 1 ],
        [ 2, 0, 0, 0, 0, 4 ],
        [ 2, 0, 1, 2, 0, 4 ],
        [ 2, 0, 3, 4, 0, 4 ],
        [ 2, 0, 0, 0, 0, 4 ],
        [ 3, 3, 3, 3, 3, 3 ]
    ];

    text.setText(Phaser.Utils.Array.Matrix.MatrixToString(matrix));

    this.input.on('pointerup', function () {

        matrix = Phaser.Utils.Array.Matrix.Rotate180(matrix);

        text.setText(Phaser.Utils.Array.Matrix.MatrixToString(matrix));

    });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: JSON Using Its Own Property To Get Promise Value 
Javascript :: phaser remove collider on stop 
Javascript :: javascript object access time complexity 
Javascript :: Bare Minimum Passport Login Pages App.js 
Javascript :: 120. Triangle - JavaScript Solution With Explantion 
Javascript :: testing code through local server using express.js 
Javascript :: js redirection captive portal 
Javascript :: Staircase 
Javascript :: var a = x || y Variable Assignment In JavaScript 
Javascript :: phaser add camera 
Javascript :: repate element every 2 seconds 
Javascript :: ...args javascript 
Javascript :: como hacer un contador de tiempo en javascript 
Javascript :: Use Dynamic Scales 
Javascript :: general hardhat config js file code 
Javascript :: on submit success jquery 
Javascript :: prisma get single data query 
Javascript :: Validation Script Rule 
Javascript :: JSON of first block in cryptocurrency blockchain 
Javascript :: Backbone + Express 
Javascript :: file path to blob javascript 
Javascript :: Solution-4--solution options for reverse bits algorithm js 
Javascript :: convert text to number 
Javascript :: array max in javascript 
Javascript :: router.push 
Javascript :: sort list in javascript 
Javascript :: nextjs apollo client 
Javascript :: Node.js (node 11.12.0) sample 
Javascript :: how to save data in javascript 
Javascript :: javascript continue with Nested Loop 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =