Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit test #41

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b3586cc
commit test
ljh15952 Nov 10, 2021
6701a27
commit test
viaunixue Nov 12, 2021
2314a9a
Add plant x2 speed
ljh15952 Nov 17, 2021
9fc6499
modify
ljh15952 Nov 17, 2021
6083193
zombie x2 speed
ljh15952 Nov 17, 2021
9d75116
Complete x2 speed
ljh15952 Nov 17, 2021
6ef3c0b
mainmenu_image change
viaunixue Nov 17, 2021
faf5c45
menuRect change
viaunixue Nov 17, 2021
4f489b6
Test
ljh15952 Nov 17, 2021
e15dc8f
test
ljh15952 Nov 17, 2021
acb2e25
h0 - 코드 상 오류 생길까봐 일단 0을 복사 붙여넣기했습니다.
Nov 17, 2021
29162c0
Add Coment and set up show information at result panel
ljh15952 Nov 19, 2021
24f3f2c
Add GameManager function
ljh15952 Nov 19, 2021
033a4c7
menu_img
viaunixue Nov 19, 2021
6855edd
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
viaunixue Nov 20, 2021
8f1c875
GameStart_img Change
viaunixue Nov 21, 2021
e8f4cb0
Add Gameoff
viaunixue Nov 21, 2021
f5042e8
Add fullScreenMode
viaunixue Nov 22, 2021
230a64b
결과창 부분 패널화, 부모 클래스 속성 접근관련 논의 조금 필요해보입니다
Nov 22, 2021
72efbde
first commit
nominsol Nov 25, 2021
db61861
추가한 효과음
nominsol Nov 25, 2021
9e8ef78
check problem plzㅜㅜ
ljh15952 Nov 25, 2021
991f771
fix bug
ljh15952 Nov 26, 2021
935b28e
tool
viaunixue Nov 26, 2021
c93471e
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
viaunixue Nov 26, 2021
4dc1089
중화타이머
ljh15952 Nov 26, 2021
2982536
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
ljh15952 Nov 26, 2021
c906f6b
승리 패배 분리
ljh15952 Nov 26, 2021
d304927
결과 창 수정
Nov 26, 2021
3c51fe8
효과음 추가 및 수정
nominsol Dec 2, 2021
2bfabf1
배속기능..
ljh15952 Dec 2, 2021
264392d
배속버튼
ljh15952 Dec 3, 2021
bcaa921
Add MuteButton
viaunixue Dec 3, 2021
7ba7170
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
viaunixue Dec 3, 2021
fab1a74
결과창 수정 1203
Dec 3, 2021
1f1ab93
set text pos
ljh15952 Dec 3, 2021
a687550
공격소리
ljh15952 Dec 3, 2021
cded22f
공속증가 아이템
ljh15952 Dec 3, 2021
3ba30a7
삽 추가
Dec 3, 2021
99684c4
삽 든 상태에서 식물배치하지 못하게 수정
Dec 3, 2021
c8d2d7e
햇빛 아이템 만듬
ljh15952 Dec 4, 2021
998339a
Add Image
ljh15952 Dec 5, 2021
1205b22
Complete Main UI
viaunixue Dec 5, 2021
2c3be7b
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
viaunixue Dec 5, 2021
c28f878
Add Difficulty Config
viaunixue Dec 6, 2021
08071a0
사운드 버튼 해결
ljh15952 Dec 7, 2021
21246bc
난이도 버튼
ljh15952 Dec 7, 2021
a81877c
난이도별 스테이지 연결
ljh15952 Dec 7, 2021
bbe7d40
메인화면 예외처리
ljh15952 Dec 7, 2021
c08107e
소리 추가 구현
nominsol Dec 7, 2021
979ea1c
소리 추가 구현
nominsol Dec 7, 2021
6e7d427
쉬움 난이도 추가, 어려움 난이도 수정
Dec 7, 2021
4e2fd5f
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
Dec 7, 2021
612b082
쉬운 난이도
ljh15952 Dec 8, 2021
e1d2933
final merge
viaunixue Dec 8, 2021
e3418d0
Merge branch 'master' of https://github.com/ljh15952/PythonPlantsVsZo…
viaunixue Dec 8, 2021
bd897e1
Add merge
viaunixue Dec 8, 2021
38e6619
Mainmenu Bugfix
viaunixue Dec 8, 2021
3cb20ca
최종발표에 사용한 파일
Dec 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/pygame.cpython-39.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@

