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 :: Example: How to use || operator to shorten the code. 
Javascript :: phaser wrap sprite 
Javascript :: select final 2 indexes in JS 
Javascript :: react native ios accessibility font size 
Javascript :: function listview list grud abnAlhaj 
Javascript :: what is setImmediate vs clearImmediate 
Javascript :: Declare Function In Class Constructor 
Javascript :: force browser reload page from server javascript 
Javascript :: select next occurrence visual studio 
Javascript :: maptable elo 
Javascript :: querySelectorAll select multiple element types 
Javascript :: array operations = map, filter, find, reduce, some, every, indexOf 
Javascript :: continuously update last updated time react js 
Javascript :: react-native navigation homeStack 
Javascript :: javascript call function change last default value 
Javascript :: send a message in the first channel discord.js 
Javascript :: Enqueue jquery for TypeError: $.browser is undefined issue 
Javascript :: pnpm tailwind react 
Javascript :: use spread operator in max method javascript 
Javascript :: discord.js create a private channel 
Javascript :: how to change array elements position in array in javascript 
Javascript :: react custum toogle 
Javascript :: get selected data items kendo grid 
Javascript :: javascript add button 
Javascript :: json stringify without quotes 
Javascript :: regex in javascript 
Javascript :: sort include sequelize 
Javascript :: Manage selection fabric js 
Javascript :: js how to get n fibonacci number 
Javascript :: array of numbers to array of objects 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =