background preloader

XNA

Facebook Twitter

Making a Level Preview in XNA. Hey there, Ever wanted to draw a preview or a level for something like a level selection screen or the planning of a vacation?

Making a Level Preview in XNA

Now, you can. There are a few ways that I’ve been able to do this, but I’m going to show you the best way I’ve found. Below is the final result. I’m going to be using my game, Cloud Blaster, but this will work just fine in any game where you load a level from a file. First, you need a sprite sheet. Since Cloud Blaster is built off of the Platformer Starter Kit, I’d recommend trying this with that first, so you can get a handle on how it works before trying it on your own. Now, onto the code. You’ll see in that method, we load a level much like we do in the Platformer Starter Kit.

Along with the LoadTile method, which returns what to draw: The collision above isn’t really needed. For each tile in your level, you want to return a rectangle that tells it what part of the sprite sheet to draw: This part might differ a little for you. Thanks for reading. Logan Nowak. 2D Metaballs in XNA. Download the full source.

2D Metaballs in XNA

Metaballs are organic-looking balls that deform as they merge or split, as shown in the picture below. It’s a neat little effect, often used to render liquids or gels. This is a tutorial on how to produce 2D metaballs in XNA. As a bonus, the code requires no custom shaders, and therefore works equally well on Windows Phone, Xbox, and PC. To produce metaballs, you create a function, f(x, y), that becomes smaller as you get further from the metaball. You can picture this as taking a rubber sheet and placing heavy marbles on it. We will implement this technique as follows: Make a metaball texture using a falloff function.For each metaball, draw the texture to a render target using additive blending.Draw the render target to the backbuffer using AlphaTestEffect. Making the Metaball Texture To make the metaball texture, we must first choose a falloff function. It goes to zero after a given distance. I used the following falloff function: And the metaballs it produces:

Riemers XNA Tutorial > Home. XNA Tutorials - RB Whitaker's Wiki. Welcome to the XNA Tutorials, the largest and easiest to use collection of XNA 4.0 tutorials on the Internet!

XNA Tutorials - RB Whitaker's Wiki

There are plenty of other sites out there, but as far as I know they are either much smaller than this, or way out of date, which is a big deal, since so much changed in version 4.0. You may also find my MonoGame tutorials of interest. MonoGame is an open source port of XNA that runs on a very wide variety of programs, and may ultimately have a longer lifespan than XNA.

About These XNA Tutorials XNA is an extremely powerful and easy to use set of tools for game making, created by Microsoft. I have divided these tutorials up into multiple categories. Below is a diagram of the ordering of the tutorials. RB's Game Development Kit I have also created a list of free software that you can download and use in your game development: RB's Game Development Kit Need Extra Help? The Future of These Tutorials Like I've said, I'm constantly working on these tutorials. XNA Development: Game Development for the masses.