diff --git a/global game jam/bin/Audio/AudioManager.class b/global game jam/bin/Audio/AudioManager.class new file mode 100644 index 0000000..a2480f6 Binary files /dev/null and b/global game jam/bin/Audio/AudioManager.class differ diff --git a/global game jam/bin/Entity/Boss.class b/global game jam/bin/Entity/Boss.class new file mode 100644 index 0000000..7c73e5b Binary files /dev/null and b/global game jam/bin/Entity/Boss.class differ diff --git a/global game jam/bin/Entity/Bullet.class b/global game jam/bin/Entity/Bullet.class new file mode 100644 index 0000000..3ebd83c Binary files /dev/null and b/global game jam/bin/Entity/Bullet.class differ diff --git a/global game jam/bin/Entity/Entity.class b/global game jam/bin/Entity/Entity.class new file mode 100644 index 0000000..683dd71 Binary files /dev/null and b/global game jam/bin/Entity/Entity.class differ diff --git a/global game jam/bin/Entity/Monster.class b/global game jam/bin/Entity/Monster.class new file mode 100644 index 0000000..e999cae Binary files /dev/null and b/global game jam/bin/Entity/Monster.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bas.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bas.class new file mode 100644 index 0000000..f757f72 Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bas.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bomb.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bomb.class new file mode 100644 index 0000000..f957162 Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_bomb.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cross.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cross.class new file mode 100644 index 0000000..572506e Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cross.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cube.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cube.class new file mode 100644 index 0000000..e29935c Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_cube.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_feint.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_feint.class new file mode 100644 index 0000000..7064391 Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_feint.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_loop.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_loop.class new file mode 100644 index 0000000..6c0ed0f Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_loop.class differ diff --git a/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_trace.class b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_trace.class new file mode 100644 index 0000000..296410f Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_chauve_souris_focus_trace.class differ diff --git a/global game jam/bin/Entity/MonsterModel_monstre.class b/global game jam/bin/Entity/MonsterModel_monstre.class new file mode 100644 index 0000000..3c85f2b Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_monstre.class differ diff --git a/global game jam/bin/Entity/MonsterModel_squelette_focus_bomb.class b/global game jam/bin/Entity/MonsterModel_squelette_focus_bomb.class new file mode 100644 index 0000000..f3a7d55 Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_squelette_focus_bomb.class differ diff --git a/global game jam/bin/Entity/MonsterModel_squelette_focus_loop.class b/global game jam/bin/Entity/MonsterModel_squelette_focus_loop.class new file mode 100644 index 0000000..b3abfd3 Binary files /dev/null and b/global game jam/bin/Entity/MonsterModel_squelette_focus_loop.class differ diff --git a/global game jam/bin/Entity/Player.class b/global game jam/bin/Entity/Player.class new file mode 100644 index 0000000..3858344 Binary files /dev/null and b/global game jam/bin/Entity/Player.class differ diff --git a/global game jam/bin/Entity/ShootingPattern.class b/global game jam/bin/Entity/ShootingPattern.class new file mode 100644 index 0000000..aba4522 Binary files /dev/null and b/global game jam/bin/Entity/ShootingPattern.class differ diff --git a/global game jam/bin/Entity/ShootingPattern_0.class b/global game jam/bin/Entity/ShootingPattern_0.class new file mode 100644 index 0000000..9e4c831 Binary files /dev/null and b/global game jam/bin/Entity/ShootingPattern_0.class differ diff --git a/global game jam/bin/Entity/ShootingPattern_1.class b/global game jam/bin/Entity/ShootingPattern_1.class new file mode 100644 index 0000000..a9e3d86 Binary files /dev/null and b/global game jam/bin/Entity/ShootingPattern_1.class differ diff --git a/global game jam/bin/Entity/TimedBullet.class b/global game jam/bin/Entity/TimedBullet.class new file mode 100644 index 0000000..9142f1d Binary files /dev/null and b/global game jam/bin/Entity/TimedBullet.class differ diff --git a/global game jam/bin/Entity/Ulti.class b/global game jam/bin/Entity/Ulti.class new file mode 100644 index 0000000..e2a0e66 Binary files /dev/null and b/global game jam/bin/Entity/Ulti.class differ diff --git a/global game jam/bin/Gui/Boutons.class b/global game jam/bin/Gui/Boutons.class new file mode 100644 index 0000000..e655306 Binary files /dev/null and b/global game jam/bin/Gui/Boutons.class differ diff --git a/global game jam/bin/IO/IOFile.class b/global game jam/bin/IO/IOFile.class new file mode 100644 index 0000000..e4d4e0c Binary files /dev/null and b/global game jam/bin/IO/IOFile.class differ diff --git a/global game jam/bin/Input/EcranListeners.class b/global game jam/bin/Input/EcranListeners.class new file mode 100644 index 0000000..0bb127e Binary files /dev/null and b/global game jam/bin/Input/EcranListeners.class differ diff --git a/global game jam/bin/Input/Joystick.class b/global game jam/bin/Input/Joystick.class new file mode 100644 index 0000000..3118086 Binary files /dev/null and b/global game jam/bin/Input/Joystick.class differ diff --git a/global game jam/bin/Input/KeyCode.class b/global game jam/bin/Input/KeyCode.class new file mode 100644 index 0000000..742331e Binary files /dev/null and b/global game jam/bin/Input/KeyCode.class differ diff --git a/global game jam/bin/Items/Items.class b/global game jam/bin/Items/Items.class new file mode 100644 index 0000000..1512348 Binary files /dev/null and b/global game jam/bin/Items/Items.class differ diff --git a/global game jam/bin/Items/PowerItems.class b/global game jam/bin/Items/PowerItems.class new file mode 100644 index 0000000..e02dfd7 Binary files /dev/null and b/global game jam/bin/Items/PowerItems.class differ diff --git a/global game jam/bin/Items/SpellItems.class b/global game jam/bin/Items/SpellItems.class new file mode 100644 index 0000000..35b98e9 Binary files /dev/null and b/global game jam/bin/Items/SpellItems.class differ diff --git a/global game jam/bin/Jeu/Jeu$1.class b/global game jam/bin/Jeu/Jeu$1.class new file mode 100644 index 0000000..d6ff2d9 Binary files /dev/null and b/global game jam/bin/Jeu/Jeu$1.class differ diff --git a/global game jam/bin/Jeu/Jeu.class b/global game jam/bin/Jeu/Jeu.class new file mode 100644 index 0000000..e76d7d6 Binary files /dev/null and b/global game jam/bin/Jeu/Jeu.class differ diff --git a/global game jam/bin/Tools/Coord.class b/global game jam/bin/Tools/Coord.class new file mode 100644 index 0000000..c541370 Binary files /dev/null and b/global game jam/bin/Tools/Coord.class differ diff --git a/global game jam/bin/Tools/CoordD.class b/global game jam/bin/Tools/CoordD.class new file mode 100644 index 0000000..3d69a62 Binary files /dev/null and b/global game jam/bin/Tools/CoordD.class differ diff --git a/global game jam/bin/Tools/ImagePhysics.class b/global game jam/bin/Tools/ImagePhysics.class new file mode 100644 index 0000000..94377ea Binary files /dev/null and b/global game jam/bin/Tools/ImagePhysics.class differ diff --git a/global game jam/bin/World/MonsterSpawnPattern.class b/global game jam/bin/World/MonsterSpawnPattern.class new file mode 100644 index 0000000..4884bce Binary files /dev/null and b/global game jam/bin/World/MonsterSpawnPattern.class differ diff --git a/global game jam/bin/World/Replique.class b/global game jam/bin/World/Replique.class new file mode 100644 index 0000000..e06b06e Binary files /dev/null and b/global game jam/bin/World/Replique.class differ diff --git a/global game jam/bin/World/Speach.class b/global game jam/bin/World/Speach.class new file mode 100644 index 0000000..fc1162b Binary files /dev/null and b/global game jam/bin/World/Speach.class differ diff --git a/global game jam/bin/World/Stage1.class b/global game jam/bin/World/Stage1.class new file mode 100644 index 0000000..69ea459 Binary files /dev/null and b/global game jam/bin/World/Stage1.class differ diff --git a/global game jam/bin/World/World.class b/global game jam/bin/World/World.class new file mode 100644 index 0000000..cfc30b3 Binary files /dev/null and b/global game jam/bin/World/World.class differ diff --git a/global game jam/bin/test/Coord.class b/global game jam/bin/test/Coord.class new file mode 100644 index 0000000..981edce Binary files /dev/null and b/global game jam/bin/test/Coord.class differ diff --git a/global game jam/bin/test/EcranListeners.class b/global game jam/bin/test/EcranListeners.class new file mode 100644 index 0000000..186a894 Binary files /dev/null and b/global game jam/bin/test/EcranListeners.class differ diff --git a/global game jam/bin/test/Jeu.class b/global game jam/bin/test/Jeu.class new file mode 100644 index 0000000..1b181d9 Binary files /dev/null and b/global game jam/bin/test/Jeu.class differ diff --git a/global game jam/bin/test/main.class b/global game jam/bin/test/main.class new file mode 100644 index 0000000..a3c9b30 Binary files /dev/null and b/global game jam/bin/test/main.class differ diff --git a/global game jam/lib/OpenAL32.dll b/global game jam/lib/OpenAL32.dll new file mode 100644 index 0000000..1f69e94 Binary files /dev/null and b/global game jam/lib/OpenAL32.dll differ diff --git a/global game jam/lib/OpenAL64.dll b/global game jam/lib/OpenAL64.dll new file mode 100644 index 0000000..6f2a2fe Binary files /dev/null and b/global game jam/lib/OpenAL64.dll differ diff --git a/global game jam/lib/Output.jar b/global game jam/lib/Output.jar new file mode 100644 index 0000000..7afcf5f Binary files /dev/null and b/global game jam/lib/Output.jar differ diff --git a/global game jam/lib/acm.jar b/global game jam/lib/acm.jar new file mode 100644 index 0000000..424c902 Binary files /dev/null and b/global game jam/lib/acm.jar differ diff --git a/global game jam/lib/jinput-dx8.dll b/global game jam/lib/jinput-dx8.dll new file mode 100644 index 0000000..6d27ad5 Binary files /dev/null and b/global game jam/lib/jinput-dx8.dll differ diff --git a/global game jam/lib/jinput-dx8_64.dll b/global game jam/lib/jinput-dx8_64.dll new file mode 100644 index 0000000..6730589 Binary files /dev/null and b/global game jam/lib/jinput-dx8_64.dll differ diff --git a/global game jam/lib/jinput-raw.dll b/global game jam/lib/jinput-raw.dll new file mode 100644 index 0000000..ce1d162 Binary files /dev/null and b/global game jam/lib/jinput-raw.dll differ diff --git a/global game jam/lib/jinput-raw_64.dll b/global game jam/lib/jinput-raw_64.dll new file mode 100644 index 0000000..3d2b3ad Binary files /dev/null and b/global game jam/lib/jinput-raw_64.dll differ diff --git a/global game jam/lib/jinput.jar b/global game jam/lib/jinput.jar new file mode 100644 index 0000000..7c2b6b0 Binary files /dev/null and b/global game jam/lib/jinput.jar differ diff --git a/global game jam/lib/libjinput-linux.so b/global game jam/lib/libjinput-linux.so new file mode 100644 index 0000000..3cdc439 Binary files /dev/null and b/global game jam/lib/libjinput-linux.so differ diff --git a/global game jam/lib/libjinput-linux64.so b/global game jam/lib/libjinput-linux64.so new file mode 100644 index 0000000..de1ee5f Binary files /dev/null and b/global game jam/lib/libjinput-linux64.so differ diff --git a/global game jam/lib/libjinput-osx.dylib b/global game jam/lib/libjinput-osx.dylib new file mode 100644 index 0000000..59a3eab Binary files /dev/null and b/global game jam/lib/libjinput-osx.dylib differ diff --git a/global game jam/lib/liblwjgl.dylib b/global game jam/lib/liblwjgl.dylib new file mode 100644 index 0000000..a6083b9 Binary files /dev/null and b/global game jam/lib/liblwjgl.dylib differ diff --git a/global game jam/lib/liblwjgl.so b/global game jam/lib/liblwjgl.so new file mode 100644 index 0000000..ba6e7f6 Binary files /dev/null and b/global game jam/lib/liblwjgl.so differ diff --git a/global game jam/lib/liblwjgl64.so b/global game jam/lib/liblwjgl64.so new file mode 100644 index 0000000..8ed0992 Binary files /dev/null and b/global game jam/lib/liblwjgl64.so differ diff --git a/global game jam/lib/libopenal.so b/global game jam/lib/libopenal.so new file mode 100644 index 0000000..0a3a619 Binary files /dev/null and b/global game jam/lib/libopenal.so differ diff --git a/global game jam/lib/libopenal64.so b/global game jam/lib/libopenal64.so new file mode 100644 index 0000000..e0693c0 Binary files /dev/null and b/global game jam/lib/libopenal64.so differ diff --git a/global game jam/lib/lwjgl.dll b/global game jam/lib/lwjgl.dll new file mode 100644 index 0000000..e6c97d9 Binary files /dev/null and b/global game jam/lib/lwjgl.dll differ diff --git a/global game jam/lib/lwjgl64.dll b/global game jam/lib/lwjgl64.dll new file mode 100644 index 0000000..2c8b93e Binary files /dev/null and b/global game jam/lib/lwjgl64.dll differ diff --git a/global game jam/lib/openal.dylib b/global game jam/lib/openal.dylib new file mode 100644 index 0000000..3c6d0f7 Binary files /dev/null and b/global game jam/lib/openal.dylib differ diff --git a/global game jam/pattern_mob.txt b/global game jam/pattern_mob.txt new file mode 100644 index 0000000..61609fd --- /dev/null +++ b/global game jam/pattern_mob.txt @@ -0,0 +1,458 @@ +957 -170 +957 -160 +957 -150 +957 -140 +957 -130 +957 -120 +957 -110 +957 -100 +957 -90 +957 -80 +957 -70 +957 -60 +957 -50 +957 -40 +957 -30 +957 -20 +957 -10 +957 0 +957 5 +957 5 +957 5 +957 5 +957 5 +957 5 +957 5 +957 8 +957 8 +957 8 +957 8 +957 8 +957 8 +957 8 +957 11 +957 14 +957 17 +957 20 +957 20 +957 20 +957 20 +957 20 +957 26 +957 26 +957 26 +957 26 +957 29 +957 32 +957 32 +957 32 +957 32 +957 35 +957 35 +957 38 +957 38 +957 41 +957 44 +957 44 +957 44 +957 47 +957 47 +954 50 +954 50 +954 50 +954 53 +954 53 +954 56 +954 56 +954 56 +954 59 +954 59 +954 59 +954 62 +954 62 +954 62 +954 65 +954 65 +954 68 +954 71 +954 71 +954 71 +954 74 +954 74 +954 77 +954 77 +954 77 +954 80 +954 83 +954 83 +954 83 +954 86 +954 89 +954 89 +954 89 +954 89 +954 92 +954 92 +954 95 +954 95 +954 98 +954 98 +954 98 +954 98 +954 101 +954 101 +954 107 +954 107 +954 110 +954 110 +954 113 +954 113 +954 113 +954 116 +954 116 +954 119 +954 119 +954 122 +954 125 +954 125 +954 128 +954 128 +954 131 +954 131 +954 131 +954 131 +954 134 +954 137 +954 137 +954 137 +954 137 +954 137 +954 137 +954 140 +954 140 +954 143 +954 143 +954 143 +954 152 +954 152 +954 152 +954 152 +954 152 +954 152 +954 155 +954 155 +954 158 +954 161 +954 161 +954 161 +954 164 +954 167 +954 167 +954 170 +954 170 +954 173 +954 176 +954 176 +954 182 +954 182 +954 185 +954 188 +954 191 +954 194 +954 194 +954 197 +954 197 +954 200 +954 200 +954 203 +954 203 +954 203 +954 206 +954 209 +954 209 +954 209 +954 209 +954 209 +954 212 +954 215 +954 215 +954 218 +954 218 +954 221 +954 221 +954 221 +954 224 +954 224 +954 227 +954 230 +954 233 +951 236 +951 239 +951 242 +951 242 +951 248 +951 254 +951 257 +951 257 +951 260 +951 263 +951 266 +951 269 +948 272 +948 275 +948 275 +948 278 +948 281 +945 284 +945 284 +945 287 +945 290 +945 293 +942 296 +942 299 +942 299 +939 305 +939 308 +936 311 +936 314 +933 317 +930 323 +927 329 +927 329 +924 332 +924 335 +918 344 +915 347 +915 350 +915 350 +912 356 +909 359 +906 362 +906 368 +903 374 +903 377 +900 383 +897 389 +894 398 +894 398 +894 401 +888 410 +885 413 +882 416 +882 416 +882 419 +876 425 +873 428 +873 428 +867 434 +864 443 +861 443 +861 446 +855 452 +849 461 +846 467 +846 470 +843 470 +843 473 +843 479 +840 485 +837 488 +837 491 +837 497 +837 500 +837 500 +837 503 +837 509 +837 512 +837 512 +837 515 +837 518 +840 521 +840 524 +843 524 +843 530 +846 533 +849 536 +852 539 +855 545 +858 545 +861 548 +867 551 +873 554 +876 554 +876 554 +885 560 +894 563 +900 566 +900 566 +903 566 +909 566 +915 569 +918 572 +921 572 +921 572 +930 575 +936 578 +936 578 +942 578 +948 581 +951 581 +954 581 +960 584 +969 584 +972 584 +975 584 +981 587 +984 587 +990 590 +996 590 +999 590 +999 593 +1005 593 +1011 593 +1014 593 +1020 596 +1026 596 +1029 596 +1035 596 +1038 596 +1044 596 +1050 596 +1053 596 +1056 596 +1059 596 +1065 596 +1068 596 +1071 596 +1074 594 +1077 594 +1083 594 +1089 591 +1095 591 +1104 588 +1110 588 +1116 585 +1122 585 +1125 582 +1131 582 +1134 579 +1137 579 +1137 579 +1140 576 +1140 576 +1143 573 +1146 570 +1146 570 +1146 567 +1146 567 +1149 567 +1149 564 +1149 561 +1152 561 +1152 558 +1152 555 +1152 552 +1152 552 +1152 549 +1152 546 +1152 543 +1152 537 +1152 534 +1152 531 +1152 528 +1152 528 +1152 525 +1152 519 +1152 516 +1152 510 +1149 510 +1146 504 +1146 504 +1143 501 +1143 498 +1140 498 +1137 495 +1134 492 +1131 489 +1128 486 +1125 483 +1119 480 +1119 477 +1116 477 +1116 474 +1116 474 +1113 474 +1113 471 +1110 468 +1110 468 +1104 462 +1104 459 +1101 456 +1098 453 +1095 450 +1092 447 +1089 444 +1086 441 +1086 438 +1080 435 +1077 432 +1074 429 +1071 426 +1068 423 +1062 417 +1062 417 +1059 414 +1056 411 +1050 405 +1047 402 +1041 396 +1038 393 +1035 390 +1032 387 +1026 381 +1020 378 +1017 375 +1014 372 +1011 369 +1008 363 +1002 357 +999 351 +996 348 +993 342 +990 339 +990 336 +987 333 +987 333 +987 330 +981 321 +975 312 +975 312 +972 309 +966 297 +960 294 +960 291 +957 291 +957 291 +957 291 +957 288 +957 285 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 +954 282 diff --git a/global game jam/src/Audio/AudioManager.java b/global game jam/src/Audio/AudioManager.java new file mode 100644 index 0000000..b49055c --- /dev/null +++ b/global game jam/src/Audio/AudioManager.java @@ -0,0 +1,90 @@ +package Audio; + +import java.util.*; +import java.util.Map.*; + +import javax.print.attribute.standard.MediaSize.*; + +import acm.util.*; + +public class AudioManager { + + private static String previousStage = ""; + public static String otherNameStage = ""; + private static SoundClip tmpSound,prev; + private static boolean start = true; + private static int indexSound = -1; + private static HashMap ambientSound = new HashMap(); + private static HashMap sound = new HashMap(); + + public static void addAmbientSound(String stage,String url){ + try{ + tmpSound = new SoundClip(url); + tmpSound.setVolume(1.0); + ambientSound.put(stage, tmpSound); + }catch(Exception e){e.printStackTrace();} + } + + public static void update(String stage){ + if(!previousStage.equals(stage))indexSound = -1; + ArrayList sounds = getAmbientSoundByStage(stage); + if(sounds.size() != 0){ + if(indexSound != -1){ + if(sounds.get(indexSound).getFrameIndex() >= sounds.get(indexSound).getFrameCount()){ + prev.stop(); + indexSound++; + if(indexSound>=sounds.size())indexSound=0; + sounds.get(indexSound).play(); + } + }else{ + if(!start){ + prev.stop(); + } + sounds.get(0).play(); + prev = sounds.get(0); + indexSound = 0; + previousStage = stage; + } + } + start = false; + } + + public static void addSound(String name,String url){ + try{ + tmpSound = new SoundClip(url); + tmpSound.setVolume(1.0); + sound.put(name, tmpSound); + }catch(Exception e){e.printStackTrace();} + } + + public static SoundClip getSound(String name){ + return sound.get(name); + } + + public static void playSound(String name){ + getSound(name).play(); + } + + public static void setVolumeSound(double vol){ + for(Entry s : sound.entrySet())s.getValue().setVolume(vol); + } + + public static void setVolumeAmbientSound(double vol){ + for(Entry s : ambientSound.entrySet())s.getValue().setVolume(vol); + } + + public static ArrayList getAmbientSoundByStage(String stage){ + ArrayList sounds = new ArrayList(); + for(Entry s : ambientSound.entrySet()){ + if(s.getKey().equals(stage)){ + sounds.add(s.getValue()); + } + } + return sounds; + } + + public static void stopSound(String name){ + getSound(name).stop(); + } + +} diff --git a/global game jam/src/Entity/Boss.java b/global game jam/src/Entity/Boss.java new file mode 100644 index 0000000..3635860 --- /dev/null +++ b/global game jam/src/Entity/Boss.java @@ -0,0 +1,107 @@ +package Entity; + +import java.util.ArrayList; +import java.util.Random; + +import Tools.CoordD; + +public class Boss extends Monster{ + + private ArrayList spotCoordDs = new ArrayList(); + private boolean patternFini = false; + private final double maxRandRange = 1000.0; + private double actualRandRange = 1000.0; + private int inMotion = 0; + private Random randG = new Random(); + + private ArrayList listShootingPattern = new ArrayList(); + private int indiceActualShootingPattern = 0; + + public Boss(String name, String patternName, int HP, double moveSpeed,int scoreDead, + ArrayList spotCoordDs, ArrayList listShootingPattern){ + + super(name, patternName, HP, moveSpeed, 300, true, 1,scoreDead); + this.spotCoordDs = spotCoordDs; + this.listShootingPattern = listShootingPattern; + } + + public void deplacer(){ + // si le boss est static + if(inMotion <= 0){ + + // on fait un test aléatoire pour savoir si il va commencer un déplacement + double testDepla = actualRandRange * Math.random(); + + // si oui + if(testDepla < 1.0){ + + // on réinitialise le test + actualRandRange = maxRandRange; + + // on détermine où on va + int indiceSpot = randG.nextInt(spotCoordDs.size()); + + //on calcule le vercteur de déplacement pour y allez + double longDeplaTT = spotCoordDs.get(indiceSpot).x - (x + (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth()); // orienté + double hautDeplaTT = spotCoordDs.get(indiceSpot).y - (y + (image.getHeight() / 2) / Jeu.Jeu.resolution.getHeight()); // orienté + double hypo = Math.sqrt((longDeplaTT * longDeplaTT) + (hautDeplaTT * hautDeplaTT)); + setVectorX(longDeplaTT / hypo); + setVectorY(hautDeplaTT / hypo); + + // on détermine le nombre de déplacement à faire pour rejoindre le spot + inMotion = (int)(hypo / moveSpeed); + } + //sinon + else{ + // on augmente la probabilité de réussir le test + actualRandRange *= 0.99; + } + } + // sinon il poursuit juste son déplacement + else{ + inMotion --; + move(getVectorX() * moveSpeed, getVectorY() * moveSpeed); + } + } + + public void gestionTir(){ + if(HP < listShootingPattern.get(0).hpFinish){ + listShootingPattern.remove(0); + } + } + + public void setAFiniSonParttern(){ + patternFini = true; + current = System.currentTimeMillis(); + previous = 0; + elapsed = 0; + } + + public boolean getPatternFini(){ + return patternFini; + } + + public boolean isAlive(){ + return (HP > 0) ? true : false; + } + + public ArrayList getListShootingPattern(){ + return listShootingPattern; + } + + public boolean isTimeOut(){ + return elapsed >= listShootingPattern.get(0).duration; + } + + public void resetTimer(){ + elapsed -= listShootingPattern.get(0).duration; + } + + public void setIndiceActualShootingPattern(int p){ + indiceActualShootingPattern = p; + } + + public int getIndiceActualShootingPattern(){ + return indiceActualShootingPattern; + } +} diff --git a/global game jam/src/Entity/Bullet.java b/global game jam/src/Entity/Bullet.java new file mode 100644 index 0000000..df47b3b --- /dev/null +++ b/global game jam/src/Entity/Bullet.java @@ -0,0 +1,52 @@ +package Entity; + +import java.awt.Dimension; + +public class Bullet extends Entity{ + + private int damage; + + public Bullet(String name, double xStart, double yStart, double xTarget, double yTarget, double moveSpeed){ + super("res/textures/" + name + ".png"); + + xStart -= (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(); + yStart -= (image.getHeight() / 2) / Jeu.Jeu.resolution.getHeight(); + xTarget -= (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(); + yTarget -= (image.getHeight() / 2) / Jeu.Jeu.resolution.getHeight(); + + setPosition(xStart, yStart); + + double longDeplaTT = xTarget - x; // orienté + double hautDeplaTT = yTarget - y; // orienté + double hypo = Math.sqrt((longDeplaTT * longDeplaTT) + (hautDeplaTT * hautDeplaTT)); + setVectorX(longDeplaTT / hypo); + setVectorY(hautDeplaTT / hypo); + + super.moveSpeed = moveSpeed; + } + + public Bullet(String name, double xStart, double yStart, double xTarget, double yTarget, double moveSpeed, int damage){ + this(name, xStart, yStart, xTarget, yTarget, moveSpeed); + this.damage = damage; + } + + // boss untargeted bullet + public Bullet(TimedBullet tB, double xS, double yS){ + this(tB.name, xS, yS, xS + tB.x, yS + tB.y, tB.moveSpeed); + } + + // boss targeted bullet + public Bullet(TimedBullet tB, double xS, double yS, double xT, double yT){ + this(tB.name, xS, yS, xT, yT, tB.moveSpeed); + } + + public int getDamage(){ + return damage; + } + + @Override + public void update(){ + // TODO Auto-generated method stub + + } +} diff --git a/global game jam/src/Entity/Entity.java b/global game jam/src/Entity/Entity.java new file mode 100644 index 0000000..55c37f2 --- /dev/null +++ b/global game jam/src/Entity/Entity.java @@ -0,0 +1,81 @@ +package Entity; + +import java.awt.Dimension; + +import acm.graphics.GImage; + +public abstract class Entity { + + protected double x,y; + protected double vectorX = 0.0, vectorY = 0.0; + protected GImage image; + protected double moveSpeed = 5.0; + + public Entity(int x,int y,String url){ + this.x = x; + this.y = y; + this.image = new GImage(url, Jeu.Jeu.resolution.getWidth() * x, Jeu.Jeu.resolution.getHeight() * y); + + image.setSize(image.getWidth() / 1920.0 * Jeu.Jeu.resolution.getWidth(), image.getHeight() / 1080.0 * Jeu.Jeu.resolution.getHeight()); + } + + public Entity(String url){ + this(-200,-200,url); + } + + public double getX(){ + return x; + } + + public double getY(){ + return y; + } + + public double getVectorX(){ + return vectorX; + } + + public double getVectorY(){ + return vectorY; + } + + public void setVectorX(double vectorX){ + this.vectorX = vectorX; + } + + public void setVectorY(double vectorY){ + this.vectorY = vectorY; + } + + public void setPosition(double x,double y){ + + image.setLocation(Jeu.Jeu.resolution.getWidth() * x, Jeu.Jeu.resolution.getHeight() * y); + this.x = x; + this.y = y; + } + + public void move(double x, double y){ + image.move(Jeu.Jeu.resolution.getWidth() * x, Jeu.Jeu.resolution.getHeight() * y); + this.x += x; + this.y += y; + } + + public GImage getImage() { + return image; + } + + public void setImage(GImage image) { + this.image = image; + } + + public double getMoveSpeed(){ + return moveSpeed; + } + + public void setMoveSpeed(double moveSpeed){ + this.moveSpeed = moveSpeed; + } + + public abstract void update(); + +} diff --git a/global game jam/src/Entity/Monster.java b/global game jam/src/Entity/Monster.java new file mode 100644 index 0000000..394b2e8 --- /dev/null +++ b/global game jam/src/Entity/Monster.java @@ -0,0 +1,175 @@ +package Entity; + +import java.io.*; +import java.util.*; + +import Items.*; +import Tools.*; + +public class Monster extends Entity{ + private int fireRate; // temps entre chaque tire en ms + protected long current,previous = 0,elapsed = 0; + protected int HP; + + private ArrayList pattern = new ArrayList(); + private int indicePattern = 0; + private boolean fireModeFocus; + + private float dropChance; + private int scoreDead; + + public Monster(String name, String patternName, int HP, double moveSpeed, int fireRate, boolean fireModeFocus, float dropChance,int scoreDead){ + super("res/textures/" + name + ".png"); + this.moveSpeed = moveSpeed; + this.HP = HP; + this.fireRate = fireRate; + this.fireModeFocus = fireModeFocus; + this.dropChance = dropChance; + this.scoreDead = scoreDead; + + try{ + File fichier = new File("res/donnees/" + patternName + ".txt"); + Scanner fEntree = new Scanner(new BufferedInputStream(new FileInputStream(fichier))); + String line, tab[]; + + while(fEntree.hasNext()){ + + line = fEntree.nextLine(); + tab = line.split(" "); + pattern.add(new Coord(Integer.parseInt(tab[0]), Integer.parseInt(tab[1]))); + } + fEntree.close(); + } + catch(IOException e){ + System.out.println("ERREUR DE LECTURE du fichier : " + patternName + ".txt"); + } + + current = System.currentTimeMillis(); + previous = 0; + elapsed = 0; + } + + public void setTimerTo0(){ + current = System.currentTimeMillis(); + previous = 0; + elapsed = 0; + } + + public void drop(){ + if(Math.random() <= dropChance){ + if(Math.random()>0.5){ + World.World.getItemsList().add(new PowerItems(image.getX(),image.getY())); + }else{ + World.World.getItemsList().add(new SpellItems(image.getX(),image.getY())); + } + } + } + + public void addBullet(double xTarget, double yTarget){ + World.World.getBulletsList().add(new Bullet("tireau", x + (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(), y + image.getHeight() / Jeu.Jeu.resolution.getHeight(), xTarget, yTarget, 0.0085)); + } + + public boolean isTimeOut(){ + return elapsed >= fireRate; + } + + public void resetTimer(){ + elapsed -= fireRate; + } + + public void update(){ + previous = current; + current = System.currentTimeMillis(); + elapsed += current - previous; + } + + public ArrayList getPattern(){ + return pattern; + } + + public int getIndicePattern(){ + return indicePattern; + } + + + + public int getScoreDead() { + return scoreDead; + } + + public void setScoreDead(int scoreDead) { + this.scoreDead = scoreDead; + } + + public boolean incrementIndicePattern(){ + indicePattern++; + if(indicePattern == pattern.size()) return false; + else return true; + } + + public boolean getFireModeFocus(){ + return fireModeFocus; + } + + public int getFireRate() { + return fireRate; + } + + public void setFireRate(int fireRate) { + this.fireRate = fireRate; + } + + public long getCurrent() { + return current; + } + + public void setCurrent(long current) { + this.current = current; + } + + public long getPrevious() { + return previous; + } + + public void setPrevious(long previous) { + this.previous = previous; + } + + public long getElapsed() { + return elapsed; + } + + public void setElapsed(long elapsed) { + this.elapsed = elapsed; + } + + public int getHP() { + return HP; + } + + public void setHP(int hP) { + HP = hP; + } + + public float getDropChance() { + return dropChance; + } + + public void setDropChance(float dropChance) { + this.dropChance = dropChance; + } + + public void setPattern(ArrayList pattern) { + this.pattern = pattern; + } + + public void setIndicePattern(int indicePattern) { + this.indicePattern = indicePattern; + } + + public void setFireModeFocus(boolean fireModeFocus) { + this.fireModeFocus = fireModeFocus; + } + + +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bas.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bas.java new file mode 100644 index 0000000..987b0ce --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bas.java @@ -0,0 +1,7 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_bas extends Monster{ + public MonsterModel_chauve_souris_focus_bas() { + super("chauve-souris", "pattern_mob_bas", 3, 18.0, 1500, true,0.5f,10); + } +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bomb.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bomb.java new file mode 100644 index 0000000..86e93ae --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_bomb.java @@ -0,0 +1,8 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_bomb extends Monster{ + + public MonsterModel_chauve_souris_focus_bomb() { + super("chauve-souris", "pattern_mob_bomb", 3, 18.0, 1500, true,0.5f,10); + } +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cross.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cross.java new file mode 100644 index 0000000..c07fcbb --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cross.java @@ -0,0 +1,8 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_cross extends Monster{ + public MonsterModel_chauve_souris_focus_cross() { + super("chauve-souris", "pattern_mob_cross", 3, 18.0, 1500, true,0.5f,10); + } + +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cube.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cube.java new file mode 100644 index 0000000..32aa707 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_cube.java @@ -0,0 +1,7 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_cube extends Monster{ + public MonsterModel_chauve_souris_focus_cube() { + super("chauve-souris", "pattern_mob_cube", 3, 18.0, 1500, true,0.5f,10); + } +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_feint.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_feint.java new file mode 100644 index 0000000..ca72f00 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_feint.java @@ -0,0 +1,7 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_feint extends Monster{ + public MonsterModel_chauve_souris_focus_feint() { + super("chauve-souris", "pattern_mob_feint", 3, 18.0, 1500, true,0.5f,10); + } +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_loop.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_loop.java new file mode 100644 index 0000000..6c96d43 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_loop.java @@ -0,0 +1,7 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_loop extends Monster{ + public MonsterModel_chauve_souris_focus_loop() { + super("chauve-souris", "pattern_mob_loop", 3, 18.0, 1500, true,0.5f,10); + } +} diff --git a/global game jam/src/Entity/MonsterModel_chauve_souris_focus_trace.java b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_trace.java new file mode 100644 index 0000000..83f3f09 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_chauve_souris_focus_trace.java @@ -0,0 +1,8 @@ +package Entity; + +public class MonsterModel_chauve_souris_focus_trace extends Monster{ + public MonsterModel_chauve_souris_focus_trace() { + super("chauve-souris", "pattern_mob_trace", 3, 18.0, 1500, true,0.5f,10); + } + +} diff --git a/global game jam/src/Entity/MonsterModel_monstre.java b/global game jam/src/Entity/MonsterModel_monstre.java new file mode 100644 index 0000000..a3bdc75 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_monstre.java @@ -0,0 +1,9 @@ +package Entity; + +public class MonsterModel_monstre extends Monster{ + + public MonsterModel_monstre(){ + super("monster", "pattern_1", 1, 18.0, 500, false,0.3f,20); + } + +} diff --git a/global game jam/src/Entity/MonsterModel_squelette_focus_bomb.java b/global game jam/src/Entity/MonsterModel_squelette_focus_bomb.java new file mode 100644 index 0000000..173d774 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_squelette_focus_bomb.java @@ -0,0 +1,8 @@ +package Entity; + +public class MonsterModel_squelette_focus_bomb extends Monster{ + public MonsterModel_squelette_focus_bomb() { + super("squelette", "pattern_mob_bomb", 3, 18.0, 1500, true,0.7f,10); + } + +} diff --git a/global game jam/src/Entity/MonsterModel_squelette_focus_loop.java b/global game jam/src/Entity/MonsterModel_squelette_focus_loop.java new file mode 100644 index 0000000..e68f4c6 --- /dev/null +++ b/global game jam/src/Entity/MonsterModel_squelette_focus_loop.java @@ -0,0 +1,8 @@ +package Entity; + +public class MonsterModel_squelette_focus_loop extends Monster{ + public MonsterModel_squelette_focus_loop() { + super("squelette", "pattern_mob_loop", 3, 18.0, 1500, true,0.7f,10); + } + +} diff --git a/global game jam/src/Entity/Player.java b/global game jam/src/Entity/Player.java new file mode 100644 index 0000000..241088f --- /dev/null +++ b/global game jam/src/Entity/Player.java @@ -0,0 +1,335 @@ +package Entity; + +import java.awt.*; +import java.util.ArrayList; + +import acm.graphics.GImage; +import acm.util.SwingTimer; + + + +public class Player extends Entity{ + + public static ArrayList bulletsList = new ArrayList(); + private int fireRate = 100; // temps entre chaque tire en ms + private long current,previous = 0,elapsed = 0,elapsedDead = 0,elapsedRitual = 0; + private float ritualPercentage = 50f,power = 0.0f,spell = 0.0f,powerLevel = 0, spellLevel = 0; + private boolean isDead = false; + public boolean inBoss = false; + + private double minX = Jeu.Jeu.MARGIN + 0.11, maxX = Jeu.Jeu.MARGIN + Jeu.Jeu.SIZE_OF_GAME - 0.173, minY = 0.3, maxY = 0.8; + + private double xCenterSpell, yCenterSpell; + private GImage imageSpell = new GImage("res/textures/spell.png"); + private double widthSpell = imageSpell.getWidth(), heightSpell = imageSpell.getHeight(); + private SwingTimer timerAnimSpell = new SwingTimer(20, null); + private int nbRepAnimSpell = 0; + private boolean isInvul = false; + + public Player(){ + super("res/textures/joueur.png"); + moveSpeed = 0.008; + + setPosition(0.38, 0.8); + current = System.currentTimeMillis(); + } + + public ArrayList getBulletsList(){ + return bulletsList; + } + + public void addBullet(String name, double xTarget, double yTarget, int damage){ + bulletsList.add(new Bullet(name, x + (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(), y , xTarget, yTarget, 0.018, damage)); + } + + public boolean isTimeOut(){ + return elapsed >= fireRate; + } + + public void resetTimer(){ + elapsed -= fireRate; + } + + public void setTimerTo0(){ + current = System.currentTimeMillis(); + previous = 0; + elapsed = 0; + } + + public boolean isDead() { + return isDead; + } + + public void setDead(boolean isDead) { + this.isDead = isDead; + if(isDead){ + setPosition(0.38, 0.8); + powerLevel--; + if(powerLevel <0 )powerLevel = 0; + if(powerLevel == 0){ + ritualPercentage -= 10; + } + elapsedDead = 0; + } + } + + public void update() { + previous = current; + current = System.currentTimeMillis(); + elapsed += current - previous; + elapsedDead += current - previous; + if(!Jeu.Jeu.jeu.world.getBossSpawned())elapsedRitual += current - previous; + try{for(Bullet b : bulletsList)b.update();}catch(Exception e){} + if(ritualPercentage>100)ritualPercentage=100; + if(ritualPercentage<0)ritualPercentage=0; + if(power>100)power=100; + if(power<0)power=0; + if(spell>100)spell=100; + if(spell<0)spell=0; + if(elapsedDead <= 5000 && isDead){ + isInvul = true; + } + if(elapsedDead > 5000 && isDead){ + isDead = false; + isInvul = false; + elapsedDead = 0; + image.setVisible(true); + } + if(isDead){ + if(System.currentTimeMillis()%500 < 250){ + image.setVisible(false); + }else{ + image.setVisible(true); + } + } + if(elapsedRitual>=3000 && !Jeu.Jeu.jeu.world.getBossSpawned()){ + ritualPercentage -= 1; + elapsedRitual -= 3000; + } + } + + public int getFireRate() { + return fireRate; + } + + public void setFireRate(int fireRate) { + this.fireRate = fireRate; + } + + public long getCurrent() { + return current; + } + + public void setCurrent(long current) { + this.current = current; + } + + public long getPrevious() { + return previous; + } + + public void setPrevious(long previous) { + this.previous = previous; + } + + public long getElapsed() { + return elapsed; + } + + public void setElapsed(long elapsed) { + this.elapsed = elapsed; + } + + public float getRitualPercentage() { + return ritualPercentage; + } + + public void setRitualPercentage(float ritualPercentage) { + this.ritualPercentage = ritualPercentage; + } + + public void setBulletsList(ArrayList bulletsList) { + this.bulletsList = bulletsList; + } + + + public float getPower() { + return power; + } + + public void setPower(float power) { + this.power = power; + if(this.power >= 100){ + this.powerLevel++; + this.power -= 100; + } + } + + public double getMinX() { + return minX; + } + + public void setMinX(double minX) { + this.minX = minX; + } + + public double getMaxX() { + return maxX; + } + + public void setMaxX(double maxX) { + this.maxX = maxX; + } + + public double getMinY() { + return minY; + } + + public void setMinY(double minY) { + this.minY = minY; + } + + public double getMaxY() { + return maxY; + } + + public void setMaxY(double maxY) { + this.maxY = maxY; + } + + public void move(double x, double y){ + x += this.x; + y += this.y; + + if(x < minX) x = minX; + if(x > maxX) x = maxX; + if(y < minY) y = minY; + if(y > maxY) y = maxY; + image.setLocation(Jeu.Jeu.resolution.getWidth() * x, Jeu.Jeu.resolution.getHeight() * y); + this.x = x; + this.y = y; + } + + public float getSpell() { + return spell; + } + + public void setSpell(float spell) { + this.spell = spell; + if(this.spellLevel == 3){ + if(this.spell >= 100){ + this.spell = 100; + } + } + else if(this.spell >= 100){ + this.spellLevel++; + this.spell -= 100; + } + } + + public int getPowerLevel() { + return (int)powerLevel; + } + + public void setPowerLevel(float powerLevel) { + this.powerLevel = powerLevel; + } + + public int getSpellLevel() { + return (int)spellLevel; + } + + public void setSpellLevel(float spellLevel) { + this.spellLevel = spellLevel; + } + + public double getXCenterSpell(){ + return xCenterSpell; + } + + public double getYCenterSpell(){ + return yCenterSpell; + } + + public void setXCenterSpell(double p){ + xCenterSpell = p; + } + + public void setYCenterSpell(double p){ + yCenterSpell = p; + } + + public GImage getImageSpell(){ + return imageSpell; + } + + public SwingTimer getTimerAnimSpell(){ + return timerAnimSpell; + } + + public int getNbRepAnimSpell(){ + return nbRepAnimSpell; + } + + public void setNbRepAnimSpell(int p){ + nbRepAnimSpell = p; + } + + public double getWidthSpell(){ + return widthSpell; + } + + public double getHeightSpell(){ + return heightSpell; + } + + public long getElapsedDead() { + return elapsedDead; + } + + public void setElapsedDead(long elapsedDead) { + this.elapsedDead = elapsedDead; + } + + public double getxCenterSpell() { + return xCenterSpell; + } + + public void setxCenterSpell(double xCenterSpell) { + this.xCenterSpell = xCenterSpell; + } + + public double getyCenterSpell() { + return yCenterSpell; + } + + public void setyCenterSpell(double yCenterSpell) { + this.yCenterSpell = yCenterSpell; + } + + public boolean isInvul() { + return isInvul; + } + + public void setInvul(boolean isInvul) { + this.isInvul = isInvul; + } + + public void setImageSpell(GImage imageSpell) { + this.imageSpell = imageSpell; + } + + public void setWidthSpell(double widthSpell) { + this.widthSpell = widthSpell; + } + + public void setHeightSpell(double heightSpell) { + this.heightSpell = heightSpell; + } + + public void setTimerAnimSpell(SwingTimer timerAnimSpell) { + this.timerAnimSpell = timerAnimSpell; + } + + +} diff --git a/global game jam/src/Entity/ShootingPattern.java b/global game jam/src/Entity/ShootingPattern.java new file mode 100644 index 0000000..155ec20 --- /dev/null +++ b/global game jam/src/Entity/ShootingPattern.java @@ -0,0 +1,18 @@ +package Entity; + +import java.util.ArrayList; + +public class ShootingPattern { + + protected ArrayList listTimedBullet = new ArrayList(); + protected int hpFinish; + protected long duration; + + public ShootingPattern(){ + } + + public ArrayList getListTimedBullet(){ + return listTimedBullet; + } + +} diff --git a/global game jam/src/Entity/ShootingPattern_0.java b/global game jam/src/Entity/ShootingPattern_0.java new file mode 100644 index 0000000..506f8dd --- /dev/null +++ b/global game jam/src/Entity/ShootingPattern_0.java @@ -0,0 +1,17 @@ +package Entity; + +public class ShootingPattern_0 extends ShootingPattern{ + + public ShootingPattern_0(){ + super(); + + listTimedBullet.add(new TimedBullet("grosse boule", 0.0065, 0)); + listTimedBullet.add(new TimedBullet("grosse boule", 0.0065, 1000)); + listTimedBullet.add(new TimedBullet("grosse boule", 0.0065, 2000)); + listTimedBullet.add(new TimedBullet("grosse boule", 0.0065, 3000)); + listTimedBullet.add(new TimedBullet("grosse boule", 0.0065, 4000)); + + hpFinish = 0; + duration = 6000; + } +} diff --git a/global game jam/src/Entity/ShootingPattern_1.java b/global game jam/src/Entity/ShootingPattern_1.java new file mode 100644 index 0000000..a1a124a --- /dev/null +++ b/global game jam/src/Entity/ShootingPattern_1.java @@ -0,0 +1,16 @@ +package Entity; + +public class ShootingPattern_1 extends ShootingPattern{ + + public ShootingPattern_1(){ + super(); + + listTimedBullet.add(new TimedBullet(0.0, 0.3, "tireau", 0.005, 0)); + listTimedBullet.add(new TimedBullet(-0.03, 0.3, "tireau", 0.005, 0)); + listTimedBullet.add(new TimedBullet(0.03, 0.3, "tireau", 0.005, 0)); + + hpFinish = 180; + duration = 800; + } + +} diff --git a/global game jam/src/Entity/TimedBullet.java b/global game jam/src/Entity/TimedBullet.java new file mode 100644 index 0000000..20c2c95 --- /dev/null +++ b/global game jam/src/Entity/TimedBullet.java @@ -0,0 +1,27 @@ +package Entity; + +public class TimedBullet{ + + public boolean isFocusOnPlayer, isAlreadyShot; + public String name; + public double x, y, moveSpeed; + public long shotTimer; + + public TimedBullet(String name, double moveSpeed, long shotTimer){ + this.isFocusOnPlayer = true; + this.name = name; + this.moveSpeed = moveSpeed; + this.shotTimer = shotTimer; + isAlreadyShot = false; + } + + public TimedBullet(double x, double y, String name, double moveSpeed, long shotTimer){ + this.isFocusOnPlayer = false; + this.x = x; + this.y = y; + this.name = name; + this.moveSpeed = moveSpeed; + this.shotTimer = shotTimer; + isAlreadyShot = false; + } +} diff --git a/global game jam/src/Entity/Ulti.java b/global game jam/src/Entity/Ulti.java new file mode 100644 index 0000000..f433297 --- /dev/null +++ b/global game jam/src/Entity/Ulti.java @@ -0,0 +1,54 @@ +package Entity; + +import acm.graphics.GImage; +import acm.util.SwingTimer; + +public class Ulti extends Entity{ + + public static final int TIME = 1000; + private long current, previous = 0, elapsed = 0,elapsedSacrifice = 0; + private boolean isSacrifice = false; + + public Ulti(double x, double y, String url) { + super(url); + setPosition(x, y); + current = System.currentTimeMillis(); + } + + public void update() { + if(!Jeu.Jeu.jeu.isGameOver){ + previous = current; + current = System.currentTimeMillis(); + elapsed += current - previous; + if(isSacrifice)elapsedSacrifice += current - previous; + if(elapsed >= TIME){ + Player.bulletsList.add(new Bullet("tir joueur", x + (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(), y , x + (image.getWidth() / 2) / Jeu.Jeu.resolution.getWidth(), y - 0.05, 0.018, 1)); + Jeu.Jeu.gc.add(Player.bulletsList.get(Player.bulletsList.size() - 1).getImage()); + elapsed -= TIME; + } + + if(isSacrifice && y > 0.5){ + move(0, -.006); + } + } + } + + public void resetTimer(){ + elapsed = 0; + } + + public boolean isSacrifice(){ + return isSacrifice && elapsedSacrifice > 1000; + } + + public void sacrifice(){ + isSacrifice = true; + } + + public void setTimerTo0(){ + current = System.currentTimeMillis(); + previous = 0; + elapsed = 0; + } + +} diff --git a/global game jam/src/Gui/Boutons.java b/global game jam/src/Gui/Boutons.java new file mode 100644 index 0000000..a9176e8 --- /dev/null +++ b/global game jam/src/Gui/Boutons.java @@ -0,0 +1,100 @@ +package Gui; +import acm.graphics.*; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Image; + +public class Boutons { + private GImage bouton; // la GImage du bouton qui est affiché sur l'écran + private Image boutonSurvole, boutonNormal; // les différentes textures du bouton + private GLabel texte; // le texte du bouton + private double posiX, posiY, tailleX, tailleY; // la position et les dimension du bouton + private boolean survole = false, affiche = false; + private Dimension dim; + + public Boutons(String nomImage, int x ,int y, String texteP, String police, Color couleurTxt, Dimension dimP){ // constructeur du bouton + dim = dimP; + posiX = x; + posiY = y; + + boutonNormal = new GImage("Ressources Editeur/HUD/Boutons/" + nomImage + ".png").getImage(); + + boutonSurvole = new GImage("Ressources Editeur/HUD/Boutons/" + nomImage + "_survolé.png").getImage(); + + bouton = new GImage(boutonNormal, posiX, posiY); + bouton.setSize((bouton.getWidth() * dim.getWidth() / 1920), (bouton.getHeight() * dim.getHeight() / 1080)); + + tailleX = (int)bouton.getWidth(); + tailleY = (int)bouton.getHeight(); + + texte = new GLabel(texteP); + texte.setFont(police); + texte.setColor(couleurTxt); + texte.setLocation(posiX + tailleX/2 - (int)texte.getWidth()/2, posiY + tailleY/2 + (int)texte.getHeight()/2 -7); + } + + public GImage getBouton(){ + return bouton; + } + + public Image getBoutonSurvole(){ + return boutonSurvole; + } + + public Image getBoutonNormal(){ + return boutonNormal; + } + + public boolean getSurvole(){ + return survole; + } + + public GLabel getTexte(){ + return texte; + } + + public void setSurvole(boolean p){ + survole = p; + } + + public void setPositionCentre(double x, double y){ + posiX = x * dim.getWidth() - bouton.getWidth() / 2; + posiY = y * dim.getHeight() - bouton.getHeight() / 2; + + bouton.setLocation(posiX, posiY); + texte.setLocation(posiX + tailleX/2 - (int)texte.getWidth()/2, posiY + tailleY/2 + (int)texte.getHeight()/2 -7); + } + + public boolean hitBox(int x,int y){ // méthode qui renvoie vrai si la sourie est sur le bouton ( pour le clic par exemple ) + if(x>=posiX && x<= posiX + tailleX && y>=posiY && y<=posiY+tailleY){ + return true; + } + else{ + return false; + } + } + + public boolean gestionSurvole(int x, int y){ + if(hitBox(x, y) && survole == false){ + survole = true; + bouton.setImage(boutonSurvole); + bouton.setSize((bouton.getWidth() / 1920) * dim.getWidth(), (bouton.getHeight() / 1080) * dim.getHeight()); + } + if(hitBox(x, y) == false && survole){ + survole = false; + bouton.setImage(boutonNormal); + bouton.setSize((bouton.getWidth() / 1920) * dim.getWidth(), (bouton.getHeight() / 1080) * dim.getHeight()); + } + if(survole) return true; + return false; + } + + public boolean getAffiche(){ + return affiche; + } + + public void setAffiche(boolean p){ + affiche = p; + } +} diff --git a/global game jam/src/Items/Items.java b/global game jam/src/Items/Items.java new file mode 100644 index 0000000..5dbad3c --- /dev/null +++ b/global game jam/src/Items/Items.java @@ -0,0 +1,57 @@ +package Items; + +import Entity.*; +import acm.graphics.*; + +public abstract class Items { + + private double x,y; + private GImage image; + + public Items(double x,double y,String url){ + image = new GImage(url); + image.setLocation(x,y); + this.x = x; + this.y = y; + Jeu.Jeu.gc.add(image); + } + + public void move(double x,double y){ + image.move(x, y); + x = image.getX(); + y = image.getY(); + } + + public abstract void action(Player player); + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void delete(){ + Jeu.Jeu.gc.remove(image); + } + + public void setY(double y) { + this.y = y; + } + + public GImage getImage() { + return image; + } + + public void setImage(GImage image) { + this.image = image; + } + + + +} diff --git a/global game jam/src/Items/PowerItems.java b/global game jam/src/Items/PowerItems.java new file mode 100644 index 0000000..c09472a --- /dev/null +++ b/global game jam/src/Items/PowerItems.java @@ -0,0 +1,15 @@ +package Items; + +import Entity.*; + +public class PowerItems extends Items{ + + public PowerItems(double x, double y) { + super(x, y, "res/textures/power.png"); + } + + public void action(Player player) { + player.setPower(player.getPower() + 50.0f); + } + +} diff --git a/global game jam/src/Items/SpellItems.java b/global game jam/src/Items/SpellItems.java new file mode 100644 index 0000000..c8af697 --- /dev/null +++ b/global game jam/src/Items/SpellItems.java @@ -0,0 +1,15 @@ +package Items; + +import Entity.*; + +public class SpellItems extends Items{ + + public SpellItems(double x, double y) { + super(x, y, "res/textures/spell drop.png"); + } + + public void action(Player player) { + player.setSpell(player.getSpell() + 50); + } + +} diff --git a/global game jam/src/Tools/Coord.java b/global game jam/src/Tools/Coord.java new file mode 100644 index 0000000..14940e6 --- /dev/null +++ b/global game jam/src/Tools/Coord.java @@ -0,0 +1,11 @@ +package Tools; + +public class Coord { + + public int x, y; + + public Coord(int x, int y){ + this.x = x; + this.y = y; + } +} diff --git a/global game jam/src/Tools/ImagePhysics.java b/global game jam/src/Tools/ImagePhysics.java new file mode 100644 index 0000000..bc6d1b0 --- /dev/null +++ b/global game jam/src/Tools/ImagePhysics.java @@ -0,0 +1,40 @@ +package Tools; + +import java.awt.*; +import java.awt.image.*; +import java.io.*; + +import javax.imageio.*; + +public class ImagePhysics { + + public static final byte RED_COLOR = 0, GREEN_COLOR = 1, BLUE_COLOR = 2; + + private BufferedImage image; + private int height,width; + + public ImagePhysics(String file){ + try{ + this.image = ImageIO.read(new File(file)); + this.width = image.getWidth(); + this.height = image.getHeight(); + + }catch(Exception e){} + } + + public int[] getDataByCoord(int x,int y){ + Color color = new Color(image.getRGB(x, y)); + return new int[]{color.getRed(),color.getGreen(),color.getBlue()}; + } + + public int getHeight() { + return height; + } + + public int getWidth() { + return width; + } + + + +} diff --git a/global game jam/src/World/MonsterSpawnPattern.java b/global game jam/src/World/MonsterSpawnPattern.java new file mode 100644 index 0000000..b5e4f24 --- /dev/null +++ b/global game jam/src/World/MonsterSpawnPattern.java @@ -0,0 +1,27 @@ +package World; + +import Entity.Monster; + + +/* + * définit le momant d'apparition d'un mob et le mob lui-même + */ +public class MonsterSpawnPattern { + private Monster monster; + private long spawnTimer; + + public MonsterSpawnPattern(Monster monster, long spawnTimer){ + this.monster = monster; + this.spawnTimer = spawnTimer; + + this.monster.setTimerTo0(); + } + + public Monster getMonster(){ + return monster; + } + + public long getSpawnTimer(){ + return spawnTimer; + } +} diff --git a/global game jam/src/World/Replique.java b/global game jam/src/World/Replique.java new file mode 100644 index 0000000..e455a4d --- /dev/null +++ b/global game jam/src/World/Replique.java @@ -0,0 +1,28 @@ +package World; + +import java.util.ArrayList; + +public class Replique { + + private String speakerName; + private String lignesReplique[] = new String[4]; + + public Replique(String speakerName, ArrayList lignesReplique){ + this.speakerName = speakerName; + this.lignesReplique[0] = ""; + this.lignesReplique[1] = ""; + this.lignesReplique[2] = ""; + this.lignesReplique[3] = ""; + for(int i=0; i listReplique = new ArrayList(); + + public Speach(String speachName){ + try{ + File fichier = new File("res/donnees/" + speachName + ".txt"); + Scanner fEntree = new Scanner(new BufferedInputStream(new FileInputStream(fichier))); + String line, tab[]; + ArrayList list; + + while(fEntree.hasNext()){ + list = new ArrayList(); + list.clear(); + line = fEntree.nextLine(); + tab = line.split("/#/"); + + for(int i=1; i getListReplique(){ + return listReplique; + } +} diff --git a/global game jam/src/World/Stage1.java b/global game jam/src/World/Stage1.java new file mode 100644 index 0000000..347858c --- /dev/null +++ b/global game jam/src/World/Stage1.java @@ -0,0 +1,134 @@ +package World; + +import java.awt.event.*; +import java.util.ArrayList; + +import Tools.CoordD; +import Entity.Boss; +import Entity.MonsterModel_chauve_souris_focus_bomb; +import Entity.MonsterModel_chauve_souris_focus_cross; +import Entity.MonsterModel_chauve_souris_focus_cube; +import Entity.MonsterModel_chauve_souris_focus_feint; +import Entity.MonsterModel_chauve_souris_focus_loop; +import Entity.MonsterModel_chauve_souris_focus_trace; +import Entity.MonsterModel_monstre; +import Entity.MonsterModel_squelette_focus_bomb; +import Entity.MonsterModel_squelette_focus_loop; +import Entity.ShootingPattern; +import Entity.ShootingPattern_0; +import Entity.ShootingPattern_1; + +public class Stage1 extends World{ + + public Stage1() { + super("Stage1",new String[]{"res/audio/stage_1.wav"},"res/textures/abg.png"); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 6000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 6500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 7000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 7500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 8000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 8500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 9000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 9500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 10000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cross(), 10500)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_squelette_focus_bomb(), 18000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 22000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 22500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 23000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 23500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 24000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 24500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 25000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 25500)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 36000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 37000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 38000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 39000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_feint(), 44000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_feint(),46000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_squelette_focus_loop(), 52000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_squelette_focus_loop(), 52500)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_squelette_focus_loop(), 53000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_squelette_focus_loop(), 53500)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 70000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 72000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 74000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 76000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 71000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 73000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 75000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 77000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 78000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 80000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 82000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_cube(), 84000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 79000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 81000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 83000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 85000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_bomb(), 95000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_trace(), 95000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_trace(), 98000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 102000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 104000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 106000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_loop(), 108000)); + + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_trace(), 128000)); + monsterSpawnPattern.add(new MonsterSpawnPattern(new MonsterModel_chauve_souris_focus_trace(), 130000)); + + + listSpeach.add(new Speach("intro")); + listSpeach.add(new Speach("fin_stage_1_0m")); + listSpeach.add(new Speach("fin_stage_1_1m")); + listSpeach.add(new Speach("fin_stage_1_2m")); + listSpeach.add(new Speach("fin_stage_1_3m")); + listSpeach.add(new Speach("fin_stage_1_4m")); + + ArrayList spotCoordDs = new ArrayList(); + spotCoordDs.add(new CoordD(0.1, 0.3)); + spotCoordDs.add(new CoordD(0.35, 0.5)); + spotCoordDs.add(new CoordD(0.2, 0.05)); + + ArrayList listShootingPattern = new ArrayList(); + listShootingPattern.add(new ShootingPattern_1()); + listShootingPattern.add(new ShootingPattern_0()); + + boss = new Boss("boss", "pattern_boss_0", 300, 0.010, 15000, spotCoordDs, listShootingPattern); + } + + public void keyPressed(KeyEvent e) { + + } + + public void keyReleased(KeyEvent e) { + + } + + public void keyTyped(KeyEvent e) { + + } + + public void actionPerformed(ActionEvent e) { + + } + + + public void update() { + + } + +} diff --git a/global game jam/src/World/World.java b/global game jam/src/World/World.java new file mode 100644 index 0000000..eb3209b --- /dev/null +++ b/global game jam/src/World/World.java @@ -0,0 +1,134 @@ +package World; + +import java.awt.event.*; +import java.util.*; + +import Audio.*; +import Entity.*; +import Items.*; + +public abstract class World { + + private String stageName = ""; + private String backgroundImage; + private static ArrayList monstersList = new ArrayList(); + private static ArrayList bulletsList = new ArrayList(); + private static ArrayList bossBulletsList = new ArrayList(); + private static ArrayList itemsList = new ArrayList(); + private static ArrayList ultiList = new ArrayList(); + protected static Boss boss; + private boolean bossSpawned = false; + + protected ArrayList monsterSpawnPattern = new ArrayList(); + protected ArrayList listSpeach = new ArrayList(); + + public World(String stageName,String[] ambientSound,String backgroundUrl){ + this.stageName = stageName; + for(String a : ambientSound){ + AudioManager.addAmbientSound(stageName, a); + } +// this.backgroundImage = new GImage(backgroundUrl); + } + + public abstract void keyPressed(KeyEvent e); + + public abstract void keyReleased(KeyEvent e); + + public abstract void keyTyped(KeyEvent e); + + public abstract void actionPerformed(ActionEvent e); + + public void updateWorld(){ + try{ + for(Monster m : monstersList){ + m.update(); + } + for(Bullet b : bulletsList){ + b.update(); + } + for(Bullet b : bossBulletsList){ + b.update(); + } + if(bossSpawned) boss.update(); + } + catch(Exception e){} + } + + public abstract void update(); + + public String getStageName() { + return stageName; + } + + public void setStageName(String stageName) { + this.stageName = stageName; + } + + public ArrayList getMonstersList(){ + return monstersList; + } + + public static ArrayList getBulletsList(){ + return bulletsList; + } + + public static ArrayList getBossBulletsList(){ + return bossBulletsList; + } + + public String getBackgroundImage() { + return backgroundImage; + } + + public void setBackgroundImage(String backgroundImage) { + this.backgroundImage = backgroundImage; + } + + public ArrayList getMonsterSpawnPattern() { + return monsterSpawnPattern; + } + + public void setMonsterSpawnPattern(ArrayList monsterSpawnPattern) { + this.monsterSpawnPattern = monsterSpawnPattern; + } + + public static void setMonstersList(ArrayList monstersList) { + World.monstersList = monstersList; + } + + public static void setBulletsList(ArrayList bulletsList) { + World.bulletsList = bulletsList; + } + + public static ArrayList getItemsList() { + return itemsList; + } + + public static void setItemsList(ArrayList itemsList) { + World.itemsList = itemsList; + } + + public static ArrayList getUltiList() { + return ultiList; + } + + public static void setUltiList(ArrayList ultiList) { + World.ultiList = ultiList; + } + + public ArrayList getListSpeach(){ + return listSpeach; + } + + public Boss getBoss(){ + return boss; + } + + public boolean getBossSpawned(){ + return bossSpawned; + } + + public void setBossSpawned(boolean p){ + bossSpawned = p; + } +} diff --git a/global game jam/src/test/Coord.java b/global game jam/src/test/Coord.java new file mode 100644 index 0000000..f8b8573 --- /dev/null +++ b/global game jam/src/test/Coord.java @@ -0,0 +1,11 @@ +package test; + +public class Coord { + + public int x, y; + + public Coord(int x, int y){ + this.x = x; + this.y = y; + } +} diff --git a/global game jam/src/test/EcranListeners.java b/global game jam/src/test/EcranListeners.java new file mode 100644 index 0000000..5cae398 --- /dev/null +++ b/global game jam/src/test/EcranListeners.java @@ -0,0 +1,84 @@ +package test; +/* + * Cette classe sert a récupérer les actions de la souris et a déclancher le timer qui lui correspond. + * Ce timer est ensuite utilisé dans la classe Jeu de la meme manière qu'un " public void mouseClicked(MouseEvent e) " + */ + +import java.awt.Dimension; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +import javax.swing.JPanel; + +import acm.util.SwingTimer; + + +@SuppressWarnings("serial") +public class EcranListeners extends JPanel implements MouseListener, MouseMotionListener{ + public int posiSourisX, posiSourisY, noBouton; + public SwingTimer sourisClicked = new SwingTimer(0, null), sourisEntered = new SwingTimer(0, null), sourisExited = new SwingTimer(0, null), sourisPressed = new SwingTimer(0, null), sourisReleased = new SwingTimer(0, null), sourisDragged = new SwingTimer(0, null), sourisMoved = new SwingTimer(0, null); + + public EcranListeners(Dimension dm){ + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setSize(dm); + this.setOpaque(false); + } + + @Override + public void mouseClicked(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getButton(); + sourisClicked.start(); + } + + @Override + public void mouseEntered(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getButton(); + sourisEntered.start(); + } + + @Override + public void mouseExited(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getButton(); + sourisExited.start(); + } + + @Override + public void mousePressed(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getButton(); + sourisPressed.start(); + } + + @Override + public void mouseReleased(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getButton(); + sourisReleased.start(); + } + + @Override + public void mouseDragged(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + noBouton = e.getModifiers(); + sourisDragged.start(); + } + + @Override + public void mouseMoved(MouseEvent e) { + posiSourisX = e.getX(); + posiSourisY = e.getY(); + sourisMoved.start(); + } + +} diff --git a/global game jam/src/test/Jeu.java b/global game jam/src/test/Jeu.java new file mode 100644 index 0000000..035002c --- /dev/null +++ b/global game jam/src/test/Jeu.java @@ -0,0 +1,229 @@ +package test; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.Socket; +import java.util.ArrayList; +import java.util.Random; + +import javax.swing.JFrame; +import javax.swing.JPanel; + +import Input.KeyCode; +import acm.graphics.GCanvas; +import acm.graphics.GContainer; +import acm.graphics.GDimension; +import acm.graphics.GImage; +import acm.graphics.GLabel; +import acm.graphics.GRect; +import acm.program.GraphicsProgram; +import acm.util.JTFTools; +import acm.util.SwingTimer; + +public class Jeu extends JFrame implements ActionListener, KeyListener{ + + // systeme ----------------------------------------------------------------- + Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); + private GCanvas gc = new GCanvas(); + private EcranListeners pan = new EcranListeners(resolution); + + // autre ------------------------------------------------------------------- + private ArrayList coords = new ArrayList(); + private int enregister = -1; + private SwingTimer refresh = new SwingTimer(25, this); + + private GLabel afficheur_timer = new GLabel("", 100, 1000); + private long timeStart, timeElapsed, timePaused, timeStartPause; + private boolean paused = false; + + public Jeu(){ + + this.setUndecorated(true); + this.setSize(this.getToolkit().getScreenSize()); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setLocationRelativeTo(null); + this.validate(); + this.setVisible(true); + gc.add(pan); + this.setContentPane(gc); + this.show(); + + pan.sourisClicked.addActionListener(this); + pan.sourisDragged.addActionListener(this); + pan.sourisEntered.addActionListener(this); + pan.sourisExited.addActionListener(this); + pan.sourisMoved.addActionListener(this); + pan.sourisPressed.addActionListener(this); + pan.sourisReleased.addActionListener(this); + + this.addKeyListener(this); + + refresh.start(); + timeStart = System.currentTimeMillis(); + timeElapsed = timeStart; + timePaused = 0; + initJeu(); + } + + public void initJeu(){ // initalise le menu principale et affiche tout son contenu + gc.removeAll(); + + afficheur_timer = new GLabel("temps : " + (timeElapsed - timeStart - timePaused), 100, 1000); + afficheur_timer.setFont("Arial-18"); + gc.add(afficheur_timer); + + gc.add(pan); + } + + @Override + public void keyPressed(KeyEvent e) { + // TODO keyPressed + switch(e.getKeyCode()){ + case KeyCode.KEY_ESCAPE: + System.exit(0); + break; + case KeyCode.KEY_S: + if(enregister == -1) + coords.clear(); + else{ + try{ + PrintWriter fSortie = new PrintWriter("pattern_mob.txt"); + for(Coord c : coords){ + + fSortie.println(c.x + " " + c.y); + } + fSortie.close(); + } + catch(IOException exception){ + System.out.println("ERREUR D'ECRITURE du fichier"); + } + } + enregister *= -1; + break; + + case KeyCode.KEY_SPACE: + if(!paused){ + timeStartPause = System.currentTimeMillis(); + paused = true; + } + else{ + paused = false; + } + break; + + case KeyCode.KEY_R: + timeStart = System.currentTimeMillis(); + timeElapsed = timeStart; + timePaused = 0; + break; + } + + } + + @Override + public void keyReleased(KeyEvent e) { + // TODO keyReleased + + } + + @Override + public void keyTyped(KeyEvent e) { + // TODO keyTyped + + } + + // ************************************************************************************ + + public void actionPerformed(ActionEvent e) { + + // TODO sourisPressed + + if(e.getSource() == pan.sourisPressed){ // quand on appuit sur un bouton de la souris + + switch(pan.noBouton){ + case MouseEvent.BUTTON1: + + break; + + case MouseEvent.BUTTON3: + + break; + } + + pan.sourisPressed.stop(); + } + + // TODO sourisReleased + + if(e.getSource() == pan.sourisReleased){ + + switch(pan.noBouton){ + case MouseEvent.BUTTON1: + + break; + + case MouseEvent.BUTTON3: + + break; + + } + + pan.sourisReleased.stop(); + } + + // TODO sourisMoved + + if(e.getSource() == pan.sourisMoved){ + + + + pan.sourisMoved.stop(); + } + + // TODO sourisDragged + + if(e.getSource() == pan.sourisDragged){ + + if((pan.noBouton & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { // si on darg la souris avec le bouton gauche + + } + + if((pan.noBouton & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { + + } + + pan.sourisDragged.stop(); + } + + // ************************************************************* + + if(e.getSource() == refresh){ + coords.add(new Coord(pan.posiSourisX, pan.posiSourisY)); + timeElapsed = System.currentTimeMillis(); + if(paused){ + timePaused += timeElapsed - timeStartPause; + timeStartPause = System.currentTimeMillis(); + } + afficheur_timer.setLabel("temps : " + (timeElapsed - timeStart - timePaused)); + } + } + +} diff --git a/global game jam/src/test/main.java b/global game jam/src/test/main.java new file mode 100644 index 0000000..de8a5b5 --- /dev/null +++ b/global game jam/src/test/main.java @@ -0,0 +1,8 @@ +package test; +public class main{ + + public static void main(String[] args) { + new Jeu(); + } + +}