A bit blocked

I'm currently blocked, I know the algorithm I want to implement, but I can't seem to pull it out.
I have an arm with a plank at the end. This arm rotates around a central point. What I need now is to check for collisions with the "bullets". My algorithm is as follows:
I create a rect at (0,0)
for every bullet when it needs to check collision I do the following:
1 get the center (easy from the rect)
2 substract the position of the center of the plank (easy as well, as I have a distance and an angle)
3 apply a rotation matrix on the center point
4 create a rect from that point with size of the bullet
5 check collision between the (0,0) rect and the new one

I'm pretty sure I'm having problems rotating the point, but I have tried several approaches and all seem to fail. I'll get some rest and try again later.

If anyone wants to check the code. I've got it on Github
More direct code access in a gist .

The link for the gist is https://gist.github.com/2653909, I can't get it to work either T_T

Willyfrog on 2012/05/10 15:09 of Bot Uprising
edited on 2012/05/10 15:30


Comments: (log in to comment)

this might be another way to do it:
http://effbot.org/zone/tkinter-complex-canvas.htm
Posting it just in case someone else needs it :)
Nevermind I misplaced an x and a y. Now it seems to work (gosh, I hate when something like that happens T_T )
Also, got a working shadow, though I should tweak a bit it's mechanic.