Jump to content

How to create a tilemap in a array help needed


Pakz
 Share

Recommended Posts

I am new with javascript and got to the point where I wanted to create a tilemap and draw that to the screen. I was not able to find anything with google so I am asking here now.

 

How do you use javascript to store the data of a tilemap in a array? I have a blog where I put source code on and will put the tilemap example on it as soon as I get how its done.

 

This is my blog btw : (For beginners in game programming) http://html5gameprogrammingstepbystep.blogspot.nl/

Link to comment
Share on other sites

I want to make a map in the source code. Tiles numbering from 0 to 9. It will be a multidimensional array. The size is not more then what can be put on the screen on a 320*240 map with 16*16 tiles.

 

In java I known you can set up the tilemap in the sourcecode in a multidimensional array.

 

something like:

 

array[][]= { {

             0,0,0,0 },

             { 0,0,0,0 },

             { 0,0,0,0 },};

         

Then you can draw using array[y][x]

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...