Search Results

Search found 2 results on 1 pages for 'gyhgowvi'.

Page 1/1 | 1 

  • Z axis in isometric tilemap

    - by gyhgowvi
    I'm experimenting with isometric tile maps in JavaScript and HTML5 Canvas. I'm storing tile map data in JavaScript 2D array. // 0 - Grass // 1 - Dirt // ... var mapData = [ [0, 0, 0, 0, 0], [0, 0, 1, 0, 0, ... ] and draw for(var i = 0; i < mapData.length; i++) { for(var j = 0; j < mapData[i].length; j++) { var p = iso2screen(i, j, 0); // X, Y, Z context.drawImage(tileArray[mapData[i][j]], p.x, p.y); } } but this function mean's all tile Z axis is equal to zero. var p = iso2screen(i, j, 0); Maybe anyone have idea and how to do something like mapData[0][0] Z axis equal to 3 mapData[5][5] Z axis equal to 5? I have idea: Write function for grass, dirt and store this function to 2D array and draw and later mapData[0][0].setZ(3); But it is good idea to write functions for each tiles?

    Read the article

  • A* Start path finding in HTML5 Canvas

    - by gyhgowvi
    I'm trying implement A* Start path finding in my games(which are written with JavaScript, HTML5 Canvas). Library for A* Start found this - http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html and now I'm using this library for path finding. And with this library, I'm trying write a simple test, but stuck with one problem. I'm now done when in HTML5 canvas screen click with mouse show path until my mouse.x and mouse.y. Here is a screenshot - http://oi46.tinypic.com/14qxrl.jpg (Pink square: Player, Orange squares: path until my mouse.x/mouse.y) Code how I'm drawing the orange squares until my mouse.x/mouse.y is: 'http://pastebin.com/bfq74ybc (Sorry I do not understand how upload code in my post) My problem is I do not understand how to move my player until path goal. I've tried: 'http://pastebin.com/nVW3mhUM But with this code my player is not beung drawn.(When I run the code, player.x and player.y are equals to 0 and when I click with the mouse I get the path player blink and disappear) Maybe anyone know how to solve this problem? And I'm very very very sorry for my bad English language. :)

    Read the article

1