that wasn't exactly what I was asking but I figured it out anyway. thanks though, I'll probably end up using that piece of code in my game anyway.