From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Fri, 8 Jul 2022 04:27:42 +0000 (-0400) Subject: fixed jump on head so it pushes u X-Git-Url: http://git.skullheadx.com/nixos/static/simulation.png?a=commitdiff_plain;h=8e930e465316fa76563fe04a498ee0e3b51e6f06;p=Pygame-Jam.git fixed jump on head so it pushes u --- diff --git a/Actors.py b/Actors.py index 28d82f9..16979bb 100644 --- a/Actors.py +++ b/Actors.py @@ -96,6 +96,10 @@ class Actor: self.velocity += pg.Vector2(0.5 * v, -1) + def push2(self, direction): + self.velocity += pg.Vector2(0.5 * direction, -1) + + def move_and_collide(self, pos, vel, delta): pos.x += vel.x * delta collision_rect = self.get_collision_rect(pos) diff --git a/Enemy.py b/Enemy.py index cb3059c..54f71be 100644 --- a/Enemy.py +++ b/Enemy.py @@ -28,7 +28,7 @@ class Enemy(Actor): super().update(delta) if target is not None and self.dizzy_time == 0: self.follow_target(target,stop_dist=self.weapon.width * 0.8 + self.width + target.width) - if random.random() < 2.25/fps and not self.weapon.attacking and self.weapon.get_collision_rect().colliderect(target.get_collision_rect()): + if random.random() < 3/fps and not self.weapon.attacking and self.weapon.get_collision_rect().colliderect(target.get_collision_rect()): self.weapon.swing() target.attack(self, self.weapon) self.dizzy_time -= delta @@ -47,8 +47,7 @@ class Enemy(Actor): def knockout(self, node): self.dizzy_time = 100 self.modify_health(-25, None) - node.on_ground = True - node.jump() + node.push2(math.copysign(1,self.velocity.x)) # self.crouch(1000) def draw(self, surf):