(Sorry, I’m bad English. Please So you understand me. but, what corrected tell me.)
(미안해, 내가 영어를 잘못해. 그래서 너희들이 이해해줘 부탁해. 하지만 고쳐야 할 것이 있다면 나에게 말해줘)
Hi! I’m making the 2D Game. Making Game start to know a little.
안녕! 나는 2D게임을 만들고 있는 중이야. 게임 만드는 것이 처음이라 많이 모르니 많이 알려줘
Problem is move problem in making game. Look at the Image.
문제는 내가 만드는 게임에 이동에 대해서야 밑에 그림을 봐
http://cfile25.uf.tistory.com/image/0344B35051348D4708246D
http://cfile7.uf.tistory.com/image/02351D5051348D47251E16
http://cfile30.uf.tistory.com/image/1939595051348D471CF30E
In the Image, Virus Card should go to point out green color.
이 그림에 Virus 라는 카드가 갈 곳을 초록색 부분으로 가리키고 있어.
http://cfile6.uf.tistory.com/image/1636835051348D4721408A
http://cfile27.uf.tistory.com/image/1338F55051348D481DF951
but, It is top, bottom or in very side that can’t go to point out green color.
(In other words, Virus Card can’t go in write background .)
하지만 이 카드가 맨 위, 맨 밑, 맨 옆에 있으면 가지 못하는 초록색 부분을 가리키게 되버려
So, Green color(place) don’t visible according to Virus Card of X value or Y value at write background, I’d make what Virus Card don’t go Write background and only black background.
그래서 이 부분에 저 Virus 카드의 X,Y값에 따라 초록색 부분이 못나오게 하고, 그 부분으로는 갈 수 없게 만들고 싶어.
But, I’m short a little knowing. I’m not sure (about) what to do. Good idea tell me. plaese.
하지만 아직 내 실력으로는 부족해서, 어떻게 해야 할지 모르겠어, 좋은 방법 있으면 알려줘.
//Setting code skip
public class Windows {
static JPanel move_N;
static JPanel move_S;
static JPanel move_E;
static JPanel move_W;
static JPanel Virus;
GamePlay GP = new GamePlay();
//Setting code skip
static class GamePlay{
public void main(String arg[]){
}
public void play(){
move_N.setLocation(Virus.getX(), Virus.getY()-95); //top side
move_S.setLocation(Virus.getX(), Virus.getY()+95); //botton side
move_E.setLocation(Virus.getX()+95, Virus.getY()); //right side
move_W.setLocation(Virus.getX()-95, Virus.getY()); //left side
move_N.setVisible(true);
move_S.setVisible(true);
move_E.setVisible(true);
move_W.setVisible(true);
Virus.setVisible(true);
}
public void moveEvent() {
move_N.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
move_N.setLocation(0, 0); //top side
move_S.setLocation(0, 0); //botton side
move_E.setLocation(0, 0); //right side
move_W.setLocation(0, 0); //left side
move_S.setVisible(false);
move_E.setVisible(false);
move_W.setVisible(false);
Virus.setLocation(Virus.getX(), Virus.getY()-95);
Virus.setVisible(true);
return;
}
});
}
}
private void initialize() {
move_N = new JPanel();
//Setting code skip
move_E = new JPanel();
//Setting code skip
move_W = new JPanel();
//Setting code skip
move_S = new JPanel();
//Setting code skip
Virus = new JPanel();
//Setting code skip
Virus.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent arg0) {
GP.play();
GP.moveEvent();
}
});
}
}