00:00
00:00
robothousegames

Age 40, Male

Game Designer

Portsmouth, England

Joined on 2/8/07

Level:
4
Exp Points:
130 / 180
Exp Rank:
> 100,000
Vote Power:
3.75 votes
Rank:
Civilian
Global Rank:
> 100,000
Blams:
1
Saves:
40
B/P Bonus:
0%
Whistle:
Normal
Trophies:
3
Medals:
151

Rotating co-ordinates and mouse over nightmares

Posted by robothousegames - February 14th, 2011


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

Comments ain't a thing here.