Changeset 356:582a96e5fdac
 Timestamp:
 09/06/13 16:41:29 (9 years ago)
 Branch:
 default
 Phase:
 public
 Location:
 nagslang
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

nagslang/game_object.py
r354 r356 461 461 462 462 class ClawAttack(GameObject): 463 def __init__(self, space, position, vector, damage): 464 body = make_body(1, pymunk.inf, position) 463 def __init__(self, space, pos, vector, damage): 464 body = make_body(1, pymunk.inf, 465 (pos[0] + (vector.length * math.cos(vector.angle)), 466 pos[1] + (vector.length * math.sin(vector.angle)))) 465 467 body.angle = vector.angle 466 468 self.shape = pymunk.Circle(body, 30) … … 474 476 transforms=(FLIP_H,))), 475 477 ) 476 self.physicser.apply_impulse(vector)477 478 478 479 def update(self, dt): 
nagslang/protagonist.py
r341 r356 1 import math 2 1 3 import pymunk 2 4 import pymunk.pygame_util … … 298 300 299 301 def claw(self): 300 vec = vec_from_angle(self.angle, 300) 302 claw_range = (math.sqrt(math.pow(self.physicser.get_velocity()[0], 2) + 303 math.pow(self.physicser.get_velocity()[1], 2)) 304 / 20) + 30 305 vec = vec_from_angle(self.angle, claw_range) 301 306 ClawEvent.post(self.physicser.position, vec, CLAW_DAMAGE) 302 307
Note:
See TracChangeset
for help on using the changeset viewer.