@@ -44,6 +44,7 @@ public class Game extends Canvas implements Runnable {
4444 private static String Jdata_UserName = "" ;
4545 private static String Jdata_IP = "127.0.0.1" ;
4646 private static boolean changeLevel = false ;
47+ private static boolean npc = false ;
4748 private static int map = 0 ;
4849
4950 private JFrame frame ;
@@ -62,7 +63,7 @@ public class Game extends Canvas implements Runnable {
6263 private InputHandler input ;
6364 private WindowHandler window ;
6465 private LevelHandler level ;
65- private static Player player ;
66+ private Player player ;
6667 private Dummy dummy ;
6768 private Music music = new Music ();
6869 private Time time = new Time ();
@@ -125,10 +126,21 @@ public void setMap(String Map_str) {
125126 setLevel (new LevelHandler (Map_str ));
126127 setPlayer (new PlayerMP (getLevel (), 100 , 100 , input ,
127128 Jdata_UserName , null , -1 ));
128- dummy = new Dummy (getLevel (), "h" , 215 , 215 , 500 , 543 );
129- level .addEntity (dummy );
130129 level .addEntity (player );
131130 }
131+
132+ public static void npcSpawn (){
133+ if (isNpc () == true ){
134+ game .setDummy (new Dummy (Game .getLevel (), "h" , 215 , 215 , 500 , 543 ));
135+ game .level .addEntity (Game .getDummy ());
136+ }
137+ }
138+
139+ public static void npcKill (){
140+ if (isNpc () == false ){
141+ game .level .removeEntity (Game .getDummy ());
142+ }
143+ }
132144
133145 public synchronized void start () {
134146 running = true ;
@@ -235,15 +247,15 @@ public void render() {
235247 musicThread .start ();
236248 notActive = false ;
237249 } else {
238- System .out .println ("Canceled" );
250+ System .out .println ("[GAME] Canceled music option " );
239251 input .setPlayMusic (false );
240252 }
241253 }
242254 }
243255
244- if (input . isChangeLevel () == true && getTickCount () % 60 == 0 ){
256+ if (isChangeLevel () == true && getTickCount () % 60 == 0 ){
245257 Game .setChangeLevel (true );
246- input . setChangeLevel (false );
258+ setChangeLevel (false );
247259 }
248260
249261 if (changeLevel == true ){
@@ -354,15 +366,15 @@ public void setSocketClient(GameClient socketClient) {
354366 }
355367
356368 public static Player getPlayer () {
357- return player ;
369+ return game . player ;
358370 }
359371
360372 public void setPlayer (Player player ) {
361- Game .player = player ;
373+ game .player = player ;
362374 }
363375
364- public LevelHandler getLevel () {
365- return level ;
376+ public static LevelHandler getLevel () {
377+ return game . level ;
366378 }
367379
368380 public void setLevel (LevelHandler level ) {
@@ -417,4 +429,20 @@ public static void setMap(int map) {
417429 Game .map = map ;
418430 }
419431
432+ public static boolean isNpc () {
433+ return npc ;
434+ }
435+
436+ public static void setNpc (boolean npc ) {
437+ Game .npc = npc ;
438+ }
439+
440+ public static Dummy getDummy () {
441+ return game .dummy ;
442+ }
443+
444+ public void setDummy (Dummy dummy ) {
445+ this .dummy = dummy ;
446+ }
447+
420448}
0 commit comments