From: <ob...@us...> - 2007-01-09 15:06:11
|
Revision: 11 http://eos-game.svn.sourceforge.net/eos-game/?rev=11&view=rev Author: oberon7 Date: 2007-01-09 07:06:09 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Move FullereneCannon to derive from Steerable. Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-01-09 14:52:07 UTC (rev 10) +++ projectile.py 2007-01-09 15:06:09 UTC (rev 11) @@ -10,6 +10,7 @@ import pygame from pygame.locals import * import game +from steer import Steerable from vector import Vector2D @@ -35,20 +36,18 @@ self.charge = 0 -class Fullerene(pygame.sprite.Sprite): +class Fullerene(pygame.sprite.Sprite, Steerable): - velocity = 9.0 + speed = 9.0 range = 450 color = (255,220,20) particles = 4 def __init__(self, charge, gunmount): pygame.sprite.Sprite.__init__(self, game.sprites) + Steerable.__init__(self, gunmount.position, Vector2D.unit(gunmount.heading) * self.speed, self.speed, 0) self.charge = charge self.size = max(charge * 2, 2) - direction = Vector2D.unit(gunmount.heading) - self.vx = direction.x * self.velocity - self.vy = direction.y * self.velocity self.distance = 0 self.partsize = max(self.charge * 1.25, 2) self.rect = (list(gunmount.rect.center), (self.partsize, self.partsize)) @@ -59,10 +58,10 @@ game.screen.fill((0,0,0), self.rect) def update(self): - self.rect[0][0] += self.vx - self.rect[0][1] += self.vy - self.distance += self.velocity - if self.range - self.distance < self.velocity * 10: + self.rect[0][0] += self.velocity.x + self.rect[0][1] += self.velocity.y + self.distance += self.velocity.len() + if self.range - self.distance < self.speed * 10: self.colormax = int(self.colormax * 0.85) if self.distance >= self.range: self.kill() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-01-15 09:37:09
|
Revision: 33 http://eos-game.svn.sourceforge.net/eos-game/?rev=33&view=rev Author: cduncan Date: 2007-01-15 01:37:05 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Lose some dead code Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-01-15 09:36:14 UTC (rev 32) +++ projectile.py 2007-01-15 09:37:05 UTC (rev 33) @@ -50,8 +50,6 @@ RoundBody.__init__( self, gunmount.body.getPosition(), Vector2D.unit(gunmount.heading) * self.speed + gunmount.body.getLinearVel()) - #Steerable.__init__(self, gunmount.position, - # Vector2D.unit(gunmount.heading) * self.speed, self.speed) self.charge = charge self.distance = 0 self.distance_per_frame = self.speed * game.dt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-06-11 07:32:15
|
Revision: 232 http://eos-game.svn.sourceforge.net/eos-game/?rev=232&view=rev Author: cduncan Date: 2007-06-11 00:32:13 -0700 (Mon, 11 Jun 2007) Log Message: ----------- -- Add collision rays for cannon weapons so they fire when any enemy crosses in front of them. This helps the competence of the Rone ai in a dogfight against multiple enemies. Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-06-10 08:03:35 UTC (rev 231) +++ projectile.py 2007-06-11 07:32:13 UTC (rev 232) @@ -8,8 +8,10 @@ import math import pygame from pygame.locals import * +import ode import game import random +import body from body import RoundBody, everything import vector from vector import fullcircle, halfcircle, rightangle, diagonal @@ -190,6 +192,7 @@ else: self.mount_positions = None self.next_position = 0 + self.ray = None def update_system(self): if (self.enabled and self.firing and game.time - self.last_fire > self.cool_down @@ -215,6 +218,18 @@ @property def targeted(self): + if self.ray is None: + # Create a ray geom to determine beam collision + self.ray = ode.GeomRay(game.collision_space, self.range * 1.1) + self.ray.setCategoryBits(body.nothing) + self.ray.setCollideBits(body.everything & ~self.gunmount.category) + self.ray.parent = self + self.ray.targeted = False + self.ray.set(vector.to_tuple3(self.gunmount.position), + vector.to_tuple3(vector.unit(self.gunmount.heading))) + if self.ray.targeted: + self.ray.targeted = False + return True if not self.gunmount.control.target: return False else: @@ -231,6 +246,9 @@ elif heading_diff < -halfcircle: heading_diff += fullcircle return abs(heading_diff) < (diagonal / 3) + + def collide(self, other, contact): + self.ray.targeted = True class Shot(RoundBody): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-09-13 07:39:13
|
Revision: 252 http://eos-game.svn.sourceforge.net/eos-game/?rev=252&view=rev Author: cduncan Date: 2007-09-13 00:39:09 -0700 (Thu, 13 Sep 2007) Log Message: ----------- Increase lotus fullerene range/velocity Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-09-13 07:38:19 UTC (rev 251) +++ projectile.py 2007-09-13 07:39:09 UTC (rev 252) @@ -85,8 +85,8 @@ class Fullerene(RoundBody): - speed = 550 - range = 450 + speed = 600 + range = 600 base_damage = 1.0 particles = 4 rpm = 80 @@ -430,7 +430,7 @@ """ shards = 50 shard_velocity = 500 - shard_range = 50 + shard_range = 60 shard_damage = 3.0 min_time = 0.6 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-11-08 22:47:45
|
Revision: 325 http://eos-game.svn.sourceforge.net/eos-game/?rev=325&view=rev Author: cduncan Date: 2007-11-08 14:47:41 -0800 (Thu, 08 Nov 2007) Log Message: ----------- Reduce fullerene shot detail at small apparent sizes Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-11-08 22:47:14 UTC (rev 324) +++ projectile.py 2007-11-08 22:47:41 UTC (rev 325) @@ -141,21 +141,24 @@ def draw(self, surface): partsize = self.partsize * self.apparent_size radius = self.charge / 2 * self.apparent_size - rects = [self.rect] bg = random.randint(0, self.colormax) surface.fill((self.colormax, bg, self.colormax-bg), (self.rect.center, (partsize, partsize))) - for i in self.step: - direction_x, direction_y = vector.to_tuple(vector.unit(self.rot)) - part = (self.rect.centerx + direction_x * radius, - self.rect.centery + direction_y * radius, - partsize, partsize) - rects.append(part) - bg = random.randint(0, self.colormax) - surface.fill((self.colormax, bg, self.colormax-bg) , part) - self.rot += self.partangle - self.rot += self.rot_per_frame - return Rect(rects[0]).unionall(rects) + if radius >= 2: + rects = [self.rect] + for i in self.step: + direction_x, direction_y = vector.to_tuple(vector.unit(self.rot)) + part = (self.rect.centerx + direction_x * radius, + self.rect.centery + direction_y * radius, + partsize, partsize) + rects.append(part) + bg = random.randint(0, self.colormax) + surface.fill((self.colormax, bg, self.colormax-bg) , part) + self.rot += self.partangle + self.rot += self.rot_per_frame + return Rect(rects[0]).unionall(rects) + else: + return self.rect def collide(self, other, contacts): if self.alive(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2007-01-15 10:14:34
|
Revision: 37 http://eos-game.svn.sourceforge.net/eos-game/?rev=37&view=rev Author: oberon7 Date: 2007-01-15 02:14:33 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Removed useless projectile.velocity setting. Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-01-15 10:09:09 UTC (rev 36) +++ projectile.py 2007-01-15 10:14:33 UTC (rev 37) @@ -59,7 +59,6 @@ self.rot = 0 self.step = range(self.particles) self.colormax = 255 - self.velocity = Vector2D.unit(gunmount.heading) * self.speed def clear(self): game.screen.fill((0,0,0), self.rect) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2007-02-16 08:09:37
|
Revision: 113 http://eos-game.svn.sourceforge.net/eos-game/?rev=113&view=rev Author: cduncan Date: 2007-02-16 00:09:36 -0800 (Fri, 16 Feb 2007) Log Message: ----------- AI shouldn't shoot at planets in futility Modified Paths: -------------- projectile.py Modified: projectile.py =================================================================== --- projectile.py 2007-02-15 17:58:02 UTC (rev 112) +++ projectile.py 2007-02-16 08:09:36 UTC (rev 113) @@ -57,6 +57,9 @@ return False else: target = self.gunmount.control.target.sprite + if (target.category is None + or not target.category & everything & ~self.gunmount.category): + return False target_dist = target.position.distance(self.gunmount.position) target_angle = (self.gunmount.position - target.position).radians heading_diff = target.heading - self.gunmount.heading This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |