Mercurial > fife-parpg
diff demos/shooter/scripts/common/helpers.py @ 472:3164715a0621
Added the FireBallBurst and FireBallSpread weapons which are now used by the boss.
Added rotatePoint function.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 16 Apr 2010 21:44:18 +0000 |
parents | 2046a1f2f5f2 |
children | afde89c1d50b |
line wrap: on
line diff
--- a/demos/shooter/scripts/common/helpers.py Thu Apr 15 15:53:06 2010 +0000 +++ b/demos/shooter/scripts/common/helpers.py Fri Apr 16 21:44:18 2010 +0000 @@ -22,6 +22,7 @@ # #################################################################### from fife import fife +import math def normalize(vector): @@ -99,4 +100,15 @@ x = property(_getX, _setX) y = property(_getY, _setY) w = property(_getW, _setW) - h = property(_getH, _setH) \ No newline at end of file + h = property(_getH, _setH) + +def rotatePoint(origin, point, angle): + newp = fife.DoublePoint(0,0) + + theta = (angle * math.pi)/180 + + newp.x = math.cos(theta) * (point.x - origin.x) - math.sin(theta) * (point.y - origin.y) + newp.y = math.sin(theta) * (point.x - origin.x) + math.cos(theta) * (point.y - origin.y) + + return newp + \ No newline at end of file