Thread: Canvas Problem
View Single Post
Old 12-05-2012, 02:31 AM   PM User | #36
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,211
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
There are several things in your code that don't make sense.

For instance, you *SEEM* to specify that the size of a "grass" image is 50x50 pixels. You *SEEM* to do that here:
Code:
#grass{
	height: 50px;
	width: 50px;
	background: url(new/grass.png):
	position: relative;
	float: left;
}
But that's all wrong, because you are using #grass so that style will *ONLY* affect an element which has id="grass". If it was meant to affect MANY elements, it should have been specified as .grass and then the elements would use class="grass".

In any case, when you increment the positions where you draw the images, you only increase by 25 pixels to the right and down.

The increases *MUST* match the sizes of the images you are dropping in there.

When you reset the tilePos you do
Code:
    tilePos=-50l
yet in the initialization code you did
Code:
var tilePos=-25;
But both of them needlessly complicate matters.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote