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


0 Members and 1 Guest are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Making a fancy 2D array in HTML5 GM!
« on: January 26, 2012, 10: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, 11:27:26 PM by Gan »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: Making a fancy 2D array in HTML5 GM!
« Reply #1 on: January 26, 2012, 11: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: 4411
Re: Making a fancy 2D array in HTML5 GM!
« Reply #2 on: January 26, 2012, 11: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, 06:46:53 PM by Gan »