if __name__=='__main__':
main()
pg.quit()
pg.quit()

#커밋 테스트
#커밋 테스트 by jonghyun
Binary file modified resources/graphics/Screen/Adventure_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/graphics/Screen/Adventure_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/ClickedEasy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/ClickedHard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/ClickedMuteSound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/ClickedNormal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/ClickedSound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/EasyMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/GameOff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/HardMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Item1_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Item1_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Item2_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Item2_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/MainMenuBtn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/NextStageBtn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/NormalMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Shovel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/Sound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/SunFlower_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/muteSound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/sound_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/sound_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/speedup1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/speedup2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/graphics/Screen/speedup3.png
Binary file added resources/graphics/Screen/test.png
Binary file added source/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added source/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added source/__pycache__/constants.cpython-37.pyc
Binary file not shown.
Binary file added source/__pycache__/constants.cpython-39.pyc
Binary file not shown.
Binary file added source/__pycache__/main.cpython-37.pyc
Binary file not shown.
Binary file added source/__pycache__/main.cpython-39.pyc
Binary file not shown.
Binary file added source/__pycache__/tool.cpython-37.pyc
Binary file not shown.
Binary file added source/__pycache__/tool.cpython-39.pyc
Binary file not shown.
Binary file added source/component/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added source/component/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added source/component/__pycache__/map.cpython-37.pyc
Binary file not shown.
Binary file added source/component/__pycache__/map.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/component/__pycache__/plant.cpython-37.pyc
Binary file not shown.
Binary file added source/component/__pycache__/plant.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions source/component/menubar.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
__author__ = 'marble_xu'

import os
import random
import pygame as pg
from .. import tool
from .. import constants as c
from ..state import mainmenu as main

PANEL_Y_START = 87
PANEL_X_START = 22
Expand Down Expand Up @@ -65,6 +67,10 @@ def __init__(self, x, y, name_index, scale=0.78):
self.refresh_timer = 0
self.select = True

self.sound_dir = os.path.join('source','sound') #경로 추가
self.start_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '게임시작버튼.mp3')) #버튼을 누르는 소리
self.start_sound.set_volume(2) #소리크기 설정

def loadFrame(self, name, scale):
frame = tool.GFX[name]
rect = frame.get_rect()
Expand All @@ -77,6 +83,8 @@ def checkMouseClick(self, mouse_pos):
x, y = mouse_pos
if(x >= self.rect.x and x <= self.rect.right and
y >= self.rect.y and y <= self.rect.bottom):
if(main.Menu().isClickedSound()) :
self.start_sound.play() #소리를 재생합니다
return True
return False

Expand Down Expand Up @@ -251,6 +259,10 @@ def loadImages(self, sun_value):
self.button_rect.x = 155
self.button_rect.y = 547

self.sound_dir = os.path.join('source','sound') #경로 추가
self.start_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '게임시작버튼.mp3')) #시작버튼을 누르는 소리
self.start_sound.set_volume(2) #소리크기 설정

def setupCards(self, card_list):
self.card_list = []
x = PANEL_X_START - PANEL_X_INTERNAL
Expand Down Expand Up @@ -301,6 +313,8 @@ def checkStartButtonClick(self, mouse_pos):
x, y = mouse_pos
if (x >= self.button_rect.x and x <= self.button_rect.right and
y >= self.button_rect.y and y <= self.button_rect.bottom):
if(main.Menu().isClickedSound()) :
self.start_sound.play() #소리를 재생합니다
return True
return False

Expand Down
83 changes: 69 additions & 14 deletions source/component/plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import random
import pygame as pg
from pygame.color import Color
from .. import tool
from .. import constants as c
import os
from ..state import mainmenu as main



