Jump to content

Procedural Image Generation In Ga


cdrch
 Share

Recommended Posts

I am attempting to develop a method of procedurally generating images for a game that I am making with Ga. The actual generation is not relevant here; my question is how do I turn an image on an HTML5 canvas into a Ga sprite?

By default, Ga sprites accept a link to the source name, which is normally loaded in by ga.assets.load(), either at the start of the game or when called. However, I see no easy way to instead pass, say, a dataURL or other format easily obtainable from a (hidden) canvas.

Or, alternatively, how can I develop an alternative to ga.sprite that acts exactly the same except for using my created images from a canvas instead of loading a source from disk?

Link to Ga: https://github.com/kittykatattack/ga

Ga.Sprite: https://github.com/kittykatattack/ga/blob/master/ga.js#L1461

Ga.Assets: https://github.com/kittykatattack/ga/blob/master/ga.js#L2065

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...