Skip to content

Commit

Permalink
Merge pull request #67 from PHOX-9/main
Browse files Browse the repository at this point in the history
Added enemy Teleporting Mushroom
  • Loading branch information
SauravGitte authored Feb 8, 2025
2 parents 2034007 + 657e49d commit 2e12a1b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
20 changes: 19 additions & 1 deletion enemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,22 @@ def update_behavior(self, player):
# Update action and reset frame if changed
if new_action != self.current_action:
self.current_action = new_action
self.current_frame = 0
self.current_frame = 0

class TeleportingMushroom(Mushroom):

def __init__(self, x, y):
super().__init__(x, y)
self.teleport_timer = 0

def update(self, player):
super().update(player)
self.teleport_timer += 1
if self.teleport_timer > 200:
self.teleport(player)
self.teleport_timer = 0

def teleport(self,player):
"""Teleport to a random position."""
self.x = player.x+random.randint(5, 50)
self.y = player.y+random.randint(5, 30)
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import random
from player import Player
from enemy import FlyingEye, Goblin, Mushroom, Skeleton, EvilWizard, BigFlyingEye, DashingGoblin
from enemy import FlyingEye, Goblin, Mushroom, Skeleton, EvilWizard, BigFlyingEye, DashingGoblin, TeleportingMushroom
from weapon import WeaponManager

# Initialize Pygame
Expand Down Expand Up @@ -47,23 +47,23 @@
'message': "Wave 2: Mini-Boss!"
},
{
'enemies': [(FlyingEye, 8, 1.5), (Goblin, 5, 2)],
'enemies': [(FlyingEye, 8, 1.5), (Goblin, 5, 2), (TeleportingMushroom, 3, 1)],
'message': "Wave 3: Combined Forces!"
},

# Mid-game challenge
{
'enemies': [(Skeleton, 10, 1.5), (FlyingEye, 15, 1)],
'enemies': [(Skeleton, 10, 1.5), (FlyingEye, 15, 1), (TeleportingMushroom, 4, 1)],
'message': "Wave 4: Skeletons Join the Fray!"
},
{
'enemies': [(Mushroom, 5, 2), (Goblin, 12, 1), (FlyingEye, 10, 1.2)],
'enemies': [(Mushroom, 5, 2), (Goblin, 12, 1), (FlyingEye, 10, 1.2), (TeleportingMushroom, 6, 1)],
'message': "Wave 5: Unrelenting Onslaught!"
},

# Final wave
{
'enemies': [(EvilWizard, 2, 3), (Mushroom, 10, 1), (Goblin, 10, 1.5), (Skeleton, 20, 0.8)],
'enemies': [(EvilWizard, 2, 3), (Mushroom, 10, 1), (Goblin, 10, 1.5), (Skeleton, 20, 0.8), (TeleportingMushroom, 8, 1)],
'message': "Wave 6: FINAL WAVE: Ultimate Challenge!"
}
]
Expand Down

0 comments on commit 2e12a1b

Please sign in to comment.