Jump to content

Best way to Dynamically draw Geometric Shape


Recommended Posts



I have currently developing a tile-based puzzle game.

I need to draw block/cell dynamically (the width/height and x/y count can change),


What is the best way to achieve this?

From what I have tried, rectangle class only used for debugging, and rendering debug.geom always draw it on top of everything.


Another way I can imagine is creating a sprite for block, and draw it in loop, but I still don't know how to achieve this, since there doesnt seem any way to override rendering method of a sprite.



Link to comment
Share on other sites

Yes, using Graphics will reduce performance as they have to be redrawn every frame. BitmapData on the other hand is much faster as it's just a texture, the same as using a loaded image. The only performance hit you'll take from using BitmapData is that it's not totally straightforward to use BitmapData to create a texture atlas (which will improve performance greatly if using lots of sprites and webGL) but that's not an insurmountable problem by any means.

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.

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.


  • Recently Browsing   0 members

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