Having some experience of XNA but none of 3D programming. I have an idea i want to realize but i have not decided to do it in 3d or 2d. Im not sure which one will be best in XNA.

I want to have a shape like a blob that can reshape depending on input. The morphing does not need to be very advanced. It could be a circle (2d) or globe (3d) that just has one point that moves slightly in a random direction.

In ASP.NET i have made this through the 2d Draw classes where i can make lines, circles, squares etc and then modify the points that makes them up. But it seems to me that XNA does not have classes for making 2d shapes (can i get this confirmed?). If it had, then this would be the quickest solution for me.

  • \$\begingroup\$ Moving blob mechanic? Related: gamedev.stackexchange.com/questions/32204/… \$\endgroup\$ – MichaelHouse Dec 14 '12 at 17:53
  • 1
    \$\begingroup\$ Are you asking how to create 2D shapes or are you asking what libraries you can use to make 2D shapes? The latter would be not constructive and is where your current answers are heading. I suggest you make it clear so the question doesn't get closed as not constructive. \$\endgroup\$ – MichaelHouse Dec 14 '12 at 17:55
  • \$\begingroup\$ Any of your suggestions would work. \$\endgroup\$ – Daarwin Dec 15 '12 at 4:58

You'll need to use a library or make your own.

Here's one you can use: http://www.drippingflames.com/xna/


  • \$\begingroup\$ Thanks Byte56, I rewrote it to act more like an answer to the question. Should I remove the answer and place it as a comment? \$\endgroup\$ – Luis Estrada Dec 14 '12 at 18:54
  • \$\begingroup\$ I think it's better now. I'll clean up my comment. \$\endgroup\$ – MichaelHouse Dec 14 '12 at 18:58

You are right. XNA does not have a build in method for creating primitives (eg. 2D circles) and the way that I've had to implement it previously is by building my own primitive shape builder that pieces lines together.

The good thing about this is that there's loads of examples out there on the net how to do this, and you might bump into some source code that you could reuse (with the writers permission of course).

A quick search has revealed this project on Bitbucket : https://bitbucket.org/C3/2d-xna-primitives/wiki/Home

And a good looking tutorial if you want to read up on the science : http://www.bit-101.com/blog/?p=2832 (he talks about drawing a circle too)


I'd suggest sticking with a 2D game. At least then you won't need to muck about with matrices (as far as I can remember). On the other hand, if you want primitives then you'll need to deal with matricies anyway, as XNA only has 3D primitives. So, if you really have your heart set on 2D primitives, just use these with the Z component set to 0.

I'd suggest looking at http://rbwhitaker.wikidot.com/primitives-tutorials to get a handle on how to draw 3D primitives. Actually, http://rbwhitaker.wikidot.com/xna-tutorials has great tutorials covering a ton of stuff from 2D to 3D to HLSL and more. It was my starting point with XNA.

But for 2D Primitives, go and at least check out Luis Estrada's suggested library.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.