Jump to content

HTML5 Question - help needed.


agarza

Recommended Posts

Hello,

 

I've been playing lately about with the new canvas features of html5.

I did a method that draws a little 5 by 5 map in a canvas by inserting 25 images.

The only problem is that when I call it manually it doesn't add the images; however, if I use <body onLoad="fucntion();"> it works.

I realized that the script does run (when i call the method manually), but when it runs this line

ctx.drawImage(mapTilesImage, (mapTiles[index][3]*32), (mapTiles[index][2]*32), 32, 32, xCount, yCount, 32, 32);

the image is not drawn in the canvas. Also, if I make it send an alert() just before it runs that line it seems to draw the image after i close the alert window.

 

I tried figuring it out, but I couldn't so I decided to ask.

If you need the code let me know..

 

thanks in advance..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.