robothousegamesrobothousegames

Main News Games Reviews Stats 15 Fans

Rotating co-ordinates and mouse over nightmares

2011-02-14 11:54:22 by robothousegames

My latest game is a trig minefield. I am living in a world of Maths and pain!

I spent all day trying to rotate rectangle points around an origin to allow for mouse-rollover functionality of objects in a bitmapdata game. I have a central circular object with objects sat on the surface, the entire thing is rotatable - therein lies the co-ordinate nightmare. Sadly I don't have the luxury of using movieclips and rollovers - I really need the extra performance boost from Bitmapdata.

Anywho, after wrestling with rotating rectangles around an origin all morning I came to a far simpler solution. Rotate a single point for each object(in this instance half-width(x), height(y)), then loop through an array of all the objects and find which object's point is nearest the mouse. Taddah! insta-mouse-over.

Like most things: simple. head-ache-inducingly-day-consumingly-s imple :)

Rotating co-ordinates and mouse over nightmares


Comments

You must be logged in to comment on this post.