세종대학교 21학번 오픈소스SW개론(Introduction to OSS) 팀 프로젝트 레포지토리입니다.
- [팀장]소프트웨어학과 21 황재동
Map, Audio - 소프트웨어학과 21 안강준
Player, Item - 소프트웨어학과 21 양현석
UI, Scene - 소프트웨어학과 21 최영준
Enemies
프로젝트 디렉토리 구조 확인
src/디렉토리 하위에Main패키지가 존재해야 합니다.src/Main/Main.java가 진입점(Main 클래스)입니다.- 해당 루트에 있는
Main.java파일에서 컴파일 하면 컴파일 됩니다.
플레이어 객체를 제어하는 핵심 클래스입니다.
-
move()
→ 플레이어 이동 처리 -
hit()
→ 플레이어와 적의 충돌 처리 -
updateInvincible()
→ 무적 지속 시간 갱신 -
getHpRatio()
→ 체력 비율 반환 (UI 표시용) -
increasePlayerHP()
→ 체력 1 증가 -
decreasePlayerHP()
→ 체력 1 감소 -
draw(Graphics g)
→ 이미지 출력 및 깜빡임 효과 처리 -
update()
→ 이동 속도 및 방향 계산 -
getBounds()
→ 충돌 판정용 경계(Rectangle) 반환
게임 루프와 화면 처리를 담당하는 메인 패널입니다.
-
setEnemyPanel()
→ 적 패널 참조 연결 -
startGameThread()
→ 게임 스레드 시작 -
run()
→ 게임 루프 실행 (FPS 기반) -
updateGame()
→ 전체 게임 로직 업데이트 -
paintComponent(Graphics g)
→ 그래픽 객체로 화면 출력 -
checkCollisions()
→ 플레이어와 적의 충돌 처리 -
setShotCount(int count)
→ 총알 개수 설정 -
getShotCount()
→ 총알 개수 반환
플레이어의 총알 정보를 관리합니다.
-
isActive()
→ 총알 활성 상태 확인 -
getX(),getY()
→ 총알 위치 반환
아이템의 드랍 및 효과를 담당합니다.
-
PROB_BOMB,PROB_UPGRADE,PROB_HEALTH
→ 아이템 드랍 확률 상수 -
randomDrop()
→ 랜덤 아이템 생성 -
applyEffect(Player player)
→ 아이템 효과 적용 -
getBounds()
→ 충돌 판정용 경계 반환 -
isActive()
→ 활성 상태 확인 -
update()
→ 아이템 이동 및 상태 갱신
-
init()
→ 적 객체 초기 설정 -
draw(Graphics g)
→ 패널에 이미지 출력 -
update()
→ 속도·시간 기반 위치 갱신 -
CollisionResolution()
→ 패널 및 총알과의 충돌 처리 -
isActive()
→ 삭제 필요 여부 반환 -
getBound()
→ 객체 크기 정보 반환 -
reduceHP()
→ 체력 감소, 이펙트 및 파괴 처리 -
run()
→ 피격 시 이펙트 스레드 실행
-
run()
→ 적 이동 및 시간 경과에 따른 난이도 상승 -
setPlayerPanel()
→ 플레이어 패널 참조 설정
-
TileMapGenerator()
→ 생성자 초기화 담당 -
initializeTileRows()
→ 생성자에서 불러 타일 변경을 위한 배열 초기화 -
getTileImages()
→ 리소스에서 타일 이미지 입력 -
updateScroll()
→ 타일맵을 움직이게 해주는 주요 메서드 -
shiftRowsDownWithNewIndex()
→ 화면 밖으로 타일이 벗어나면 아래로 시프트 -
draw(Graphics2D g2)
→ 화면에 타일 그리기
-
MapPanel()
→ 생성자: 패널을 만들어 씬 매니저에 전달하는 역할 -
startGameThread()
→ 스레드 시작 -
run()
→tileMapGenerator의updateScroll()호출 -
paintComponent(Graphics g)
→ 화면에tileMapGenerator의draw()호출
-
play(int index, float volume)
→ 원하는 음원을 재생 -
loop(int index, float volume, boolean continuous, int loopCount)
→ 원하는 음원을 연속 재생 -
playOrLoop(...)
→ 사용자가 사용할 함수 입력에 따라 play or loop 호출 -
stop(int id)
→ id를 이용해 특정 음원 정지 -
stopAll()
→ 모든 음원 정지 (재생되고 있는 것 포함) -
setVolume(Clip clip, float volume)
→ 음원을 재생하기 전 볼륨을 설정
-
setScene()
→ Scene 속성 설정 -
setGameObjectList()
→ Scene 내 객체 등록 -
setUISet()
→ UI 구성 요소 설정
-
setScene()
→ 화면 크기 설정 -
setGameObjectList()
→ 맵, UIPlayerPanel 생성 -
setUISet()
→ 버튼 이벤트 등록 및 UI 구성
-
setScene()
→ 화면 크기 설정 및 InGameManager 리셋 -
setGameObjectList()
→ 맵, 플레이어, 적 등록 -
setUISet()
→ 일시정지 UI 및 리스너 등록
-
setScene()
→ 화면 크기 및 배경 설정 -
setGameObjectList()
→ (없음 또는 필요 시 설정) -
setUISet()
→ 팁 텍스트 및 애니메이션 UI 등록 -
initLoading()
→ 로딩 씬 폰트/텍스트 생성
-
setScene()
→ 화면 크기 설정 -
setGameObjectList()
→ (필요시 설정) -
setUISet()
→ GameOver UI 구성 및 리스너 등록
-
changeScene()
→ 씬 전환 및 초기화 요청 -
innerChangeScene()
→ 패널 제거 후 새 씬 초기화 및 출력
-
loadFonts()
→ UI용 폰트 로딩 -
drawUI(Graphics g)
→ 공통 UI 출력 처리
-
loadImage()
→ Player 이미지 불러오기 -
startInterpolatedMove()
→ 부드러운 움직임 구현 -
scheduleNextRandomMove()
→ 다음 이동 예약 (3~4초 주기) -
generateNewRandomPosition()
→ 랜덤 위치 계산
-
initUIComponents()
→ 타이틀, 버튼 등 초기 설정 -
applyImageToButton()
→ 버튼 이미지 크기 조정 -
getStartButton()
→ 외부에서 Start 버튼 접근 -
getExitButton()
→ 외부에서 Exit 버튼 접근
-
setScore(int)
→ 점수 UI 적용 -
setPlayer()
→ 플레이어 등록 -
startTimerUpdate()
→ 타이머 시작 -
interpolateHealth()
→ 체력 UI 보간 처리 -
drawUI()
→ UI 요소 출력
-
getMainMenuButton()
→ 메인 메뉴 버튼 반환 -
getRetryButton()
→ 재시작 버튼 반환
-
getMainMenuButton()
→ 메인 메뉴 버튼 반환 -
getRetryButton()
→ 재시작 버튼 반환 -
drawUI()
→ 점수 및 시간 출력
-
getInstance()
→ 싱글톤 인스턴스 반환 -
setMainFrame()
→ 메인 프레임 등록 -
getMainFrame()
→ 메인 프레임 반환 -
updateScore()
→ 점수 갱신 -
getScore()
→ 점수 반환 -
getTimer()
→ 시간 반환 -
resetScoreAndTimer()
→ 점수와 시간 초기화
-
getInstance()
→ 싱글톤 인스턴스 반환 -
initialize()
→ 객체 생성 및 초기화 -
resetPause()
→ 일시정지 변수 초기화 -
reset()
→ 글로벌 변수 초기화 -
setPlayer()
→ 플레이어 등록 -
isPaused()
→ 일시정지 여부 확인 -
getPauseOverlayPanel()
→ 배경 패널 반환 -
setupKeyListener()
→ ESC 입력 리스너 설정 -
togglePause()
→ 일시정지 메뉴 토글 -
setPausePanelVisible()
→ 메뉴 UI 표시 -
updateScore()
→ 적 처치 시 점수 갱신
This is the team project repository for the 2021 cohort of
"Introduction to Open Source Software (OSS)" at Sejong University.
- [Team Leader] Jaedong Hwang, Department of Software, Class of 2021 —
Map, Audio - Kangjun Ahn, Department of Software, Class of 2021 —
Player, Item - Hyunseok Yang, Department of Software, Class of 2021 —
UI, Scene - Youngjun Choi, Department of Software, Class of 2021 —
Enemies
Check Project Directory Structure
- The
src/directory must contain aMainpackage. - The entry point is
src/Main/Main.java. - Compile from the root where
Main.javais located.
Core class for controlling the player object.
-
move()
→ Handles player movement -
hit()
→ Handles collisions with enemies -
updateInvincible()
→ Updates invincibility duration -
getHpRatio()
→ Returns health ratio (for UI) -
increasePlayerHP()
→ Increases health by 1 -
decreasePlayerHP()
→ Decreases health by 1 -
draw(Graphics g)
→ Renders player and blinking effect -
update()
→ Calculates movement speed and direction -
getBounds()
→ Returns collision boundary rectangle
Main panel handling the game loop and screen rendering.
-
setEnemyPanel()
→ Links reference to enemy panel -
startGameThread()
→ Starts game thread -
run()
→ Executes game loop (FPS-based) -
updateGame()
→ Updates overall game logic -
paintComponent(Graphics g)
→ Renders screen using graphics object -
checkCollisions()
→ Handles player-enemy collisions -
setShotCount(int count)
→ Sets number of bullets -
getShotCount()
→ Returns number of bullets
Manages player bullet information.
-
isActive()
→ Checks if bullet is active -
getX(),getY()
→ Returns bullet position
Handles item drop and effect application.
-
PROB_BOMB,PROB_UPGRADE,PROB_HEALTH
→ Constants for item drop probabilities -
randomDrop()
→ Creates a random item -
applyEffect(Player player)
→ Applies item effect to player -
getBounds()
→ Returns boundary for collision detection -
isActive()
→ Checks if item is active -
update()
→ Updates item movement and state
-
init()
→ Initializes enemy object -
draw(Graphics g)
→ Renders image on panel -
update()
→ Updates position based on speed and time -
CollisionResolution()
→ Handles collisions with panel and bullets -
isActive()
→ Returns whether to delete the object -
getBound()
→ Returns size info -
reduceHP()
→ Reduces health, triggers effects, and destruction -
run()
→ Runs effect thread when hit
-
run()
→ Moves enemies and increases difficulty over time -
setPlayerPanel()
→ Sets reference to PlayerPanel
-
TileMapGenerator()
→ Constructor for initialization -
initializeTileRows()
→ Initializes array for tile updates -
getTileImages()
→ Loads tile images from resources -
updateScroll()
→ Main method to scroll tile map -
shiftRowsDownWithNewIndex()
→ Shifts tiles when out of view -
draw(Graphics2D g2)
→ Draws tiles on screen
-
MapPanel()
→ Constructor that sends panel to scene manager -
startGameThread()
→ Starts thread -
run()
→ CallsupdateScroll()fromtileMapGenerator -
paintComponent(Graphics g)
→ Callsdraw()fromtileMapGeneratorto render
-
play(int index, float volume)
→ Plays specified sound -
loop(int index, float volume, boolean continuous, int loopCount)
→ Loops specified sound -
playOrLoop(...)
→ Determines whether to play or loop based on input -
stop(int id)
→ Stops specific sound by id -
stopAll()
→ Stops all sounds -
setVolume(Clip clip, float volume)
→ Sets volume before playing
-
setScene()
→ Sets scene properties -
setGameObjectList()
→ Registers game objects in scene -
setUISet()
→ Sets up UI components
-
setScene()
→ Sets screen size -
setGameObjectList()
→ Creates map and UIPlayerPanel -
setUISet()
→ Registers button events and builds UI
-
setScene()
→ Sets screen size and resets InGameManager -
setGameObjectList()
→ Registers map, player, and enemies -
setUISet()
→ Registers pause UI and listeners
-
setScene()
→ Sets screen size and background -
setGameObjectList()
→ (None or optional) -
setUISet()
→ Registers tip text and animation UI -
initLoading()
→ Creates loading font and text
-
setScene()
→ Sets screen size -
setGameObjectList()
→ (Optional) -
setUISet()
→ Builds Game Over UI and registers listeners
-
changeScene()
→ Requests scene change and initialization -
innerChangeScene()
→ Removes current panel and initializes new scene
-
loadFonts()
→ Loads fonts for UI -
drawUI(Graphics g)
→ Common UI rendering
-
loadImage()
→ Loads player image -
startInterpolatedMove()
→ Smooth movement logic -
scheduleNextRandomMove()
→ Schedules next move (every 3–4 seconds) -
generateNewRandomPosition()
→ Calculates new random position
-
initUIComponents()
→ Initializes title, buttons, etc. -
applyImageToButton()
→ Adjusts button image size -
getStartButton()
→ Returns Start button for external access -
getExitButton()
→ Returns Exit button for external access
-
setScore(int)
→ Updates score UI -
setPlayer()
→ Registers player -
startTimerUpdate()
→ Starts timer -
interpolateHealth()
→ Smooth health UI interpolation -
drawUI()
→ Renders UI components
-
getMainMenuButton()
→ Returns Main Menu button -
getRetryButton()
→ Returns Retry button
-
getMainMenuButton()
→ Returns Main Menu button -
getRetryButton()
→ Returns Retry button -
drawUI()
→ Displays score and time
-
getInstance()
→ Returns singleton instance -
setMainFrame()
→ Registers main frame -
getMainFrame()
→ Returns main frame -
updateScore()
→ Updates score -
getScore()
→ Returns current score -
getTimer()
→ Returns elapsed time -
resetScoreAndTimer()
→ Resets score and timer
-
getInstance()
→ Returns singleton instance -
initialize()
→ Creates and initializes objects -
resetPause()
→ Resets pause state -
reset()
→ Resets global variables -
setPlayer()
→ Registers player -
isPaused()
→ Checks if game is paused -
getPauseOverlayPanel()
→ Returns background panel -
setupKeyListener()
→ Sets ESC key listener -
togglePause()
→ Toggles pause menu -
setPausePanelVisible()
→ Displays menu UI -
updateScore()
→ Updates score when enemy is defeated