class Car(pg.sprite.Sprite):
def __init__(self, x, y, map_y):
Expand All @@ -19,18 +24,24 @@ def __init__(self, x, y, map_y):
self.state = c.IDLE
self.dead = False

self.sound_dir = os.path.join('source','sound') #경로 추가
self.drive_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '잔디깎이돌진.mp3')) #잔디깎이가 돌진하는 소리
self.drive_sound.set_volume(0.1)

def update(self, game_info):
self.current_time = game_info[c.CURRENT_TIME]
if self.state == c.IDLE:
pass
elif self.state == c.WALK:
self.rect.x += 4
self.rect.x += 4 * c.DELTA_TIME
if self.rect.x > c.SCREEN_WIDTH:
self.dead = True

def setWalk(self):
if self.state == c.IDLE:
self.state = c.WALK
if(main.Menu().isClickedSound()) :
self.drive_sound.play()

def draw(self, surface):
surface.blit(self.image, self.rect)
Expand All @@ -55,6 +66,12 @@ def __init__(self, x, start_y, dest_y, name, damage, ice):
self.state = c.FLY
self.current_time = 0

self.sound_dir = os.path.join('source','sound') #경로 추가
self.attack_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '식물이공격하는소리.mp3')) #식물이 공격하는 소리
self.attack_sound.set_volume(0.2)
if(main.Menu().isClickedSound()) :
self.attack_sound.play()

def loadFrames(self, frames, name):
frame_list = tool.GFX[name]
if name in tool.PLANT_RECT:
Expand Down Expand Up @@ -87,10 +104,10 @@ def update(self, game_info):
self.current_time = game_info[c.CURRENT_TIME]
if self.state == c.FLY:
if self.rect.y != self.dest_y:
self.rect.y += self.y_vel
self.rect.y += self.y_vel * c.DELTA_TIME
if self.y_vel * (self.dest_y - self.rect.y) < 0:
self.rect.y = self.dest_y
self.rect.x += self.x_vel
self.rect.x += self.x_vel * c.DELTA_TIME
if self.rect.x > c.SCREEN_WIDTH:
self.kill()
elif self.state == c.EXPLODE:
Expand Down Expand Up @@ -128,6 +145,15 @@ def __init__(self, x, y, name, health, bullet_group, scale=1):
self.animate_interval = 100
self.hit_timer = 0


self.sound_dir = os.path.join('source','sound') #경로 추가
self.attack_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '식물이공격하는소리.mp3')) #식물이 공격하는 소리
self.attack_sound.set_volume(0.2)

self.atkUpTimer = 0
self.isShooter = False


def loadFrames(self, frames, name, scale, color=c.BLACK):
frame_list = tool.GFX[name]
if name in tool.PLANT_RECT:
Expand Down Expand Up @@ -192,6 +218,14 @@ def animation(self):
else:
self.image.set_alpha(192)

if(c.ATK_TIME_UP == 2 and self.isShooter):
if(self.current_time - self.atkUpTimer) >= 300:
self.image.set_alpha(255)
self.atkUpTimer = self.current_time
else:
self.image.set_alpha(192)


def canAttack(self, zombie):
if (self.state != c.SLEEP and zombie.state != c.DIE and
self.rect.x <= zombie.rect.right):
Expand Down Expand Up @@ -227,16 +261,20 @@ def __init__(self, x, y, dest_x, dest_y, is_big=True):
scale = 0.6
self.sun_value = 12
Plant.__init__(self, x, y, c.SUN, 0, None, scale)
self.move_speed = 1
self.move_speed = 1
self.dest_x = dest_x
self.dest_y = dest_y
self.die_timer = 0

self.sound_dir = os.path.join('source','sound') #경로 추가
self.getSun_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '빛에너지.mp3')) #빛에너지를 먹는 소리


def handleState(self):
if self.rect.centerx != self.dest_x:
self.rect.centerx += self.move_speed if self.rect.centerx < self.dest_x else -self.move_speed
self.rect.centerx += self.move_speed * c.DELTA_TIME if self.rect.centerx < self.dest_x else -self.move_speed * c.DELTA_TIME
if self.rect.bottom != self.dest_y:
self.rect.bottom += self.move_speed if self.rect.bottom < self.dest_y else -self.move_speed
self.rect.bottom += self.move_speed * c.DELTA_TIME if self.rect.bottom < self.dest_y else -self.move_speed * c.DELTA_TIME

