Topic:   Making a fancy 2D array in HTML5 GM!   (Read 2091 times)


0 Members and 1 Guest are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4362
    • View Profile
Making a fancy 2D array in HTML5 GM!
« on: January 26, 2012, 08:54:47 PM »
Code: [Select]
//Create the 2D array
var myArray = [
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,1,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0]]

//Draws the number 1
DrawString(myArray[5][5],50,50)
« Last Edit: January 26, 2012, 09:27:26 PM by Gan »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2351

  • It's a secret to everyone...
    • View Profile
Re: Making a fancy 2D array in HTML5 GM!
« Reply #1 on: January 26, 2012, 09:01:30 PM »
Heeeey it works on multiple lines thanks!
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4362
    • View Profile
Re: Making a fancy 2D array in HTML5 GM!
« Reply #2 on: January 26, 2012, 09:27:40 PM »
Updated! Now the X and Y don't need flipped.

Edit: I lied. X and Y are still backwards. You just gotta do an array flip to fix it.
« Last Edit: January 29, 2012, 04:46:53 PM by Gan »