def draw(self): if not self.is_ready and self.shoot and self.can_draw: rise_event(Events.HIT_ENEMY_CHECK, { "pt_from": self.player_position, "pt_to": self.pt_to }) self.draw_railgun()
def call_shoot_event(self): self.pt_to = self.player_position + ( 1260 * (self.mouse_position - self.player_position).norm()) rise_event(Events.SHOOT, { "pt_from": self.player_position, "pt_to": self.pt_to })
def bazooka_shot(self, direction): rise_event( Events.SHOOT2, { "atack_type": "Baz", "fro": self.current_position + direction.norm() * 15, "direction": direction * self.velocity.len() }) self.ammo_bazooka -= 10
def process_event(self,event): if event.type == Events.SHOOT: point = self.check_intersection(event.pt_from, event.pt_to) if point is None: point = event.pt_to rise_event( Events.INTERSECTION, { "point" : point } )
def railgun_shot(self, direction): if self.draw_railgun: return self.railgun_to = self.current_position + (direction.norm() * 400) rise_event( Events.SHOOT2, { "atack_type": "Rai", "enemy_id": self.m_id, "fro": self.current_position + direction.norm() * 15, "to": self.current_position + (direction.norm() * 400) }) self.ammo_railgun -= 30 self.railgun_time_to_draw = time.time()
def update(self, delta): self.delta += 98 * delta if self.delta > self.cooldown: self.delta = self.cooldown rise_event(Events.IS_READY, {})
def __send_collision_message(self, unit, unit_2, is_stuck,delta): rise_event(Events.COLLIDE, { "who" : unit.id, "hurt": ( False if unit_2.state == "Const" else True), "stuck" : is_stuck, "with" : unit_2.id, "where" : unit.current_position - unit.velocity*delta } )
def __detect_collision_with_wall(self, unit,delta): if not self.is_in_square(unit, delta) : rise_event(Events.COLLIDE, { "who" : unit.id, "hurt" : False, "stuck" : False, "with" : -1, "where" : unit.current_position - unit.velocity*delta } )