if self.rect.centerx == self.dest_x and self.rect.bottom == self.dest_y:
if self.die_timer == 0:
Expand All @@ -250,6 +288,8 @@ def checkCollision(self, x, y):
return False
if(x >= self.rect.x and x <= self.rect.right and
y >= self.rect.y and y <= self.rect.bottom):
if(main.Menu().isClickedSound()) :
self.getSun_sound.play()
self.state = c.DIE
self.kill()
return True
Expand All @@ -272,9 +312,11 @@ class PeaShooter(Plant):
def __init__(self, x, y, bullet_group):
Plant.__init__(self, x, y, c.PEASHOOTER, c.PLANT_HEALTH, bullet_group)
self.shoot_timer = 0

self.isShooter = True
def attacking(self):
if (self.current_time - self.shoot_timer) > 2000:
if (self.current_time - self.shoot_timer) > 2000 / c.ATK_TIME_UP:
if(main.Menu().isClickedSound()) :
self.attack_sound.play() #소리 재생
self.bullet_group.add(Bullet(self.rect.right, self.rect.y, self.rect.y,
c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, False))
self.shoot_timer = self.current_time
Expand All @@ -283,9 +325,12 @@ class RepeaterPea(Plant):
def __init__(self, x, y, bullet_group):
Plant.__init__(self, x, y, c.REPEATERPEA, c.PLANT_HEALTH, bullet_group)
self.shoot_timer = 0
self.isShooter = True

def attacking(self):
if (self.current_time - self.shoot_timer) > 2000:
if (self.current_time - self.shoot_timer) > 2000 / c.ATK_TIME_UP:
if(main.Menu().isClickedSound()) :
self.attack_sound.play() #소리 재생
self.bullet_group.add(Bullet(self.rect.right, self.rect.y, self.rect.y,
c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, False))
self.bullet_group.add(Bullet(self.rect.right + 40, self.rect.y, self.rect.y,
Expand All @@ -298,9 +343,12 @@ def __init__(self, x, y, bullet_groups, map_y):
self.shoot_timer = 0
self.map_y = map_y
self.bullet_groups = bullet_groups
self.isShooter = True

def attacking(self):
if (self.current_time - self.shoot_timer) > 2000:
if (self.current_time - self.shoot_timer) > 2000 / c.ATK_TIME_UP:
if(main.Menu().isClickedSound()) :
self.attack_sound.play() #소리 재생
offset_y = 9 # modify bullet in the same y position with bullets of other plants
for i in range(3):
tmp_y = self.map_y + (i - 1)
Expand All @@ -315,9 +363,12 @@ class SnowPeaShooter(Plant):
def __init__(self, x, y, bullet_group):
Plant.__init__(self, x, y, c.SNOWPEASHOOTER, c.PLANT_HEALTH, bullet_group)
self.shoot_timer = 0
self.isShooter = True

def attacking(self):
if (self.current_time - self.shoot_timer) > 2000:
if (self.current_time - self.shoot_timer) > 2000 / c.ATK_TIME_UP:
if(main.Menu().isClickedSound()) :
self.attack_sound.play() #소리 재생
self.bullet_group.add(Bullet(self.rect.right, self.rect.y, self.rect.y,
c.BULLET_PEA_ICE, c.BULLET_DAMAGE_NORMAL, True))
self.shoot_timer = self.current_time
Expand Down Expand Up @@ -446,6 +497,8 @@ def digest(self):
elif (self.current_time - self.digest_timer) > self.digest_interval:
self.digest_timer = 0
self.attack_zombie.kill()
#식물쪽에서 좀비를 죽이는거 카운트
tool.GameManager.getInstance().addKillZombieCount()
self.setIdle()

class PuffShroom(Plant):
Expand Down Expand Up @@ -570,6 +623,8 @@ def attacking(self):
self.zombie_group.remove(self.attack_zombie)
if (self.frame_index + 1) == self.frame_num:
self.attack_zombie.kill()
#식물쪽에서 좀비를 죽이는거 카운트
tool.GameManager.getInstance().addKillZombieCount()
self.health = 0
elif self.aim_timer == 0:
self.aim_timer = self.current_time
Expand Down Expand Up @@ -847,8 +902,8 @@ def idling(self):
self.move_timer = self.current_time
elif (self.current_time - self.move_timer) >= self.move_interval:
self.rotate_degree = (self.rotate_degree - 30) % 360
self.init_rect.x += self.vel_x
self.init_rect.y += self.vel_y
self.init_rect.x += self.vel_x * c.DELTA_TIME
self.init_rect.y += self.vel_y * c.DELTA_TIME
self.handleMapYPosition()
if self.shouldChangeDirection():
self.changeDirection(-1)
Expand Down Expand Up @@ -940,7 +995,7 @@ def idling(self):
self.move_timer = self.current_time
elif (self.current_time - self.move_timer) >= self.move_interval:
self.rotate_degree = (self.rotate_degree - 30) % 360
self.init_rect.x += self.vel_x
self.init_rect.x += self.vel_x * c.DELTA_TIME
if self.init_rect.x > c.SCREEN_WIDTH:
self.health = 0
self.move_timer += self.move_interval
Expand Down
22 changes: 19 additions & 3 deletions source/component/zombie.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
__author__ = 'marble_xu'

import os
import pygame as pg
from .. import tool
from .. import constants as c
from ..state import mainmenu as main


class Zombie(pg.sprite.Sprite):
def __init__(self, x, y, name, health, head_group=None, damage=1):
Expand All @@ -19,6 +22,12 @@ def __init__(self, x, y, name, health, head_group=None, damage=1):
self.rect.centerx = x
self.rect.bottom = y

self.sound_dir = os.path.join('source','sound') #경로 추가
self.dying_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '좀비가죽을때.mp3')) #좀비가 죽는 소리
self.headDrop_sound = pg.mixer.Sound(os.path.join(self.sound_dir, '좀비머리가떨어질때.mp3')) #좀비 머리가 떨어질 때 소리
self.dying_sound.set_volume(0.5)
self.headDrop_sound.set_volume(0.5)

