Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
Moving blob mechanic? Related: gamedev.stackexchange.com/questions/32204/… –  Byte56 Dec 14 '12 at 17:53
1  
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. –  Byte56 Dec 14 '12 at 17:55
    
Any of your suggestions would work. –  Lautaro Dec 15 '12 at 4:58
add comment

3 Answers

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)

share|improve this answer
add comment

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

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

examples

share|improve this answer
    
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? –  Luis Estrada Dec 14 '12 at 18:54
    
I think it's better now. I'll clean up my comment. –  Byte56 Dec 14 '12 at 18:58
    
@LuisEstrada. Thanks! Im trying it out. –  Lautaro Dec 15 '12 at 7:37
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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