An implementation of the warping grid, made popular by the game Geometry Wars (at least thats when I first became aware of its use). This is a conversion of the XNA tutorial that can be found here: Neon Vector Shooter in XNA. I’ve kept a similar class structure so if you would like more information on how the classes are constructed, I recommend reading that tutorial.
The effect was created using a grid with a ‘spring’ at each intersection. The springs act as a rubber band, where you can apply a directional force to ‘pull’ the band, creating a warping effect.
It is not currently optimised (and i’m not too sure when/if i’ll get round to it) and currently has some performance issues when dealing with large grids. However it’s a good starting point if you want to add a similar effect to your game.
I’ve uploaded a web demo, which you can play below. I’ve made a few changes to the source since this build but it gives you an idea of what I’m talking about.
You can apply three different types of force to the grid explosive, implosive, and directional:
- right-click: Apply explosive force at mouse position
- left-click: Apply implosive force at mouse position
- arrow keys: Apply directional force (in direction of arrow), originating from centre of grid.