다운로드 링크
실행화면 보러가기
코리아IT 아카데미 국비 훈련과정중 개인 자바 프로젝트때 제출한 프로그램입니다.
콘솔창에서 입력과 출력으로 구현한 프로그램입니다.
package pokemongame_;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import javazoom.jl.player.*;
public class Bgm {
private String fileName;
private Player bgm;
public Bgm(String fileName) {
this.fileName = fileName;
}
public void close() {
if(bgm !=null)
bgm.close();
}
public void play() {
try {
FileInputStream fis = new FileInputStream(fileName);
BufferedInputStream bis = new BufferedInputStream(fis);
bgm = new Player(bis);
} catch (Exception e) {
e.printStackTrace();
}
new Thread() {
public void run() {
try {bgm.play();}
catch(Exception e) {
e.printStackTrace();
}
}
}.start();
}
}
jl1.0.1 라이브러리를 사용하여 배경음악을 출력하는 클래스입니다.
전역변수
fileName은 음악파일의 경로+이름이며 생성자로 초기화됩니다.
bgm 은 해당 음악파일 객체입니다.
play 메소드로 음악이 실행되며 close 메소드로 종료됩니다.
package pokemongame_;
import java.util.Scanner;
public class FightingSystem
{
public void Fight(Pokemon mypok,Pokemon pok)
{ Bgm fight = new Bgm("src/pokemongame_/bgm/battle.mp3");
Bgm win = new Bgm("src/pokemongame_/bgm/win.mp3");
Bgm hit = new Bgm("src/pokemongame_/bgm/hit.mp3");
fight.play();
while(true)
{ View_fight.fightmain(mypok, pok);
if(mypok.speed>=pok.speed)
{ for(int i=0;i<4;i++)
{System.out.print(i+1+"."+mypok.skill[i].name_skill+" ");}
int ch= Fuction.getChoice(4);
if(!mypok.skill[ch-1].name_skill.equals(""))
System.out.println(mypok.name_pok+"의"+mypok.skill[ch-1].name_skill+"공격!!");
else {System.out.println("해당스킬은 사용할수 없습니다.");continue;}
if(getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)>0)
{
hit.play();
hit(pok,getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm));
System.out.println(pok.name_pok+"이(가)"+getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)+"의 데미지를 입었다!!");
}
else
{hit.play();
System.out.println(pok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(pok, 1); }
View.pause();
if(pok.hp<=0)
{
fight.close();
win.play();
System.out.println("전투에서 승리하셨습니다!!!");
Fuction.sleep(1000);
getExp(mypok,pok);
Fuction.sleep(1000);
levelup(mypok);
Fuction.sleep(1000);
evolve(mypok,win);
learnSkill(mypok);
Fuction.sleep(1000);
win.close();
break;
}
else if(mypok.hp<=0)
{fight.close();
System.out.println("전투에서 패배하셨습니다. ㅠㅠㅠㅠㅠ"); View.view_pokemonCenter2(mypok); break;}
int ch2 = 1;
if(!pok.skill[ch2-1].name_skill.equals(""))
System.out.println(pok.name_pok+"의"+pok.skill[ch2-1].name_skill+"공격!!");
if(getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)>0)
{hit.play();
hit(mypok,getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm));
System.out.println(mypok.name_pok+"이(가)"+getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)+"의 데미지를 입었다!!");
}
else
{ hit.play();
System.out.println(mypok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(mypok, 1); }
View.pause(); View.pause();
}
else
{
int ch2 = 1;
if(!pok.skill[ch2-1].name_skill.equals(""))
System.out.println(pok.name_pok+"의"+pok.skill[ch2-1].name_skill+"공격!!");
if(getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)>0)
{hit.play();
hit(mypok,getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm));
System.out.println(mypok.name_pok+"이(가)"+getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)+"의 데미지를 입었다!!");
}
else
{hit.play();
System.out.println(mypok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(mypok, 1);
}
for(int i=0;i<4;i++)
{System.out.print(i+1+"."+mypok.skill[i].name_skill+" ");}
if(pok.hp<=0)
{
fight.close();
win.play();
System.out.println("전투에서 승리하셨습니다!!!");
Fuction.sleep(1000);
getExp(mypok,pok);
Fuction.sleep(1000);
levelup(mypok);
Fuction.sleep(1000);
evolve(mypok,win);
learnSkill(mypok);
Fuction.sleep(1000);
win.close();
break;
}
else if(mypok.hp<=0)
{fight.close();
System.out.println("\n전투에서 패배하셨습니다. ㅠㅠㅠㅠㅠ"); View.view_pokemonCenter2(mypok); break;}
int ch= Fuction.getChoice(4);
if(!mypok.skill[ch-1].name_skill.equals(""))
System.out.println(mypok.name_pok+"의"+mypok.skill[ch-1].name_skill+"공격!!");
else {System.out.println("해당스킬은 사용할수 없습니다.");continue;}
if(getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)>0)
{
hit(pok,getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm));
System.out.println(pok.name_pok+"이(가)"+getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)+"의 데미지를 입었다!!");
}
else
{System.out.println(pok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(pok, 1); }
View.pause();
}
}
pok.hp = pok.hp_max;
}
public void Fight_challenge(Pokemon mypok,Pokemon pok)
{ Bgm chal = new Bgm("src/pokemongame_/bgm/challenge.mp3");
Bgm win = new Bgm("src/pokemongame_/bgm/win.mp3");
Bgm hit = new Bgm("src/pokemongame_/bgm/hit.mp3");
chal.play();
while(true)
{ View_fight.fightmain(mypok, pok);
if(mypok.speed>=pok.speed)
{ for(int i=0;i<4;i++)
{System.out.print(i+1+"."+mypok.skill[i].name_skill+" ");}
int ch= Fuction.getChoice(4);
if(!mypok.skill[ch-1].name_skill.equals(""))
System.out.println(mypok.name_pok+"의"+mypok.skill[ch-1].name_skill+"공격!!");
else {System.out.println("해당스킬은 사용할수 없습니다.");continue;}
if(getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)>0)
{ hit.play();
hit(pok,getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm));
System.out.println(pok.name_pok+"이(가)"+getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)+"의 데미지를 입었다!!");
}
else
{hit.play();
System.out.println(pok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(pok, 1); }
View.pause();
if(pok.hp<=0)
{
chal.close();
win.play();
System.out.println("전투에서 승리하셨습니다!!!");
Fuction.sleep(1000);
getExp(mypok,pok);
Fuction.sleep(1000);
levelup(mypok);
Fuction.sleep(1000);
evolve(mypok,win);
learnSkill(mypok);
Fuction.sleep(1000);
win.close();
if(View.badge<=View.mytown)
View.badge++;
break;
}
else if(mypok.hp<=0)
{chal.close();System.out.println("전투에서 패배하셨습니다. ㅠㅠㅠㅠㅠ"); View.view_pokemonCenter2(mypok); break;}
int ch2 = 1;
if(!pok.skill[ch2-1].name_skill.equals(""))
System.out.println(pok.name_pok+"의"+pok.skill[ch2-1].name_skill+"공격!!");
if(getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)>0)
{hit.play();
hit(mypok,getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm));
System.out.println(mypok.name_pok+"이(가)"+getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)+"의 데미지를 입었다!!");
}
else
{hit.play();
System.out.println(mypok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(mypok, 1); }
View.pause(); View.pause();
}
else
{
int ch2 = 1;
if(!pok.skill[ch2-1].name_skill.equals(""))
System.out.println(pok.name_pok+"의"+pok.skill[ch2-1].name_skill+"공격!!");
if(getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)>0)
{ hit.play();
hit(mypok,getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm));
System.out.println(mypok.name_pok+"이(가)"+getGainDamage(mypok, getDamage(pok, pok.skill[ch2-1], pok.skill[ch2-1].pm), pok.skill[ch2-1].pm)+"의 데미지를 입었다!!");
}
else
{ hit.play();
System.out.println(mypok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(mypok, 1);
}
for(int i=0;i<4;i++)
{System.out.print(i+1+"."+mypok.skill[i].name_skill+" ");}
if(pok.hp<=0)
{
chal.close();
win.play();
System.out.println("전투에서 승리하셨습니다!!!");
Fuction.sleep(1000);
getExp(mypok,pok);
Fuction.sleep(1000);
levelup(mypok);
Fuction.sleep(1000);
evolve(mypok,win);
learnSkill(mypok);
Fuction.sleep(1000);
win.close();
if(View.badge<=View.mytown)
View.badge++;
break;
}
else if(mypok.hp<=0)
{chal.close();System.out.println("\n전투에서 패배하셨습니다. ㅠㅠㅠㅠㅠ"); View.view_pokemonCenter2(mypok); break;}
int ch= Fuction.getChoice(4);
if(!mypok.skill[ch-1].name_skill.equals(""))
System.out.println(mypok.name_pok+"의"+mypok.skill[ch-1].name_skill+"공격!!");
else {System.out.println("해당스킬은 사용할수 없습니다.");continue;}
if(getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)>0)
{ hit.play();
hit(pok,getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm));
System.out.println(pok.name_pok+"이(가)"+getGainDamage(pok, getDamage(mypok, mypok.skill[ch-1], mypok.skill[ch-1].pm), mypok.skill[ch-1].pm)+"의 데미지를 입었다!!");
}
else
{hit.play();
System.out.println(pok.name_pok+"이(가)"+"1의 데미지를 입었다!!");
hit(pok, 1); }
View.pause();
}
}
pok.hp = pok.hp_max;
}
public int getDamage(Pokemon pok,Skill skill,int skillType)
{ if(skillType ==1)
return pok.pap*skill.damage_skill/100;
return pok.map*skill.damage_skill/100;
}
public int getGainDamage(Pokemon pok,int damage,int skillType)//받는데미지
{ if(skillType ==1)
return damage-pok.pr/5;
return damage-pok.mr/5;
}
public void hit(Pokemon pok,int damage)
{ pok.hp -= damage; }
public void levelup(Pokemon pok)
{ while(true){
if(pok.exp_has>=pok.exp_max){
pok.level++;
System.out.println("레벨이"+pok.level+"로 올랐습니다!");
pok.exp_has = pok.exp_has-pok.exp_max;
pok.exp_max += 5;
pok.hp +=5;
pok.hp_max +=5;
pok.pap += pok.level*3;
pok.map += pok.level*3;
pok.pr += pok.level*3;
pok.mr += pok.level*3;
pok.speed += pok.level*3;}
else break;
}
}
public void getExp(Pokemon mypok,Pokemon pok)
{ System.out.println(pok.exp_giving+"의 경험치 획득!!");
mypok.exp_has += pok.exp_giving; }
public void evolve(Pokemon mypok,Bgm bgm)
{ Bgm evol = new Bgm("src/pokemongame_/bgm/evol.mp3");
String temp = mypok.name_pok;
if(mypok.level>=25 &&mypok.evol[0]==1) {
bgm.close();
evol.play();
System.out.println("오잉??!? "+mypok.name_pok+"의 상태가?!?!");
Fuction.sleep(3000);
System.out.println(".....");
Fuction.sleep(3000);
System.out.println(".....");
Fuction.sleep(3000);
evol.close();
bgm.play();
if(mypok.name_pok.equals("이상해씨"))
{
mypok.name_pok = "이상해풀";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[0]=0;
}
else if(mypok.name_pok.equals("파이리"))
{
mypok.name_pok = "리자드";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[0]=0;
}
else if(mypok.name_pok.equals("꼬부기"))
{
mypok.name_pok = "어니부기";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[0]=0;
}
} else if(mypok.level>=50 &&mypok.evol[1]==1) {
bgm.close();
evol.play();
System.out.println("오잉??!? "+mypok.name_pok+"의 상태가?!?!");
Fuction.sleep(3000);
System.out.println(".....");
Fuction.sleep(3000);
System.out.println(".....");
Fuction.sleep(3000);
if(mypok.name_pok.equals("이상해풀"))
{
mypok.name_pok = "이상해꽃";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[1]=0;
}
else if(mypok.name_pok.equals("리자드"))
{
mypok.name_pok = "리자몽";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[1]=0;
}
else if(mypok.name_pok.equals("어니부기"))
{
mypok.name_pok = "거북왕";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[1]=0;
}
} else if(mypok.level>=75 &&mypok.evol[2]==1) {
if(mypok.name_pok.equals("이상해꽃"))
{
mypok.name_pok = "메가이상해꽃";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[2]=0;
}
else if(mypok.name_pok.equals("리자몽"))
{
mypok.name_pok = "메가리자몽Y";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[2]=0;
}
else if(mypok.name_pok.equals("거북왕"))
{
mypok.name_pok = "메가거북왕";
System.out.println(temp+"이(가) "+mypok.name_pok+"으로 진화했다!!!");
mypok.evol[2]=0;
}
}
View.pause();View.pause();
evol.close();
}
public void learnSkill(Pokemon mypok) {
if(mypok.level>=10 &&mypok.learnSkill[0]==1) {
if(mypok.name_pok.equals("이상해씨")) {
mypok.skill[1] = Skill_arr.skills[31];
} else if(mypok.name_pok.equals("파이리")) {
mypok.skill[1] = Skill_arr.skills[4];
} else if(mypok.name_pok.equals("꼬부기")) {
mypok.skill[1] = Skill_arr.skills[39];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[1].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[0]=0;
}else if(mypok.level>=22 &&mypok.learnSkill[1]==1) {
if(mypok.name_pok.equals("이상해씨")) {
mypok.skill[2] = Skill_arr.skills[23];
} else if(mypok.name_pok.equals("파이리")) {
mypok.skill[2] = Skill_arr.skills[6];
} else if(mypok.name_pok.equals("꼬부기")) {
mypok.skill[2] = Skill_arr.skills[12];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[2].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[1]=0;
}else if(mypok.level>=33 &&mypok.learnSkill[2]==1) {
if(mypok.name_pok.equals("이상해풀")) {
mypok.skill[3] = Skill_arr.skills[33];
} else if(mypok.name_pok.equals("리자드")) {
mypok.skill[3] = Skill_arr.skills[7];
} else if(mypok.name_pok.equals("어니부기")) {
mypok.skill[3] = Skill_arr.skills[40];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[3].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[2]=0;
}else if(mypok.level>=45 &&mypok.learnSkill[3]==1) {
if(mypok.name_pok.equals("이상해풀")) {
mypok.skill[0] = Skill_arr.skills[34];
} else if(mypok.name_pok.equals("리자드")) {
mypok.skill[0] = Skill_arr.skills[38];
} else if(mypok.name_pok.equals("어니부기")) {
mypok.skill[0] = Skill_arr.skills[41];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.print(mypok.skill[0].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[3]=0;
}else if(mypok.level>=56 &&mypok.learnSkill[4]==1) {
if(mypok.name_pok.equals("이상해꽃")) {
mypok.skill[1] = Skill_arr.skills[35];
} else if(mypok.name_pok.equals("리자몽")) {
mypok.skill[1] = Skill_arr.skills[22];
} else if(mypok.name_pok.equals("거북왕")) {
mypok.skill[1] = Skill_arr.skills[19];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[1].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[4]=0;
}else if(mypok.level>=68 &&mypok.learnSkill[5]==1) {
if(mypok.name_pok.equals("이상해꽃")) {
mypok.skill[2] = Skill_arr.skills[36];
} else if(mypok.name_pok.equals("리자몽")) {
mypok.skill[2] = Skill_arr.skills[38];
} else if(mypok.name_pok.equals("거북왕")) {
mypok.skill[2] = Skill_arr.skills[26];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[2].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[5]=0;
}else if(mypok.level>=81 &&mypok.learnSkill[6]==1) {
if(mypok.name_pok.equals("메가이상해꽃")) {
mypok.skill[3] = Skill_arr.skills[37];
} else if(mypok.name_pok.equals("메가리자몽Y")) {
mypok.skill[3] = Skill_arr.skills[30];
} else if(mypok.name_pok.equals("메가거북왕")) {
mypok.skill[3] = Skill_arr.skills[42];
}
System.out.println(mypok.name_pok+"이(가) 새로운 기술");
System.out.println(mypok.skill[3].name_skill+"을(를) 배웠다!!");
mypok.learnSkill[6]=0;
}
}
}
Pokemon타입의 객체 2개 (mypok->나의 포켓몬,pok->상대포켓몬)
를 파라미터로 전달받아 서로 싸우게하는 메소드입니다.
전투과정
1.speed 능력치가 빠른 포켓몬이 먼저 공격한다.
2.사용할 기술을 선택하여 입력하면 상대 포켓몬에게 데미지계산을 통해
일정량의 데미지가 들어가고 상대포켓몬이 죽지 않은 상태라면 공격한다.
3.둘중 하나가 죽을때 까지 반복
4.승리시 경험치획득,레벨업,진화,기술배우기 메소드가 호출되고
경험치 획득을 제외한 다른 메소드들은 메소드안에서 조건에따라 코드가
실행된다.
체육관 도전시 호출되는 메소드
Fight()와의 차이점은
다른 bgm을 사용하고 승리시 뱃지를 획득할수있다.
해당 포켓몬이 받는 데미지를 리턴하는 메소드
해당 포켓몬의 체력을 데미지만큼 감소시키는 메소드
조건에 따라 해당 포켓몬을 레벨업시키는 메소드
상대포켓몬(exp)의 주는경험치만큼 내 포켓몬의 경험치를 증가시키는 메소드
내 포켓몬을 진화시키는 메소드
내 포켓몬에게 새로운 기술을 습득하게 하는 메소드
(Function 인데 만들당시에 오타가 있었나보다...)
Scanner로 입력을 받을때 의도와 다른 입력이 들어오지않도록 하는 메소드
a는 선택의 범위를 의미한다.
ex ) a가 5이면 1~5 까지의 입력만 받음,abs라서 음수는? 이라고 생각할수있는데 음수는 charAt 반복문에서 걸러짐
ms 만큼 Thread.sleep 을 시키는 메소드
(호출하는 쪽에서 try catch 안쓰려고 따로만듦)
package pokemongame_;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
public class Save {
public void save(Pokemon mypok) {
File f1 = new File("src/pokemongame_/saveFile");
f1.mkdirs();
OutputStream out = null;
BufferedOutputStream bout = null;
ObjectOutputStream oout = null;
try {
out = new FileOutputStream("src/pokemongame_/saveFile/save1.txt");
bout = new BufferedOutputStream(out);
oout = new ObjectOutputStream(bout);
oout.writeObject(mypok);
System.out.println("저장 성공!!");
} catch(FileNotFoundException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
} finally {
try {
oout.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void save_badge(int badge) {
OutputStream out = null;
try {
out = new FileOutputStream("src/pokemongame_/saveFile/save2.txt");
out.write(badge);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
save(Pokemon mypok) 는 해당 객체정보를 txt파일로 저장합니다
save_badge(int badge) 는 플레이어의 뱃지 갯수를 txt파일로 저장합니다.
load()는 txt파일에 저장되어있는 포켓몬 객체를 불러와 리턴합니다.
load_badge()는 뱃지 갯수를 리턴합니다.
package pokemongame_;
import java.io.IOException;
import java.util.Scanner;
public class Message
{ static String name_player;
static int choice;
public static void obacsa()
{ Scanner sc = new Scanner(System.in);
System.out.print("???: 반갑다! (엔터를 누르시면 진행됩니다.)");
pause();
System.out.print("포켓몬스터의 세계에 잘왔단다.");
pause();pause();
System.out.println("나의 이름은 오박사");
System.out.print("모두에게 포켓몬 박사라고 존경받고 있단다.");
pause();pause();
System.out.print("포켓몬스터..............포켓몬");
pause();pause();
System.out.println("이세계에는 포켓몬스터라고 불려지는");
System.out.print("생명체들이 도처에 살고있다!");
pause();pause();
System.out.print("사람은 포켓몬들과 정답게 지내거나");
pause();pause();
System.out.print("함께 싸우거나........");
pause();pause();
System.out.print("서로 도와가며 살아가고 있단다.");
pause();pause();
System.out.print("하지만 우리들은 포켓몬 전부를 알고 있지는 못하다.");
pause();pause();
System.out.print("포켓몬의 비밀은 아직도 잔뜩있다!");
pause();pause();
System.out.print("나는 그것을 밝혀내기 위하여");
pause();pause();
System.out.print("매일 포켓몬 연구를 계속하고 있다는 말이다!");
pause();pause();
System.out.print("그럼.........");
pause();pause();
System.out.print("슬슬 너의 이름을 가르쳐다오");
pause();pause();
System.out.println("=========================================");
System.out.println("나의 이름은?(커서를 이곳 아래로 이동하여 입력해주세요)");
name_player = sc.next();
System.out.println(name_player+"!!!!");
System.out.print("준비는 되었는가?");
pause();
System.out.print("드디어 이제부터 너의 이야기가 시작되어진다");
pause();pause();
System.out.println("즐거운 것도 괴로운 것도");
System.out.print("잔뜩 너를 기다리고 있을것이다!!!");
pause();pause();
System.out.println("꿈과 모험과!");
System.out.print("포켓몬스터의 세계에!!!");
pause();pause();
System.out.println("렛츠 고!!!!!!");
pause();pause();
for(int i=0;i<15;i++)
{System.out.println("=============================================");}
}
public static void tutorial()
{ Scanner sc = new Scanner(System.in);
System.out.println("태초마을에 오신것을 환영합니다.");
while(true)
{
System.out.println("튜토리얼을 진행하시겠습니까?");
System.out.println("1.네 2.아니오");
int ch = Fuction.getChoice();
if(ch ==1) {
System.out.println("포켓몬스터 세상에서는 다양한 모험의 나래를 펼칠수있습니다.");
System.out.println("당신의 포켓몬과 상대포켓몬이 결투를 벌이고");
System.out.print("이에 승리하면 당신의 포켓몬은 경험치를얻고 성장합니다!");
pause();pause();
System.out.println("경험치가 올라가면 레벨업을 하게되며");
System.out.print("당신의 포켓몬은 강해지고,다양한 기술을 습득할 수 있습니다.");
pause();pause();
System.out.println("당신의 포켓몬이 일정레벨에 도달하면 '진화'라는것을 하게되는데");
System.out.print("당신의 포켓몬이 더욱 더 강해집니다.");
pause();pause();
System.out.println("결투를 벌이다가 상대포켓몬에게 패배할 경우 ");
System.out.print("당신의 포켓몬은 경험치를 잃게됩니다.");
pause();pause();
System.out.println("패배하지 않기 위해 포켓몬센터에가서");
System.out.print("포켓몬의 체력을 회복시킬 수 있습니다.");
pause();pause();
System.out.println("행운을 빕니다!!!!! ");
pause();pause();break;}
if(ch == 2) break;
else System.out.println("올바른 숫자를 입력해주세요");
}
}
public static void startingpok()
{Scanner sc = new Scanner(System.in);
System.out.println("★☆★☆★☆★☆따르르르르릉따르르르르릉★☆★☆★☆★☆");
System.out.print("오박사님에게 전화가 왔다!!");
pause();pause();
System.out.println("오박사: "+name_player+"!!!");
System.out.print("지금 내 연구실로 와줄 수 있겠나?");
pause();pause();
while(true)
{
System.out.println("1.네 2.아니오");
int ch = Fuction.getChoice();
if(ch ==1)
{ System.out.print("어서오게 "+name_player+"!!");
pause();pause();
System.out.println("모험을 시작하려면 함께 할 포켓몬이 있어야하지 않겠나?");
System.out.print("내가 여기 3마리의 포켓몬을 준비했으니 골라보게!!");
pause();pause();
while(true)
{
System.out.println("1.이상해씨 2.파이리 3.꼬부기");
System.out.println("포켓몬을 선택해주세요");
choice = Fuction.getChoice();
if(choice==1)
{System.out.println("이상해씨로 하시겠습니까?");
System.out.println("1.네 2.아니오");
int choice = Fuction.getChoice();
if(choice ==1)
{System.out.println("이상해씨가 선택되었습니다.");
System.out.println("이상!!이상!!!이상해!!");
pause();pause();
break;}
else if(choice!=1&&choice!=2)
{System.out.println("올바른 숫자를 입력해주세요");}
}
else if(choice==2)
{System.out.println("파이리로 하시겠습니까?");
System.out.println("1.네 2.아니오");
int choice = Fuction.getChoice();
if(choice ==1)
{System.out.println("파이리가 선택되었습니다.");
System.out.println("파이리ㅣ리릴리ㅣ파파파이ㅣ리리ㅣ");
pause();pause();
break;}
else if(choice!=1&&choice!=2)
{System.out.println("올바른 숫자를 입력해주세요");}
}
else if(choice==3)
{System.out.println("꼬부기로 하시겠습니까?");
System.out.println("1.네 2.아니오");
int choice = Fuction.getChoice();
if(choice ==1)
{System.out.println("꼬부기가 선택되었습니다.");
System.out.println("꼬고ㅓ고곡댁꼬고고고고고");
pause();pause();
break;}
else if(choice!=1&&choice!=2)
{System.out.println("올바른 숫자를 입력해주세요");}
}
else System.out.println("올바른 숫자를 입력해주세요");
}
System.out.println("오박사: 그럼 즐거운 여행 되게나!!!");
pause();pause();
break;
}
if(ch == 2)
{System.out.println("거절 할 수없다!!!!!");}
else System.out.println("올바른 숫자를 입력해주세요");
}
}
public static void title()
{
System.out.println("\r\n" +
"______ _____ _ __ _____ ___ ___ _____ _ _ \r\n" +
"| ___ \\| _ || | / /| ___|| \\/ || _ || \\ | |\r\n" +
"| |_/ /| | | || |/ / | |__ | . . || | | || \\| |\r\n" +
"| __/ | | | || \\ | __| | |\\/| || | | || . ` |\r\n" +
"| | \\ \\_/ /| |\\ \\| |___ | | | |\\ \\_/ /| |\\ |\r\n" +
"\\_| \\___/ \\_| \\_/\\____/ \\_| |_/ \\___/ \\_| \\_/\r\n" +
" \r\n" +
" \r\n" +
"");
}
public static Pokemon start()
{
Pokemon temp = null;
System.out.println("1. 새 게임 2. 불러오기");
int ch = Fuction.getChoice(2);
while(true) {
if(ch==1)
{ Message.obacsa();
Message.startingpok();
temp = new Pokemon(Message.choice,5);
break;
}
else if (ch==2) temp = new Load().load(); break;
}
if(Load.error_load==1)
{
Message.obacsa();
Message.startingpok();
temp = new Pokemon(Message.choice,5);
Load.error_load = 0;
}
new Load().load_badge();
if(Load.error_load==1) {
View.badge = 0;
Load.error_load = 0;
}
return temp;
}
public static void pause()
{try { System.in.read();} catch(IOException e) {}}
}
출력문을 모아놨습니다.
pause() 엔터를 누르면 진행되게 하기위해 사용하는 메소드입니다.
package pokemongame_;
import java.io.Serializable;
public class Pokemon implements Serializable
{ String name_pok;
int hp=20;
int hp_max;
int exp_has=0,exp_max=25,exp_giving=15;
//has = 보유경험치 max = 경험치통 give = 처치시 주는 경험치
int level;
int pap=15;int map=15; // Physical Attack Power 물공
// Magical Attack Power 마공
int pr=10,mr=10; // Physical Resistance 물리저항력
// Magical Resistance 마법저항력
int speed=10;
Skill[] skill = new Skill[4];
int[] evol = {1,1,1};
int[] learnSkill = {1,1,1,1,1,1,1};
public Pokemon() {}
public Pokemon(String name_pok, int level, Skill skill)
{ this.skill[0] = skill;
this.name_pok = name_pok;
this.level = level;
this.hp += level*2;
this.hp_max = hp;
this.exp_giving += level*10;
this.pap += level*2;
this.map += level*2;
this.pr += level*2;
this.mr += level*2;
this.speed += level*2;
}
public Pokemon(int choice, int level)
{
if(choice==1)
{this.name_pok = "이상해씨";
this.skill[0]=Skill_arr.skills[1];
for(int i=1;i<=3;i++)
this.skill[i]=Skill_arr.skills[0];}
else if(choice==2)
{this.name_pok = "파이리";
this.skill[0]=Skill_arr.skills[2];
for(int i=1;i<=3;i++)
this.skill[i]=Skill_arr.skills[0];}
else if(choice==3)
{this.name_pok = "꼬부기";
this.skill[0]=Skill_arr.skills[3];
for(int i=1;i<=3;i++)
this.skill[i]=Skill_arr.skills[0];}
this.level = level;
this.hp += level*2;
this.hp_max = hp;
this.exp_giving += level*10;
this.pap += level*2;
this.map += level*2;
this.pr += level*2;
this.mr += level*2;
this.speed += level*2;
}
}
포켓몬 객체를 위한 클래스입니다.
Pokemon(String name_pok, int level, Skill skill) 생성자는 상대포켓몬을 위한 ,Pokemon(int choice, int level) 생성자는 자신의 포켓몬을 위한 생성자입니다.
package pokemongame_;
public class Pok_arr {
public static Pokemon[][] pok_arr =
{
{ new Pokemon("캐터피",1,Skill_arr.skills[1]),
new Pokemon("캐터피",2,Skill_arr.skills[1]),
new Pokemon("캐터피",3,Skill_arr.skills[1]),
new Pokemon("꼬렛",4,Skill_arr.skills[1]),
new Pokemon("꼬렛",5,Skill_arr.skills[1]),
new Pokemon("꼬렛",6,Skill_arr.skills[1]),
new Pokemon("구구",7,Skill_arr.skills[10]),
new Pokemon("구구",8,Skill_arr.skills[10]),
new Pokemon("구구",9,Skill_arr.skills[10]) ,
new Pokemon("나옹",10,Skill_arr.skills[7])
},
{ new Pokemon("꼬마돌",11,Skill_arr.skills[11]),
new Pokemon("꼬마돌",12,Skill_arr.skills[11]),
new Pokemon("꼬마돌",13,Skill_arr.skills[11]),
new Pokemon("꼬마돌",14,Skill_arr.skills[11]),
new Pokemon("알통몬",15,Skill_arr.skills[9]),
new Pokemon("알통몬",16,Skill_arr.skills[9]),
new Pokemon("알통몬",17,Skill_arr.skills[9]),
new Pokemon("알통몬",18,Skill_arr.skills[9]),
new Pokemon("알통몬",19,Skill_arr.skills[9]),
new Pokemon("롱스톤",20,Skill_arr.skills[25]),
},
{ new Pokemon("고라파덕",21,Skill_arr.skills[12]),
new Pokemon("고라파덕",22,Skill_arr.skills[12]),
new Pokemon("고라파덕",23,Skill_arr.skills[12]),
new Pokemon("고라파덕",24,Skill_arr.skills[12]),
new Pokemon("왕눈해",25,Skill_arr.skills[13]),
new Pokemon("왕눈해",26,Skill_arr.skills[13]),
new Pokemon("왕눈해",27,Skill_arr.skills[13]),
new Pokemon("왕눈해",28,Skill_arr.skills[13]),
new Pokemon("왕눈해",29,Skill_arr.skills[13]),
new Pokemon("아쿠스타",30,Skill_arr.skills[26]),
},
{ new Pokemon("붐볼",31,Skill_arr.skills[14]),
new Pokemon("붐볼",32,Skill_arr.skills[14]),
new Pokemon("붐볼",33,Skill_arr.skills[14]),
new Pokemon("붐볼",34,Skill_arr.skills[14]),
new Pokemon("레어코일",35,Skill_arr.skills[15]),
new Pokemon("레어코일",36,Skill_arr.skills[15]),
new Pokemon("레어코일",37,Skill_arr.skills[15]),
new Pokemon("레어코일",38,Skill_arr.skills[15]),
new Pokemon("레어코일",39,Skill_arr.skills[15]),
new Pokemon("라이츄",40,Skill_arr.skills[27]),
},
{ new Pokemon("파라섹트",41,Skill_arr.skills[7]),
new Pokemon("파라섹트",42,Skill_arr.skills[7]),
new Pokemon("파라섹트",43,Skill_arr.skills[7]),
new Pokemon("우츠보트",44,Skill_arr.skills[23]),
new Pokemon("우츠보트",45,Skill_arr.skills[23]),
new Pokemon("우츠보트",46,Skill_arr.skills[23]),
new Pokemon("니드킹",47,Skill_arr.skills[24]),
new Pokemon("니드킹",48,Skill_arr.skills[24]),
new Pokemon("니드킹",49,Skill_arr.skills[24]),
new Pokemon("라플레시아",49,Skill_arr.skills[28]),
},
{ new Pokemon("버터풀",51,Skill_arr.skills[16]),
new Pokemon("버터풀",52,Skill_arr.skills[16]),
new Pokemon("버터풀",53,Skill_arr.skills[16]),
new Pokemon("도나리",54,Skill_arr.skills[17]),
new Pokemon("도나리",55,Skill_arr.skills[17]),
new Pokemon("도나리",56,Skill_arr.skills[17]),
new Pokemon("독침붕",57,Skill_arr.skills[18]),
new Pokemon("독침붕",58,Skill_arr.skills[18]),
new Pokemon("독침붕",59,Skill_arr.skills[18]),
new Pokemon("도나리",59,Skill_arr.skills[17]),
},
{ new Pokemon("야도란",61,Skill_arr.skills[19]),
new Pokemon("야도란",62,Skill_arr.skills[19]),
new Pokemon("야도란",63,Skill_arr.skills[19]),
new Pokemon("윤겔라",64,Skill_arr.skills[20]),
new Pokemon("윤겔라",65,Skill_arr.skills[20]),
new Pokemon("윤겔라",66,Skill_arr.skills[20]),
new Pokemon("슬리퍼",67,Skill_arr.skills[21]),
new Pokemon("슬리퍼",68,Skill_arr.skills[21]),
new Pokemon("슬리퍼",69,Skill_arr.skills[21]),
new Pokemon("후딘",69,Skill_arr.skills[29]),
},
{ new Pokemon("가디",71,Skill_arr.skills[7]),
new Pokemon("가디",72,Skill_arr.skills[7]),
new Pokemon("가디",73,Skill_arr.skills[7]),
new Pokemon("리자드",74,Skill_arr.skills[8]),
new Pokemon("리자드",75,Skill_arr.skills[8]),
new Pokemon("리자드",76,Skill_arr.skills[8]),
new Pokemon("날쌩마",77,Skill_arr.skills[22]),
new Pokemon("날쌩마",78,Skill_arr.skills[22]),
new Pokemon("날쌩마",79,Skill_arr.skills[22]),
new Pokemon("윈디",79,Skill_arr.skills[30]),
},
};
}
전역변수로 상대방 포켓몬의 배열을 가지는 클래스입니다.
배열의 행은 각 마을을 의미합니다
-> 0행은 1번마을에 출현하는 포켓몬,1행은 2번마을에 출현...
각행의 마지막열은 체육관에 출현하는 포켓몬입니다.
package pokemongame_;
import java.io.Serializable;
public class Skill implements Serializable
{ String name_skill; // 기술 이름
int damage_skill; // 기술위력
int pm; // 1. Physical 2. magical
int accuracyRate; // 명중률
int pp; // 기술사용 횟수
int pp_max;
public Skill() {}
public Skill(String name_skill,int damage_skill, int pm, int accuracyRate,int pp)
{
this.name_skill = name_skill;
this.damage_skill = damage_skill;
this.pm = pm;
this.accuracyRate = accuracyRate;
this.pp = pp;
this.pp_max = pp;
}
}
스킬 객체 생성을 위한 클래스입니다. accuracyRate와 pp는 미구현입니다. 생성자에 파라미터가 너무 많습니다 수정이 필요하군요
package pokemongame_;
public class Skill_arr
{
static Skill[] skills =
{
new Skill("",0,0,0,0), //0
new Skill("몸통박치기",40,1,100,35),
new Skill("할퀴기",40,1,100,35),
new Skill("막치기",40,1,100,35),
new Skill("불꽃세례",45,2,100,25),
new Skill("용의숨결",60,2,100,20),
new Skill("불꽃엄니",55,1,95,15),
new Skill("베어가르기",75,1,100,20),
new Skill("화염방사",85,2,100,15),
new Skill("안다리걸기",50,1,100,15),
new Skill("바람일으키기",40,2,100,35), //10
new Skill("돌떨구기",50,1,100,15),
new Skill("물의파동",55,2,100,20),
new Skill("거품광선",65,2,100,20),
new Skill("전기쇼크",40,2,100,30),
new Skill("러스터캐논",80,2,100,10),
new Skill("에어슬래시",75,2,100,15),
new Skill("환상빔",65,2,100,20),
new Skill("독찌르기",80,1,100,20),
new Skill("파도타기",100,2,100,15),
new Skill("사이코쇼크",80,2,100,10), //20
new Skill("사이코키네시스",90,2,100,10),
new Skill("화염자동차",100,1,100,25),
new Skill("잎날가르기",55,1,100,25),
new Skill("독찌르기",80,1,100,20),
new Skill("스톤샤워",75,1,100,10),
new Skill("하이드로펌프",120,2,100,5),
new Skill("번개",110,2,100,30),
new Skill("기가드레인",75,2,100,10),
new Skill("미래예지",120,2,100,10),
new Skill("플레어드라이브",200,1,100,15), //30
new Skill("덩쿨채찍",45,1,100,15),
new Skill("씨폭탄",65,1,100,15),
new Skill("돌진",75,1,100,15),
new Skill("메가드레인",85,2,100,15),
new Skill("에너지볼",100,2,100,15),
new Skill("이판사판태클",120,1,100,15),
new Skill("솔라빔",200,2,100,15),
new Skill("연옥",120,2,100,15),
new Skill("물대포",45,2,100,15),
new Skill("물기",75,1,100,15), //40
new Skill("아쿠아테일",85,1,100,15),
new Skill("로케트박치기",200,1,100,15),
};
}
전역변수로 Skill 타입의 배열을 가지는 클래스입니다.
package pokemongame_;
public class Story{
public static void town_main(String name_town,Pokemon mypok){
Bgm town = new Bgm("src/pokemongame_/bgm/town.mp3");
while(true){
town.play();
View.view_town(View.name_town[View.mytown]);
int ch = Fuction.getChoice();
switch(ch){
case 1 :
View.view_dungeon(1+View.mytown*10);
dungeon(mypok,town);
break;
case 2 :
View.view_mypok(mypok); break;
case 3 :
town.close();
View.view_pokemonCenter(mypok); break;
case 4 :
town.close();
View.view_challenge(name_town);
challenge(mypok);
break;
case 5 :
while(true) {
View.view_moveTown();
int temp = Fuction.getChoice(8)-1;
if(temp<=View.badge) {View.mytown=temp;break;}
else {System.out.println("이전마을의 뱃지를 획득해주세요"); break;}
}
break;
case 6 : new Save().save(mypok); new Save().save_badge(View.badge); break;
case 7 :
Pokemon temp = mypok;
mypok = new Load().load();
if(Load.error_load==1) {mypok = temp; Load.error_load=0;}
new Load().load_badge();
if(Load.error_load==1) {View.badge=0; Load.error_load=0;}
break;
default : View.error(); break;
}//switch
town.close();
}//while
}//selet_town
public static void dungeon(Pokemon mypok,Bgm bgm)
{ int ch = Fuction.getChoice(9);
FightingSystem f= new FightingSystem();
bgm.close();
f.Fight(mypok, Pok_arr.pok_arr[View.mytown][ch-1]);
}
public static void challenge(Pokemon mypok)
{ FightingSystem f= new FightingSystem();
f.Fight_challenge(mypok, Pok_arr.pok_arr[View.mytown][9]);
}
}//class
마을 화면과 포켓몬 배틀에 대한 메소드를 가지는 클래스입니다.
package pokemongame_;
public class View_fight
{
public static void fightmain(Pokemon mypok, Pokemon pok)
{
System.out.println(" \t\t\t"+pok.name_pok);
System.out.println("\t\t\t"+pok.hp+" / "+pok.hp_max);
System.out.println(" \t ∧_∧\r\n" +
" (^ω^)\r\n" +
" / つ¶つ¶\r\n" +
" / ̄ ̄ ̄ ̄\\r\n" +
" |) ○ ○ ○ (|\r\n" +
" /″ ν. \\r\n" +
" (( (( (( /__________\\r\n" +
"\t\t\t ̄ \_\__/_/  ̄\r\n" +
mypok.name_pok+"\n"+
mypok.hp+" / "+mypok.hp_max+"\n"+
" ^⌒^\r\n" +
"--=≡ (´.ω.)\r\n" +
"-=≡ / つ_つ\r\n" +
"-=≡ 人 Y\r\n" +
" レ\フ\r\n");
}
}
배틀 화면입니다. 아스키아트출처
package pokemongame_;
import java.io.IOException;
public class View
{
public static String[] name_town = {"상록시티","회색시티","블루시티","갈색시티","무지개시티",
"연분홍시티","노랑시티","홍련섬"};
public static int mytown =0;
public static int badge = 0;
public static void view_town(String name_town)
{
System.out.println("==============================================================");
System.out.println(" \t\t"+name_town+"에 오신것을 환영합니다!!");
System.out.println(" 1.사냥터 2.내 포켓몬 3.포켓몬센터 4.체육관도전 5.마을 이동 6.저장하기 7.불러오기 ");
System.out.println("==============================================================");
}
public static void view_dungeon(int level)
{ int index=1;
for (int i = level; i < level+9; i++)
{
System.out.println(index++ +". "+i+"레벨 몬스터 사냥");
}
}
public static void view_mypok(Pokemon mypok)
{
System.out.println("이름 : "+mypok.name_pok);
System.out.println("레벨 : "+mypok.level);
System.out.println("체력 : "+mypok.hp+" / "+mypok.hp_max);
System.out.println("보유경험치 : "+mypok.exp_has);
System.out.println("현재레벨 최대 경험치 : "+mypok.exp_max);
System.out.println("보유기술 ");
for(int i=0;i<4;i++)
{
System.out.print(i+1+"."+mypok.skill[i].name_skill+" ");
}
pause();
}
public static void view_pokemonCenter(Pokemon mypok)
{ Bgm pokcen = new Bgm("src/pokemongame_/bgm/pokemoncenter.mp3");
pokcen.play();
System.out.println("==================================");
System.out.println(" 포켓몬센터에 오신것을 환영합니다!! ");
System.out.println("==================================");
pause();
System.out.println("포켓몬을 회복시킵니다.....");
pokcen.close();
new Bgm("src/pokemongame_/bgm/heal.mp3").play();
Fuction.sleep(3000);
System.out.println("회복완료!!");
Fuction.sleep(1000);
mypok.hp = mypok.hp_max;
}
public static void view_pokemonCenter2(Pokemon mypok)
{ Bgm pokcen = new Bgm("src/pokemongame_/bgm/pokemoncenter.mp3");
pokcen.play();
System.out.println("포켓몬이 쓰러져서 포켓몬센터로 이동합니다.");
pause();
System.out.println("==================================");
System.out.println(" 포켓몬센터에 오신것을 환영합니다!! ");
System.out.println("==================================");
System.out.println("포켓몬을 회복시킵니다.....");
pokcen.close();
new Bgm("src/pokemongame_/bgm/heal.mp3").play();
Fuction.sleep(3000);
System.out.println("회복완료!!");
Fuction.sleep(1000);
mypok.hp = mypok.hp_max;
}
public static void view_challenge(String name_town)
{
System.out.println(name_town+" 체육관에 도전합니다....");
pause();
}
public static void view_moveTown()
{
for (int i = 0; i <8; i++)
{
System.out.println(i+1 +". "+name_town[i]+"로 이동");
}
}
public static void error()
{System.out.println("잘못입력하셨습니다.");}
public static void pause()
{try { System.in.read();} catch(IOException e) {}}
}
마을에서 선택한 화면에따라 진행시켜주는 메소드입니다.
package pokemongame_;
public class Main
{
public static void main(String[] args)
{
Bgm intro = new Bgm("src/pokemongame_/bgm/intro.mp3");
intro.play();
Message.title();
Pokemon mypok = Message.start();
intro.close();
Story.town_main(View.name_town[View.mytown], mypok);
}
}
메인메소드를 포함하는 클래스입니다.