Thread: Canvas Problem
View Single Post
Old 12-04-2012, 10:06 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Code:
background: url(new/grass.png): << this should be a semi-colon
I'm not sure what you are attempting with this line:
Code:
map[x][y];
but it looks redundant and should be deleted.

The main issue is that you are attempting to read an element beyond the last one (<= length):

Code:
for(x=0; x <= map.length; x++){
// should be
for(x=0; x < map.length; x++){
BTW Your page should have a <title> as well

BTWW I understand it is preferable to use the following to clear the canvas:

Code:
context.clearRect(0, 0, canvas.width, canvas.height);
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 12-04-2012 at 10:14 PM..
AndrewGSW is offline   Reply With Quote