self.health = health
self.damage = damage
self.dead = False
Expand All @@ -34,7 +43,7 @@ def __init__(self, x, y, name, health, head_group=None, damage=1):
self.ice_slow_ratio = 1
self.ice_slow_timer = 0
self.hit_timer = 0
self.speed = 1
self.speed = 1
self.freeze_timer = 0
self.is_hypno = False # the zombie is hypo and attack other zombies when it ate a HypnoShroom

Expand Down Expand Up @@ -78,9 +87,9 @@ def walking(self):
if (self.current_time - self.walk_timer) > (c.ZOMBIE_WALK_INTERVAL * self.getTimeRatio()):
self.walk_timer = self.current_time
if self.is_hypno:
self.rect.x += self.speed
self.rect.x += self.speed * c.DELTA_TIME
else:
self.rect.x -= self.speed
self.rect.x -= self.speed * c.DELTA_TIME

def attacking(self):
if self.health <= 0:
Expand All @@ -104,6 +113,7 @@ def attacking(self):
self.setWalk()

def dying(self):

pass

def freezing(self):
Expand All @@ -120,6 +130,9 @@ def freezing(self):

def setLostHead(self):
self.losHead = True
if(main.Menu().isClickedSound()) :
self.headDrop_sound.play() #소리를 재생합니다

if self.head_group is not None:
self.head_group.add(ZombieHead(self.rect.centerx, self.rect.bottom))

Expand Down Expand Up @@ -203,9 +216,12 @@ def setAttack(self, prey, is_plant=True):
self.changeFrames(self.attack_frames)

def setDie(self):
if(main.Menu().isClickedSound()) :
self.dying_sound.play() #소리를 재생합니다
self.state = c.DIE
self.animate_interval = 200
self.changeFrames(self.die_frames)
tool.GameManager.getInstance().addKillZombieCount()

def setBoomDie(self):
self.state = c.DIE
Expand Down
Loading