What's more expensive? display.newCircle(...) or display.newImageRect('circle.png'...)

Hi there,

I’m firing missiles (circle shapes) in my game and not sure which way to go.  Should I use display.newCircle or display.newImageRect(…)?

There can be about 10 of these missiles / circles at any one time on the screen.

Any info would be greatly appreciated.

I’d go with display.newImageRect() and a circle image.  This will look better.  Just don’t forget to set the radius attribute on your physics body.  Also, you should enable hybrid draw modewhile testing and debugging to verify the collision body is the same size as your graphic.

display.newCircle uses considerably less texture memory, but it’s probably not significant in the grand scheme of things and as @roaminggamer said, they will probably look better since you can have anti-aliased edges.

Rob

Thanks for the above info guys.

If all you need is a circle, I would actually go with a circle with an aliased stroke or about 4 pixels. It requires an image to fill the stroke for the aliasing, but gives a great effect and gives you much more programmatic flexibility over just using one image.

I’d go with display.newImageRect() and a circle image.  This will look better.  Just don’t forget to set the radius attribute on your physics body.  Also, you should enable hybrid draw modewhile testing and debugging to verify the collision body is the same size as your graphic.

display.newCircle uses considerably less texture memory, but it’s probably not significant in the grand scheme of things and as @roaminggamer said, they will probably look better since you can have anti-aliased edges.

Rob

Thanks for the above info guys.

If all you need is a circle, I would actually go with a circle with an aliased stroke or about 4 pixels. It requires an image to fill the stroke for the aliasing, but gives a great effect and gives you much more programmatic flexibility over just using one image.