johnmcglone.com

a blog of things people probably won't care about

Turret Defense version 0.00000001

Okay, so I’m hacking some code in XNA for a TURRET DEFENSE game.  If you don’t know what that is, google it, or play some old school starcraft (custom maps ftw!)
No, in simple terms, the goal of the game is to prevent enemies from getting all the way through a map (from getting past your [...]

I think this matrix multiplication algorithm is simple and efficient

Tell me what you think. (* .c = columns, .r = rows)

public static JMMatrix multiply(JMMatrix A, JMMatrix B)
{
//if the matrices are not able to be multiplied, return null
if(A.c != B.r)
return null;
// the matrix to return
float[][] matrix = new float[A.r][B.c];
//n is the length of the vectors that make up matrix B
int n = B.matrix.length;
[...]

Matrix Multiplication algorithm

I’m trying to write a function that will take 2 matrices of any size, given they are able to be multiplied, and return the result of matrix1 * matrix2. My JMMatrix class works like a charm (just a 2d array!). However, my multiplication function is NOT working.
I’ve kept in mind the following:

Given Matrix [...]

So I plan on creating a Java Library of …

So I plan on creating a Java Library of my own that includes basic, yet efficient, versions of the most popular data structures: like Linked Lists, Binary Trees, Stacks, Queues, etc. Once those are created, I will work on optimizing them as well as creating more complex data structures, starting with balanced trees [...]

Pixel-perfect collision

So I’ve been working in XNA on getting pixel-perfect collision detection. Let’s just say, after 6 hours of coding and refreshing my memory on some Linear Algebra, I got it working.

I was really excited, until I QUICKLY found out… the collision DETECTION is just the first step of this. What happens AFTER the [...]

TEST!