Moving a sprite in 2D matrix array - JavaScript -


I have created a 2D array that contains 10 x 10 maze. Now the problem I have is that I have a maze jpg (when it Actually working on the table) but will move the phantom.

How do I transfer the phantom to a specific distance as it appears like going to the next category?

I have their keyboard functions and I think I'll need this code. But I'm confused about the argument to move a specific class to Spit. playerx = 1 player y = 1 up = maze [player x, player y - 1]; Down = maze [player x, player y + 1]; Left = Mac Array [PlayerX - 1, Player Y]; Right = messier [player x + 1, player y];

There should be a complete maze and your character induction in your canvas.

Your phantom is a circle with a radius 10 (hence it is 20px 20px) but the "square" of your maze is only 6px 6px (because your canvas is 60px 60px and you said that the labyrinth is 10x10 ).

It seems as if it transmits a class, you need to first fit it to a cell. Maximize your canvas (200px to 200px if you want to keep 10px radius)

Then when you want to draw the phantom, you can specify its position:

  PlayerX = 4; // 0 & lt; = PlayerX & lt; 10 players Y = 5; // 0 & lt; = Player Y & lt; 10 MacNovas. Cac (10 + PlayerX * 20, 10+ Player Y * 20, 10, 0, 2 * Monastery. PI, true);    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -