Re: [pygame] Limited Range?

2009-11-03 Thread Michael George
If you find this is too slow, you'll get much better performance by removing the **'s, they're quite slow compared to other arithmetic. Use x*x instead of x**2 and square both sides of the inequality to remove the **0.5. P.F.C. wrote: I'm not getting the attachment but this might help. If y

[pygame] Limited Range?

2009-11-03 Thread Yanom Mobis
so, I wrote this tower defense game (zip archive attached) and I was wondering how I should go about implementing limited range (each tower can only shoot so far) in the code.

Re: [pygame] Limited Range?

2009-11-03 Thread P.F.C.
I'm not getting the attachment but this might help. If your doing range as a circle with radius = r then: if ((enemy.x-tower.x)**2+ (enemy.y-tower.y)**2)**0.5<=r: attack!!! basically, you'd be using Pythagorean theorem to find the distance to check if it attacks or not. Checking distances for e

Re: [pygame] Render font and usging \n

2009-11-03 Thread Mike Lawrence
Attached is an example that handles line breaks manually; it also handles text wrapping. 2009/11/2 leo kirotawa : > ok, thanks a lot > > On Mon, Nov 2, 2009 at 11:29 PM, Ian Mallett wrote: >> >> No; PyGame does not support that.  You must handle line breaks manually, >> rendering as separate surf