diff --git a/hs_err_pid27428.log b/hs_err_pid27428.log new file mode 100644 index 000000000..94da50774 --- /dev/null +++ b/hs_err_pid27428.log @@ -0,0 +1,801 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fffef46e736, pid=27428, tid=27320 +# +# JRE version: OpenJDK Runtime Environment (17.0.2+8) (build 17.0.2+8-86) +# Java VM: OpenJDK 64-Bit Server VM (17.0.2+8-86, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) +# Problematic frame: +# C [ig11icd64.dll+0x59e736] +# +# No core dump will be written. Minidumps are not enabled by default on client versions of Windows +# +# If you would like to submit a bug report, please visit: +# https://bugreport.java.com/bugreport/crash.jsp +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- S U M M A R Y ------------ + +Command Line: -XX:+ShowCodeDetailsInExceptionMessages com.csse3200.game.desktop.DesktopLauncher + +Host: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz, 8 cores, 15G, Windows 10 , 64 bit Build 19041 (10.0.19041.3393) +Time: Sat Sep 16 15:12:53 2023 E. Australia Standard Time elapsed time: 78.575702 seconds (0d 0h 1m 18s) + +--------------- T H R E A D --------------- + +Current thread (0x000001903ecaab90): JavaThread "Timer-18" [_thread_in_native, id=27320, stack(0x00000025f0700000,0x00000025f0800000)] + +Stack: [0x00000025f0700000,0x00000025f0800000], sp=0x00000025f07fdd00, free space=1015k +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [ig11icd64.dll+0x59e736] + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +j com.badlogic.gdx.physics.box2d.World.jniCreateBody(JIFFFFFFFFZZZZZF)J+0 +j com.badlogic.gdx.physics.box2d.World.createBody(Lcom/badlogic/gdx/physics/box2d/BodyDef;)Lcom/badlogic/gdx/physics/box2d/Body;+80 +J 3361 c1 com.csse3200.game.physics.components.PhysicsComponent.(Lcom/csse3200/game/physics/PhysicsEngine;)V (58 bytes) @ 0x0000019016efcd44 [0x0000019016efca80+0x00000000000002c4] +J 3360 c1 com.csse3200.game.physics.components.PhysicsComponent.()V (11 bytes) @ 0x0000019016efc6b4 [0x0000019016efc5c0+0x00000000000000f4] +j com.csse3200.game.entities.factories.ProjectileFactory.createBaseProjectile(SLcom/badlogic/gdx/math/Vector2;Lcom/badlogic/gdx/math/Vector2;)Lcom/csse3200/game/entities/Entity;+38 +j com.csse3200.game.entities.factories.ProjectileFactory.createMobBall(SLcom/badlogic/gdx/math/Vector2;Lcom/badlogic/gdx/math/Vector2;)Lcom/csse3200/game/entities/Entity;+3 +j com.csse3200.game.components.tasks.MobAttackTask.updateMobState()V+307 +j com.csse3200.game.components.tasks.MobAttackTask.update()V+1 +J 3274 c2 com.csse3200.game.ai.tasks.AITaskComponent.update()V (42 bytes) @ 0x000001901dfb572c [0x000001901dfb4fe0+0x000000000000074c] +j com.csse3200.game.ai.tasks.AITaskComponent.restore()V+77 +j com.csse3200.game.components.EffectsComponent$3.run()V+4 +j java.util.TimerThread.mainLoop()V+221 java.base@17.0.2 +j java.util.TimerThread.run()V+1 java.base@17.0.2 +v ~StubRoutines::call_stub + +siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000178 + + +Register to memory mapping: + +RIP=0x00007fffef46e736 ig11icd64.dll +RAX=0x0 is NULL +RBX=0x000001903421fbc0 points into unknown readable memory: 0x00000190342f5700 | 00 57 2f 34 90 01 00 00 +RCX=0x0 is NULL +RDX=0x0000000000000004 is an unknown value +RSP=0x00000025f07fdd00 is pointing into the stack for thread: 0x000001903ecaab90 +RBP=0x0000000000000004 is an unknown value +RSI=0x000001903421fbc0 points into unknown readable memory: 0x00000190342f5700 | 00 57 2f 34 90 01 00 00 +RDI=0x0 is NULL +R8 =0x0000000000000001 is an unknown value +R9 =0x0000000000000001 is an unknown value +R10=0x000000007ffe0384 points into unknown readable memory: 00 00 00 00 +R11=0x00000025f07fdef0 is pointing into the stack for thread: 0x000001903ecaab90 +R12=0x00007fffef41e090 ig11icd64.dll +R13=0x0000000000000003 is an unknown value +R14=0x0 is NULL +R15=0x0000000000000001 is an unknown value + + +Registers: +RAX=0x0000000000000000, RBX=0x000001903421fbc0, RCX=0x0000000000000000, RDX=0x0000000000000004 +RSP=0x00000025f07fdd00, RBP=0x0000000000000004, RSI=0x000001903421fbc0, RDI=0x0000000000000000 +R8 =0x0000000000000001, R9 =0x0000000000000001, R10=0x000000007ffe0384, R11=0x00000025f07fdef0 +R12=0x00007fffef41e090, R13=0x0000000000000003, R14=0x0000000000000000, R15=0x0000000000000001 +RIP=0x00007fffef46e736, EFLAGS=0x0000000000010206 + +Top of Stack: (sp=0x00000025f07fdd00) +0x00000025f07fdd00: 0000000000000000 0000019033ad7d58 +0x00000025f07fdd10: 0000000000000003 00007ff8a81064c0 +0x00000025f07fdd20: 0000000000000000 00007fffef56207c +0x00000025f07fdd30: 00007ff8a81064c0 00007ff8a81066cc +0x00000025f07fdd40: 0000000000000001 0000019041127ed0 +0x00000025f07fdd50: 0000000000000001 00007ff8115e0000 +0x00000025f07fdd60: 0000000000000001 00007fffeeed0000 +0x00000025f07fdd70: 0000000000000003 0000000000000000 +0x00000025f07fdd80: 0000000000000001 00007fffef56249d +0x00000025f07fdd90: 0000019041127ed0 000001903421fbc0 +0x00000025f07fdda0: 0000019041127ed0 00007ff8118f8211 +0x00000025f07fddb0: 0000000000000000 00007fffef469e29 +0x00000025f07fddc0: 00000025f07fddf0 0000000000006ab8 +0x00000025f07fddd0: 0000000000000000 00007ff8118f7b9d +0x00000025f07fdde0: 0000000000000000 00007ff800000000 +0x00000025f07fddf0: 00007ff800000001 0000000000000000 + +Instructions: (pc=0x00007fffef46e736) +0x00007fffef46e636: 4a 8b 04 20 40 38 3c 01 75 05 e8 33 fb fa ff 65 +0x00007fffef46e646: 48 8b 04 25 58 00 00 00 45 33 c0 41 b9 10 00 00 +0x00007fffef46e656: 00 ba 05 05 00 00 4a 8b 0c 20 4a 8b 0c 09 e8 b7 +0x00007fffef46e666: 38 04 00 48 8b cb e8 bf 00 00 00 8b 83 18 01 00 +0x00007fffef46e676: 00 4c 89 74 c3 18 8b 83 18 01 00 00 ff c0 83 e0 +0x00007fffef46e686: 1f 89 83 18 01 00 00 40 38 3b 74 50 48 8b 83 20 +0x00007fffef46e696: 01 00 00 48 8b 08 48 8b 53 08 8b 43 10 48 2b d1 +0x00007fffef46e6a6: 48 3b d0 76 37 8b 83 18 01 00 00 48 8d 8b d8 01 +0x00007fffef46e6b6: 00 00 4c 8b 44 c3 18 48 8b 41 10 4c 8b 08 4d 3b +0x00007fffef46e6c6: c8 73 19 0f ae e8 48 8b 93 38 01 00 00 49 c7 c1 +0x00007fffef46e6d6: ff ff ff ff 8b 52 20 e8 3e e8 00 00 45 33 c9 45 +0x00007fffef46e6e6: 33 c0 48 8b d3 33 c9 e8 2e e9 01 00 85 f6 40 0f +0x00007fffef46e6f6: 94 c7 8b c7 48 8b 8d 20 01 00 00 48 33 cc e8 d7 +0x00007fffef46e706: f9 fa ff 48 81 c4 30 02 00 00 41 5f 41 5e 41 5c +0x00007fffef46e716: 5f 5e 5b 5d c3 cc cc cc cc cc cc cc cc cc cc cc +0x00007fffef46e726: cc cc cc cc cc cc cc cc cc cc 40 57 48 83 ec 20 +0x00007fffef46e736: 48 83 b9 78 01 00 00 00 48 8b f9 0f 84 9e 00 00 +0x00007fffef46e746: 00 48 8b 89 88 01 00 00 48 89 5c 24 30 ff 15 b7 +0x00007fffef46e756: 59 5a 00 48 8b 9f 78 01 00 00 48 85 db 74 6e 48 +0x00007fffef46e766: 89 74 24 38 33 f6 0f 1f 40 00 48 8d 4b 08 41 b8 +0x00007fffef46e776: 01 00 00 00 48 8b d7 e8 de 5a a8 ff 48 8b d3 4c +0x00007fffef46e786: 8d 43 40 4c 8b cb 49 8b 18 48 8b 42 48 48 85 c0 +0x00007fffef46e796: 75 09 48 89 9f 78 01 00 00 eb 04 48 89 58 40 49 +0x00007fffef46e7a6: 8b 08 49 8b 41 48 48 85 c9 75 09 48 89 87 80 01 +0x00007fffef46e7b6: 00 00 eb 04 48 89 41 48 48 89 72 48 49 89 30 c6 +0x00007fffef46e7c6: 42 38 01 48 85 db 75 a2 48 8b 74 24 38 48 8b 8f +0x00007fffef46e7d6: 88 01 00 00 ff 15 68 5a 5a 00 48 8b 5c 24 30 48 +0x00007fffef46e7e6: 83 c4 20 5f c3 cc cc cc cc cc cc cc cc cc cc cc +0x00007fffef46e7f6: cc cc cc cc cc cc cc cc cc cc 48 8b c1 41 b8 01 +0x00007fffef46e806: 00 00 00 48 8d 4a 08 48 8b d0 e9 4b 5a a8 ff cc +0x00007fffef46e816: cc cc cc cc cc cc cc cc cc cc 48 89 5c 24 18 57 +0x00007fffef46e826: 48 83 ec 20 48 8b d9 48 8b 89 38 01 00 00 48 85 + + +Stack slot to memory mapping: +stack at sp + 0 slots: 0x0 is NULL +stack at sp + 1 slots: 0x0000019033ad7d58 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00 +stack at sp + 2 slots: 0x0000000000000003 is an unknown value +stack at sp + 3 slots: 0x00007ff8a81064c0 dxgi.dll +stack at sp + 4 slots: 0x0 is NULL +stack at sp + 5 slots: 0x00007fffef56207c ig11icd64.dll +stack at sp + 6 slots: 0x00007ff8a81064c0 dxgi.dll +stack at sp + 7 slots: 0x00007ff8a81066cc dxgi.dll + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x0000019034d4db10, length=48, elements={ +0x000001900ea74670, 0x0000019031616c30, 0x00000190316177e0, 0x000001903162a300, +0x000001903162aeb0, 0x000001903162e880, 0x000001903162f230, 0x000001903162ffc0, +0x0000019031633f60, 0x000001903163c960, 0x00000190320fdda0, 0x0000019032106300, +0x000001903473b7a0, 0x000001903470f740, 0x00000190348108c0, 0x00000190348138e0, +0x0000019034813db0, 0x0000019034811260, 0x0000019034812a70, 0x0000019034811c00, +0x00000190348125a0, 0x0000019034812f40, 0x0000019034811730, 0x00000190348120d0, +0x0000019034813410, 0x000001903ecab060, 0x000001903eca8040, 0x000001903ecaa6c0, +0x000001903eca8510, 0x000001903eca9380, 0x000001903eca89e0, 0x000001903eca8eb0, +0x000001903eca9850, 0x000001903ecaa1f0, 0x000001903eca9d20, 0x000001903ecaab90, +0x000001903ecaba00, 0x000001903ecab530, 0x0000019034b789b0, 0x0000019034b73310, +0x0000019034b79350, 0x0000019034b75e60, 0x0000019034b7ab60, 0x0000019034b74180, +0x0000019034b74b20, 0x0000019034b77670, 0x0000019034b77b40, 0x0000019034b76800 +} + +Java Threads: ( => current thread ) + 0x000001900ea74670 JavaThread "main" [_thread_in_native, id=12268, stack(0x00000025ed000000,0x00000025ed100000)] + 0x0000019031616c30 JavaThread "Reference Handler" daemon [_thread_blocked, id=29428, stack(0x00000025ed700000,0x00000025ed800000)] + 0x00000190316177e0 JavaThread "Finalizer" daemon [_thread_blocked, id=11272, stack(0x00000025ed800000,0x00000025ed900000)] + 0x000001903162a300 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=25568, stack(0x00000025ed900000,0x00000025eda00000)] + 0x000001903162aeb0 JavaThread "Attach Listener" daemon [_thread_blocked, id=18664, stack(0x00000025eda00000,0x00000025edb00000)] + 0x000001903162e880 JavaThread "Service Thread" daemon [_thread_blocked, id=22564, stack(0x00000025edb00000,0x00000025edc00000)] + 0x000001903162f230 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=13608, stack(0x00000025edc00000,0x00000025edd00000)] + 0x000001903162ffc0 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=17244, stack(0x00000025edd00000,0x00000025ede00000)] + 0x0000019031633f60 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=25048, stack(0x00000025ede00000,0x00000025edf00000)] + 0x000001903163c960 JavaThread "Sweeper thread" daemon [_thread_blocked, id=10700, stack(0x00000025edf00000,0x00000025ee000000)] + 0x00000190320fdda0 JavaThread "Notification Thread" daemon [_thread_blocked, id=17436, stack(0x00000025ee000000,0x00000025ee100000)] + 0x0000019032106300 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=22644, stack(0x00000025ee200000,0x00000025ee300000)] + 0x000001903473b7a0 JavaThread "AssetManager" daemon [_thread_blocked, id=17040, stack(0x00000025eec00000,0x00000025eed00000)] + 0x000001903470f740 JavaThread "LWJGL3 Timer" daemon [_thread_blocked, id=27600, stack(0x00000025ef400000,0x00000025ef500000)] + 0x00000190348108c0 JavaThread "AssetManager" daemon [_thread_blocked, id=15892, stack(0x00000025ef500000,0x00000025ef600000)] + 0x00000190348138e0 JavaThread "Timer-0" [_thread_blocked, id=10824, stack(0x00000025ef800000,0x00000025ef900000)] + 0x0000019034813db0 JavaThread "AssetManager" daemon [_thread_blocked, id=15560, stack(0x00000025ef700000,0x00000025ef800000)] + 0x0000019034811260 JavaThread "Timer-1" [_thread_in_native, id=10376, stack(0x00000025efa00000,0x00000025efb00000)] + 0x0000019034812a70 JavaThread "Timer" daemon [_thread_blocked, id=11880, stack(0x00000025ef600000,0x00000025ef700000)] + 0x0000019034811c00 JavaThread "Timer-2" [_thread_blocked, id=24064, stack(0x00000025ecd00000,0x00000025ece00000)] + 0x00000190348125a0 JavaThread "Timer-3" [_thread_blocked, id=29292, stack(0x00000025ece00000,0x00000025ecf00000)] + 0x0000019034812f40 JavaThread "Timer-4" [_thread_blocked, id=28352, stack(0x00000025ecf00000,0x00000025ed000000)] + 0x0000019034811730 JavaThread "Timer-5" [_thread_blocked, id=18320, stack(0x00000025ef900000,0x00000025efa00000)] + 0x00000190348120d0 JavaThread "Timer-6" [_thread_blocked, id=17660, stack(0x00000025efb00000,0x00000025efc00000)] + 0x0000019034813410 JavaThread "Timer-7" [_thread_blocked, id=27040, stack(0x00000025efc00000,0x00000025efd00000)] + 0x000001903ecab060 JavaThread "Timer-8" [_thread_blocked, id=6116, stack(0x00000025efd00000,0x00000025efe00000)] + 0x000001903eca8040 JavaThread "Timer-9" [_thread_blocked, id=22184, stack(0x00000025efe00000,0x00000025eff00000)] + 0x000001903ecaa6c0 JavaThread "Timer-10" [_thread_blocked, id=12320, stack(0x00000025eff00000,0x00000025f0000000)] + 0x000001903eca8510 JavaThread "Timer-11" [_thread_blocked, id=29132, stack(0x00000025f0000000,0x00000025f0100000)] + 0x000001903eca9380 JavaThread "Timer-12" [_thread_blocked, id=17952, stack(0x00000025f0100000,0x00000025f0200000)] + 0x000001903eca89e0 JavaThread "Timer-13" [_thread_blocked, id=15552, stack(0x00000025f0200000,0x00000025f0300000)] + 0x000001903eca8eb0 JavaThread "Timer-14" [_thread_blocked, id=27732, stack(0x00000025f0300000,0x00000025f0400000)] + 0x000001903eca9850 JavaThread "Timer-15" [_thread_blocked, id=13100, stack(0x00000025f0400000,0x00000025f0500000)] + 0x000001903ecaa1f0 JavaThread "Timer-16" [_thread_blocked, id=6544, stack(0x00000025f0500000,0x00000025f0600000)] + 0x000001903eca9d20 JavaThread "Timer-17" [_thread_blocked, id=3712, stack(0x00000025f0600000,0x00000025f0700000)] +=>0x000001903ecaab90 JavaThread "Timer-18" [_thread_in_native, id=27320, stack(0x00000025f0700000,0x00000025f0800000)] + 0x000001903ecaba00 JavaThread "Timer-19" [_thread_blocked, id=14104, stack(0x00000025f0800000,0x00000025f0900000)] + 0x000001903ecab530 JavaThread "Timer-20" [_thread_blocked, id=27280, stack(0x00000025f0900000,0x00000025f0a00000)] + 0x0000019034b789b0 JavaThread "Timer-21" [_thread_in_native, id=22412, stack(0x00000025f0a00000,0x00000025f0b00000)] + 0x0000019034b73310 JavaThread "Timer-22" [_thread_in_native, id=26660, stack(0x00000025f0b00000,0x00000025f0c00000)] + 0x0000019034b79350 JavaThread "Timer-23" [_thread_blocked, id=19920, stack(0x00000025f0c00000,0x00000025f0d00000)] + 0x0000019034b75e60 JavaThread "Timer-24" [_thread_blocked, id=4908, stack(0x00000025f0d00000,0x00000025f0e00000)] + 0x0000019034b7ab60 JavaThread "Timer-25" [_thread_blocked, id=3612, stack(0x00000025f0e00000,0x00000025f0f00000)] + 0x0000019034b74180 JavaThread "Timer-26" [_thread_blocked, id=28132, stack(0x00000025f0f00000,0x00000025f1000000)] + 0x0000019034b74b20 JavaThread "Timer-27" [_thread_blocked, id=27716, stack(0x00000025f1000000,0x00000025f1100000)] + 0x0000019034b77670 JavaThread "Timer-28" [_thread_in_native, id=12696, stack(0x00000025f1100000,0x00000025f1200000)] + 0x0000019034b77b40 JavaThread "Timer-29" [_thread_blocked, id=27644, stack(0x00000025f1200000,0x00000025f1300000)] + 0x0000019034b76800 JavaThread "Timer-30" [_thread_blocked, id=15536, stack(0x00000025f1300000,0x00000025f1400000)] + +Other Threads: + 0x0000019031612190 VMThread "VM Thread" [stack: 0x00000025ed600000,0x00000025ed700000] [id=5756] + 0x0000019032102690 WatcherThread [stack: 0x00000025ee100000,0x00000025ee200000] [id=24208] + 0x000001900eacb980 GCTaskThread "GC Thread#0" [stack: 0x00000025ed100000,0x00000025ed200000] [id=25836] + 0x00000190347db4e0 GCTaskThread "GC Thread#1" [stack: 0x00000025eed00000,0x00000025eee00000] [id=21776] + 0x00000190346c9920 GCTaskThread "GC Thread#2" [stack: 0x00000025eee00000,0x00000025eef00000] [id=5344] + 0x0000019034775090 GCTaskThread "GC Thread#3" [stack: 0x00000025eef00000,0x00000025ef000000] [id=596] + 0x000001903483a760 GCTaskThread "GC Thread#4" [stack: 0x00000025ef000000,0x00000025ef100000] [id=23180] + 0x000001903483aa10 GCTaskThread "GC Thread#5" [stack: 0x00000025ef100000,0x00000025ef200000] [id=25960] + 0x000001903474dbc0 GCTaskThread "GC Thread#6" [stack: 0x00000025ef200000,0x00000025ef300000] [id=13272] + 0x00000190347c1cc0 GCTaskThread "GC Thread#7" [stack: 0x00000025ef300000,0x00000025ef400000] [id=23640] + 0x000001900eade530 ConcurrentGCThread "G1 Main Marker" [stack: 0x00000025ed200000,0x00000025ed300000] [id=18484] + 0x000001900eadef40 ConcurrentGCThread "G1 Conc#0" [stack: 0x00000025ed300000,0x00000025ed400000] [id=15068] + 0x000001900eb357d0 ConcurrentGCThread "G1 Refine#0" [stack: 0x00000025ed400000,0x00000025ed500000] [id=11724] + 0x00000190314d2320 ConcurrentGCThread "G1 Service" [stack: 0x00000025ed500000,0x00000025ed600000] [id=7312] + +Threads with active compile tasks: + +VM state: not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap address: 0x0000000703a00000, size: 4038 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 + +CDS archive(s) mapped at: [0x0000000800000000-0x0000000800bc0000-0x0000000800bc0000), size 12320768, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0. +Compressed class space mapped at: 0x0000000800c00000-0x0000000840c00000, reserved size: 1073741824 +Narrow klass base: 0x0000000800000000, Narrow klass shift: 0, Narrow klass range: 0x100000000 + +GC Precious Log: + CPUs: 8 total, 8 available + Memory: 16151M + Large Page Support: Disabled + NUMA Support: Disabled + Compressed Oops: Enabled (Zero based) + Heap Region Size: 2M + Heap Min Capacity: 8M + Heap Initial Capacity: 254M + Heap Max Capacity: 4038M + Pre-touch: Disabled + Parallel Workers: 8 + Concurrent Workers: 2 + Concurrent Refinement Workers: 8 + Periodic GC: Disabled + +Heap: + garbage-first heap total 260096K, used 117784K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 26 young (53248K), 2 survivors (4096K) + Metaspace used 11259K, committed 11456K, reserved 1064960K + class space used 976K, committed 1088K, reserved 1048576K + +Heap Regions: E=young(eden), S=young(survivor), O=old, HS=humongous(starts), HC=humongous(continues), CS=collection set, F=free, OA=open archive, CA=closed archive, TAMS=top-at-mark-start (previous, next) +| 0|0x0000000703a00000, 0x0000000703c00000, 0x0000000703c00000|100%|HS| |TAMS 0x0000000703a00000, 0x0000000703a00000| Complete +| 1|0x0000000703c00000, 0x0000000703e00000, 0x0000000703e00000|100%|HC| |TAMS 0x0000000703c00000, 0x0000000703c00000| Complete +| 2|0x0000000703e00000, 0x0000000704000000, 0x0000000704000000|100%|HC| |TAMS 0x0000000703e00000, 0x0000000703e00000| Complete +| 3|0x0000000704000000, 0x0000000704200000, 0x0000000704200000|100%|HC| |TAMS 0x0000000704000000, 0x0000000704000000| Complete +| 4|0x0000000704200000, 0x0000000704400000, 0x0000000704400000|100%|HC| |TAMS 0x0000000704200000, 0x0000000704200000| Complete +| 5|0x0000000704400000, 0x0000000704600000, 0x0000000704600000|100%|HC| |TAMS 0x0000000704400000, 0x0000000704400000| Complete +| 6|0x0000000704600000, 0x0000000704800000, 0x0000000704800000|100%|HC| |TAMS 0x0000000704600000, 0x0000000704600000| Complete +| 7|0x0000000704800000, 0x0000000704a00000, 0x0000000704a00000|100%|HC| |TAMS 0x0000000704800000, 0x0000000704800000| Complete +| 8|0x0000000704a00000, 0x0000000704c00000, 0x0000000704c00000|100%|HC| |TAMS 0x0000000704a00000, 0x0000000704a00000| Complete +| 9|0x0000000704c00000, 0x0000000704e00000, 0x0000000704e00000|100%|HC| |TAMS 0x0000000704c00000, 0x0000000704c00000| Complete +| 10|0x0000000704e00000, 0x0000000705000000, 0x0000000705000000|100%|HC| |TAMS 0x0000000704e00000, 0x0000000704e00000| Complete +| 11|0x0000000705000000, 0x0000000705200000, 0x0000000705200000|100%|HC| |TAMS 0x0000000705000000, 0x0000000705000000| Complete +| 12|0x0000000705200000, 0x0000000705400000, 0x0000000705400000|100%|HC| |TAMS 0x0000000705200000, 0x0000000705200000| Complete +| 13|0x0000000705400000, 0x0000000705600000, 0x0000000705600000|100%|HC| |TAMS 0x0000000705400000, 0x0000000705400000| Complete +| 14|0x0000000705600000, 0x0000000705800000, 0x0000000705800000|100%|HC| |TAMS 0x0000000705600000, 0x0000000705600000| Complete +| 15|0x0000000705800000, 0x0000000705a00000, 0x0000000705a00000|100%|HC| |TAMS 0x0000000705800000, 0x0000000705800000| Complete +| 16|0x0000000705a00000, 0x0000000705c00000, 0x0000000705c00000|100%|HC| |TAMS 0x0000000705a00000, 0x0000000705a00000| Complete +| 17|0x0000000705c00000, 0x0000000705e00000, 0x0000000705e00000|100%|HC| |TAMS 0x0000000705c00000, 0x0000000705c00000| Complete +| 18|0x0000000705e00000, 0x0000000706000000, 0x0000000706000000|100%|HC| |TAMS 0x0000000705e00000, 0x0000000705e00000| Complete +| 19|0x0000000706000000, 0x0000000706200000, 0x0000000706200000|100%|HC| |TAMS 0x0000000706000000, 0x0000000706000000| Complete +| 20|0x0000000706200000, 0x0000000706400000, 0x0000000706400000|100%|HC| |TAMS 0x0000000706200000, 0x0000000706200000| Complete +| 21|0x0000000706400000, 0x0000000706600000, 0x0000000706600000|100%|HC| |TAMS 0x0000000706400000, 0x0000000706400000| Complete +| 22|0x0000000706600000, 0x0000000706800000, 0x0000000706800000|100%|HC| |TAMS 0x0000000706600000, 0x0000000706600000| Complete +| 23|0x0000000706800000, 0x0000000706a00000, 0x0000000706a00000|100%|HC| |TAMS 0x0000000706800000, 0x0000000706800000| Complete +| 24|0x0000000706a00000, 0x0000000706c00000, 0x0000000706c00000|100%|HC| |TAMS 0x0000000706a00000, 0x0000000706a00000| Complete +| 25|0x0000000706c00000, 0x0000000706e00000, 0x0000000706e00000|100%|HC| |TAMS 0x0000000706c00000, 0x0000000706c00000| Complete +| 26|0x0000000706e00000, 0x0000000707000000, 0x0000000707000000|100%|HC| |TAMS 0x0000000706e00000, 0x0000000706e00000| Complete +| 27|0x0000000707000000, 0x0000000707200000, 0x0000000707200000|100%|HC| |TAMS 0x0000000707000000, 0x0000000707000000| Complete +| 28|0x0000000707200000, 0x0000000707400000, 0x0000000707400000|100%|HC| |TAMS 0x0000000707200000, 0x0000000707200000| Complete +| 29|0x0000000707400000, 0x0000000707600000, 0x0000000707600000|100%|HC| |TAMS 0x0000000707400000, 0x0000000707400000| Complete +| 30|0x0000000707600000, 0x0000000707800000, 0x0000000707800000|100%|HS| |TAMS 0x0000000707600000, 0x0000000707600000| Complete +| 31|0x0000000707800000, 0x0000000707800000, 0x0000000707a00000| 0%| F| |TAMS 0x0000000707800000, 0x0000000707800000| Untracked +| 32|0x0000000707a00000, 0x0000000707a00000, 0x0000000707c00000| 0%| F| |TAMS 0x0000000707a00000, 0x0000000707a00000| Untracked +| 33|0x0000000707c00000, 0x0000000707c00000, 0x0000000707e00000| 0%| F| |TAMS 0x0000000707c00000, 0x0000000707c00000| Untracked +| 34|0x0000000707e00000, 0x0000000708000000, 0x0000000708000000|100%| O| |TAMS 0x0000000707e00000, 0x0000000708000000| Untracked +| 35|0x0000000708000000, 0x000000070810e200, 0x0000000708200000| 52%| O| |TAMS 0x0000000708000000, 0x000000070810e200| Untracked +| 36|0x0000000708200000, 0x0000000708200000, 0x0000000708400000| 0%| F| |TAMS 0x0000000708200000, 0x0000000708200000| Untracked +| 37|0x0000000708400000, 0x0000000708400000, 0x0000000708600000| 0%| F| |TAMS 0x0000000708400000, 0x0000000708400000| Untracked +| 38|0x0000000708600000, 0x0000000708600000, 0x0000000708800000| 0%| F| |TAMS 0x0000000708600000, 0x0000000708600000| Untracked +| 39|0x0000000708800000, 0x0000000708800000, 0x0000000708a00000| 0%| F| |TAMS 0x0000000708800000, 0x0000000708800000| Untracked +| 40|0x0000000708a00000, 0x0000000708a00000, 0x0000000708c00000| 0%| F| |TAMS 0x0000000708a00000, 0x0000000708a00000| Untracked +| 41|0x0000000708c00000, 0x0000000708c00000, 0x0000000708e00000| 0%| F| |TAMS 0x0000000708c00000, 0x0000000708c00000| Untracked +| 42|0x0000000708e00000, 0x0000000708e00000, 0x0000000709000000| 0%| F| |TAMS 0x0000000708e00000, 0x0000000708e00000| Untracked +| 43|0x0000000709000000, 0x0000000709000000, 0x0000000709200000| 0%| F| |TAMS 0x0000000709000000, 0x0000000709000000| Untracked +| 44|0x0000000709200000, 0x0000000709200000, 0x0000000709400000| 0%| F| |TAMS 0x0000000709200000, 0x0000000709200000| Untracked +| 45|0x0000000709400000, 0x0000000709400000, 0x0000000709600000| 0%| F| |TAMS 0x0000000709400000, 0x0000000709400000| Untracked +| 46|0x0000000709600000, 0x0000000709600000, 0x0000000709800000| 0%| F| |TAMS 0x0000000709600000, 0x0000000709600000| Untracked +| 47|0x0000000709800000, 0x0000000709800000, 0x0000000709a00000| 0%| F| |TAMS 0x0000000709800000, 0x0000000709800000| Untracked +| 48|0x0000000709a00000, 0x0000000709a00000, 0x0000000709c00000| 0%| F| |TAMS 0x0000000709a00000, 0x0000000709a00000| Untracked +| 49|0x0000000709c00000, 0x0000000709c00000, 0x0000000709e00000| 0%| F| |TAMS 0x0000000709c00000, 0x0000000709c00000| Untracked +| 50|0x0000000709e00000, 0x0000000709e00000, 0x000000070a000000| 0%| F| |TAMS 0x0000000709e00000, 0x0000000709e00000| Untracked +| 51|0x000000070a000000, 0x000000070a000000, 0x000000070a200000| 0%| F| |TAMS 0x000000070a000000, 0x000000070a000000| Untracked +| 52|0x000000070a200000, 0x000000070a200000, 0x000000070a400000| 0%| F| |TAMS 0x000000070a200000, 0x000000070a200000| Untracked +| 53|0x000000070a400000, 0x000000070a400000, 0x000000070a600000| 0%| F| |TAMS 0x000000070a400000, 0x000000070a400000| Untracked +| 54|0x000000070a600000, 0x000000070a600000, 0x000000070a800000| 0%| F| |TAMS 0x000000070a600000, 0x000000070a600000| Untracked +| 55|0x000000070a800000, 0x000000070a800000, 0x000000070aa00000| 0%| F| |TAMS 0x000000070a800000, 0x000000070a800000| Untracked +| 56|0x000000070aa00000, 0x000000070aa00000, 0x000000070ac00000| 0%| F| |TAMS 0x000000070aa00000, 0x000000070aa00000| Untracked +| 57|0x000000070ac00000, 0x000000070ac00000, 0x000000070ae00000| 0%| F| |TAMS 0x000000070ac00000, 0x000000070ac00000| Untracked +| 58|0x000000070ae00000, 0x000000070ae00000, 0x000000070b000000| 0%| F| |TAMS 0x000000070ae00000, 0x000000070ae00000| Untracked +| 59|0x000000070b000000, 0x000000070b000000, 0x000000070b200000| 0%| F| |TAMS 0x000000070b000000, 0x000000070b000000| Untracked +| 60|0x000000070b200000, 0x000000070b200000, 0x000000070b400000| 0%| F| |TAMS 0x000000070b200000, 0x000000070b200000| Untracked +| 61|0x000000070b400000, 0x000000070b400000, 0x000000070b600000| 0%| F| |TAMS 0x000000070b400000, 0x000000070b400000| Untracked +| 62|0x000000070b600000, 0x000000070b600000, 0x000000070b800000| 0%| F| |TAMS 0x000000070b600000, 0x000000070b600000| Untracked +| 63|0x000000070b800000, 0x000000070b800000, 0x000000070ba00000| 0%| F| |TAMS 0x000000070b800000, 0x000000070b800000| Untracked +| 64|0x000000070ba00000, 0x000000070ba00000, 0x000000070bc00000| 0%| F| |TAMS 0x000000070ba00000, 0x000000070ba00000| Untracked +| 65|0x000000070bc00000, 0x000000070bc00000, 0x000000070be00000| 0%| F| |TAMS 0x000000070bc00000, 0x000000070bc00000| Untracked +| 66|0x000000070be00000, 0x000000070be00000, 0x000000070c000000| 0%| F| |TAMS 0x000000070be00000, 0x000000070be00000| Untracked +| 67|0x000000070c000000, 0x000000070c000000, 0x000000070c200000| 0%| F| |TAMS 0x000000070c000000, 0x000000070c000000| Untracked +| 68|0x000000070c200000, 0x000000070c200000, 0x000000070c400000| 0%| F| |TAMS 0x000000070c200000, 0x000000070c200000| Untracked +| 69|0x000000070c400000, 0x000000070c400000, 0x000000070c600000| 0%| F| |TAMS 0x000000070c400000, 0x000000070c400000| Untracked +| 70|0x000000070c600000, 0x000000070c600000, 0x000000070c800000| 0%| F| |TAMS 0x000000070c600000, 0x000000070c600000| Untracked +| 71|0x000000070c800000, 0x000000070c800000, 0x000000070ca00000| 0%| F| |TAMS 0x000000070c800000, 0x000000070c800000| Untracked +| 72|0x000000070ca00000, 0x000000070ca00000, 0x000000070cc00000| 0%| F| |TAMS 0x000000070ca00000, 0x000000070ca00000| Untracked +| 73|0x000000070cc00000, 0x000000070cc00000, 0x000000070ce00000| 0%| F| |TAMS 0x000000070cc00000, 0x000000070cc00000| Untracked +| 74|0x000000070ce00000, 0x000000070ce00000, 0x000000070d000000| 0%| F| |TAMS 0x000000070ce00000, 0x000000070ce00000| Untracked +| 75|0x000000070d000000, 0x000000070d000000, 0x000000070d200000| 0%| F| |TAMS 0x000000070d000000, 0x000000070d000000| Untracked +| 76|0x000000070d200000, 0x000000070d200000, 0x000000070d400000| 0%| F| |TAMS 0x000000070d200000, 0x000000070d200000| Untracked +| 77|0x000000070d400000, 0x000000070d400000, 0x000000070d600000| 0%| F| |TAMS 0x000000070d400000, 0x000000070d400000| Untracked +| 78|0x000000070d600000, 0x000000070d600000, 0x000000070d800000| 0%| F| |TAMS 0x000000070d600000, 0x000000070d600000| Untracked +| 79|0x000000070d800000, 0x000000070d800000, 0x000000070da00000| 0%| F| |TAMS 0x000000070d800000, 0x000000070d800000| Untracked +| 80|0x000000070da00000, 0x000000070da00000, 0x000000070dc00000| 0%| F| |TAMS 0x000000070da00000, 0x000000070da00000| Untracked +| 81|0x000000070dc00000, 0x000000070dc00000, 0x000000070de00000| 0%| F| |TAMS 0x000000070dc00000, 0x000000070dc00000| Untracked +| 82|0x000000070de00000, 0x000000070de00000, 0x000000070e000000| 0%| F| |TAMS 0x000000070de00000, 0x000000070de00000| Untracked +| 83|0x000000070e000000, 0x000000070e000000, 0x000000070e200000| 0%| F| |TAMS 0x000000070e000000, 0x000000070e000000| Untracked +| 84|0x000000070e200000, 0x000000070e200000, 0x000000070e400000| 0%| F| |TAMS 0x000000070e200000, 0x000000070e200000| Untracked +| 85|0x000000070e400000, 0x000000070e400000, 0x000000070e600000| 0%| F| |TAMS 0x000000070e400000, 0x000000070e400000| Untracked +| 86|0x000000070e600000, 0x000000070e600000, 0x000000070e800000| 0%| F| |TAMS 0x000000070e600000, 0x000000070e600000| Untracked +| 87|0x000000070e800000, 0x000000070e800000, 0x000000070ea00000| 0%| F| |TAMS 0x000000070e800000, 0x000000070e800000| Untracked +| 88|0x000000070ea00000, 0x000000070ea00000, 0x000000070ec00000| 0%| F| |TAMS 0x000000070ea00000, 0x000000070ea00000| Untracked +| 89|0x000000070ec00000, 0x000000070ec00000, 0x000000070ee00000| 0%| F| |TAMS 0x000000070ec00000, 0x000000070ec00000| Untracked +| 90|0x000000070ee00000, 0x000000070ee00000, 0x000000070f000000| 0%| F| |TAMS 0x000000070ee00000, 0x000000070ee00000| Untracked +| 91|0x000000070f000000, 0x000000070f000000, 0x000000070f200000| 0%| F| |TAMS 0x000000070f000000, 0x000000070f000000| Untracked +| 92|0x000000070f200000, 0x000000070f200000, 0x000000070f400000| 0%| F| |TAMS 0x000000070f200000, 0x000000070f200000| Untracked +| 93|0x000000070f400000, 0x000000070f400000, 0x000000070f600000| 0%| F| |TAMS 0x000000070f400000, 0x000000070f400000| Untracked +| 94|0x000000070f600000, 0x000000070f600000, 0x000000070f800000| 0%| F| |TAMS 0x000000070f600000, 0x000000070f600000| Untracked +| 95|0x000000070f800000, 0x000000070f800000, 0x000000070fa00000| 0%| F| |TAMS 0x000000070f800000, 0x000000070f800000| Untracked +| 96|0x000000070fa00000, 0x000000070fa00000, 0x000000070fc00000| 0%| F| |TAMS 0x000000070fa00000, 0x000000070fa00000| Untracked +| 97|0x000000070fc00000, 0x000000070fc00000, 0x000000070fe00000| 0%| F| |TAMS 0x000000070fc00000, 0x000000070fc00000| Untracked +| 98|0x000000070fe00000, 0x000000070fe00000, 0x0000000710000000| 0%| F| |TAMS 0x000000070fe00000, 0x000000070fe00000| Untracked +| 99|0x0000000710000000, 0x0000000710000000, 0x0000000710200000| 0%| F| |TAMS 0x0000000710000000, 0x0000000710000000| Untracked +| 100|0x0000000710200000, 0x0000000710200000, 0x0000000710400000| 0%| F| |TAMS 0x0000000710200000, 0x0000000710200000| Untracked +| 101|0x0000000710400000, 0x00000007105fd180, 0x0000000710600000| 99%| E| |TAMS 0x0000000710400000, 0x0000000710400000| Complete +| 102|0x0000000710600000, 0x0000000710800000, 0x0000000710800000|100%| E|CS|TAMS 0x0000000710600000, 0x0000000710600000| Complete +| 103|0x0000000710800000, 0x0000000710a00000, 0x0000000710a00000|100%| E|CS|TAMS 0x0000000710800000, 0x0000000710800000| Complete +| 104|0x0000000710a00000, 0x0000000710c00000, 0x0000000710c00000|100%| E|CS|TAMS 0x0000000710a00000, 0x0000000710a00000| Complete +| 105|0x0000000710c00000, 0x0000000710e00000, 0x0000000710e00000|100%| E|CS|TAMS 0x0000000710c00000, 0x0000000710c00000| Complete +| 106|0x0000000710e00000, 0x0000000711000000, 0x0000000711000000|100%| E|CS|TAMS 0x0000000710e00000, 0x0000000710e00000| Complete +| 107|0x0000000711000000, 0x0000000711200000, 0x0000000711200000|100%| E|CS|TAMS 0x0000000711000000, 0x0000000711000000| Complete +| 108|0x0000000711200000, 0x0000000711400000, 0x0000000711400000|100%| E|CS|TAMS 0x0000000711200000, 0x0000000711200000| Complete +| 109|0x0000000711400000, 0x0000000711600000, 0x0000000711600000|100%| E|CS|TAMS 0x0000000711400000, 0x0000000711400000| Complete +| 110|0x0000000711600000, 0x0000000711800000, 0x0000000711800000|100%| E|CS|TAMS 0x0000000711600000, 0x0000000711600000| Complete +| 111|0x0000000711800000, 0x0000000711a00000, 0x0000000711a00000|100%| E|CS|TAMS 0x0000000711800000, 0x0000000711800000| Complete +| 112|0x0000000711a00000, 0x0000000711c00000, 0x0000000711c00000|100%| E|CS|TAMS 0x0000000711a00000, 0x0000000711a00000| Complete +| 113|0x0000000711c00000, 0x0000000711e00000, 0x0000000711e00000|100%| E|CS|TAMS 0x0000000711c00000, 0x0000000711c00000| Complete +| 114|0x0000000711e00000, 0x0000000712000000, 0x0000000712000000|100%| E|CS|TAMS 0x0000000711e00000, 0x0000000711e00000| Complete +| 115|0x0000000712000000, 0x0000000712200000, 0x0000000712200000|100%| E|CS|TAMS 0x0000000712000000, 0x0000000712000000| Complete +| 116|0x0000000712200000, 0x0000000712400000, 0x0000000712400000|100%| E|CS|TAMS 0x0000000712200000, 0x0000000712200000| Complete +| 117|0x0000000712400000, 0x0000000712600000, 0x0000000712600000|100%| E|CS|TAMS 0x0000000712400000, 0x0000000712400000| Complete +| 118|0x0000000712600000, 0x0000000712800000, 0x0000000712800000|100%| E|CS|TAMS 0x0000000712600000, 0x0000000712600000| Complete +| 119|0x0000000712800000, 0x0000000712a00000, 0x0000000712a00000|100%| E|CS|TAMS 0x0000000712800000, 0x0000000712800000| Complete +| 120|0x0000000712a00000, 0x0000000712c00000, 0x0000000712c00000|100%| E|CS|TAMS 0x0000000712a00000, 0x0000000712a00000| Complete +| 121|0x0000000712c00000, 0x0000000712e00000, 0x0000000712e00000|100%| E|CS|TAMS 0x0000000712c00000, 0x0000000712c00000| Complete +| 122|0x0000000712e00000, 0x0000000712ff8070, 0x0000000713000000| 98%| S|CS|TAMS 0x0000000712e00000, 0x0000000712e00000| Complete +| 123|0x0000000713000000, 0x0000000713200000, 0x0000000713200000|100%| S|CS|TAMS 0x0000000713000000, 0x0000000713000000| Complete +| 124|0x0000000713200000, 0x0000000713400000, 0x0000000713400000|100%| E|CS|TAMS 0x0000000713200000, 0x0000000713200000| Complete +| 125|0x0000000713400000, 0x0000000713600000, 0x0000000713600000|100%| E|CS|TAMS 0x0000000713400000, 0x0000000713400000| Complete +| 126|0x0000000713600000, 0x0000000713800000, 0x0000000713800000|100%| E|CS|TAMS 0x0000000713600000, 0x0000000713600000| Complete + +Card table byte_map: [0x0000019025dd0000,0x00000190265c0000] _byte_map_base: 0x00000190225b3000 + +Marking Bits (Prev, Next): (CMBitMap*) 0x000001900eacdfb0, (CMBitMap*) 0x000001900eacdff0 + Prev Bits: [0x0000019026db0000, 0x000001902acc8000) + Next Bits: [0x000001902acd0000, 0x000001902ebe8000) + +Polling page: 0x000001900c920000 + +Metaspace: + +Usage: + Non-class: 10.04 MB used. + Class: 976.73 KB used. + Both: 11.00 MB used. + +Virtual space: + Non-class space: 16.00 MB reserved, 10.12 MB ( 63%) committed, 2 nodes. + Class space: 1.00 GB reserved, 1.06 MB ( <1%) committed, 1 nodes. + Both: 1.02 GB reserved, 11.19 MB ( 1%) committed. + +Chunk freelists: + Non-Class: 912.00 KB + Class: 2.98 MB + Both: 3.88 MB + +MaxMetaspaceSize: unlimited +CompressedClassSpaceSize: 1.00 GB +Initial GC threshold: 21.00 MB +Current GC threshold: 21.00 MB +CDS: on +MetaspaceReclaimPolicy: balanced + - commit_granule_bytes: 65536. + - commit_granule_words: 8192. + - virtual_space_node_default_size: 1048576. + - enlarge_chunks_in_place: 1. + - new_chunks_are_fully_committed: 0. + - uncommit_free_chunks: 1. + - use_allocation_guard: 0. + - handle_deallocations: 1. + + +Internal statistics: + +num_allocs_failed_limit: 0. +num_arena_births: 164. +num_arena_deaths: 0. +num_vsnodes_births: 3. +num_vsnodes_deaths: 0. +num_space_committed: 177. +num_space_uncommitted: 0. +num_chunks_returned_to_freelist: 0. +num_chunks_taken_from_freelist: 523. +num_chunk_merges: 0. +num_chunk_splits: 348. +num_chunks_enlarged: 262. +num_purges: 0. +num_inconsistent_stats: 0. + +CodeHeap 'non-profiled nmethods': size=120000Kb used=2435Kb max_used=2435Kb free=117564Kb + bounds [0x000001901dd80000, 0x000001901dff0000, 0x00000190252b0000] +CodeHeap 'profiled nmethods': size=120000Kb used=6917Kb max_used=6917Kb free=113082Kb + bounds [0x0000019016850000, 0x0000019016f20000, 0x000001901dd80000] +CodeHeap 'non-nmethods': size=5760Kb used=1670Kb max_used=1709Kb free=4089Kb + bounds [0x00000190162b0000, 0x0000019016520000, 0x0000019016850000] + total_blobs=4490 nmethods=3393 adapters=1009 + compilation: enabled + stopped_count=0, restarted_count=0 + full_count=0 + +Compilation events (20 events): +Event: 72.647 Thread 0x0000019031633f60 3389 3 com.csse3200.game.components.tasks.human.HumanMovementTask::update (47 bytes) +Event: 72.648 Thread 0x0000019031633f60 nmethod 3389 0x0000019016f0cc90 code [0x0000019016f0cf40, 0x0000019016f0ddd8] +Event: 72.648 Thread 0x0000019031633f60 3390 3 com.csse3200.game.components.tasks.human.HumanMovementTask::isAtTarget (31 bytes) +Event: 72.648 Thread 0x0000019031633f60 nmethod 3390 0x0000019016f0e390 code [0x0000019016f0e580, 0x0000019016f0eae8] +Event: 72.680 Thread 0x0000019031633f60 3391 3 com.csse3200.game.components.tasks.human.HumanMovementTask::didMove (29 bytes) +Event: 72.681 Thread 0x0000019031633f60 nmethod 3391 0x0000019016f0ed10 code [0x0000019016f0ef20, 0x0000019016f0f468] +Event: 72.748 Thread 0x000001903162ffc0 3392 4 com.badlogic.gdx.math.Vector2:: (5 bytes) +Event: 72.748 Thread 0x000001903162ffc0 nmethod 3392 0x000001901dfe0290 code [0x000001901dfe0400, 0x000001901dfe0478] +Event: 73.113 Thread 0x000001903162ffc0 3393 4 com.csse3200.game.components.TouchAttackComponent$$Lambda$81/0x0000000800ce94f8::handle (16 bytes) +Event: 73.115 Thread 0x000001903162ffc0 nmethod 3393 0x000001901dfe0590 code [0x000001901dfe0740, 0x000001901dfe09e8] +Event: 77.680 Thread 0x0000019031633f60 3394 3 com.csse3200.game.physics.components.HitboxComponent:: (5 bytes) +Event: 77.682 Thread 0x0000019031633f60 nmethod 3394 0x0000019016f0f690 code [0x0000019016f0f840, 0x0000019016f0fb88] +Event: 77.682 Thread 0x0000019031633f60 3395 3 com.csse3200.game.entities.Entity::setScale (18 bytes) +Event: 77.682 Thread 0x0000019031633f60 nmethod 3395 0x0000019016f0fd10 code [0x0000019016f0fea0, 0x0000019016f0ffd8] +Event: 77.682 Thread 0x0000019031633f60 3396 3 com.csse3200.game.physics.components.HitboxComponent::create (11 bytes) +Event: 77.683 Thread 0x0000019031633f60 nmethod 3396 0x0000019016f10090 code [0x0000019016f10260, 0x0000019016f105b8] +Event: 77.683 Thread 0x0000019031633f60 3397 3 com.csse3200.game.rendering.AnimationRenderComponent:: (29 bytes) +Event: 77.683 Thread 0x0000019031633f60 nmethod 3397 0x0000019016f10710 code [0x0000019016f10900, 0x0000019016f10de8] +Event: 77.689 Thread 0x0000019031633f60 3398 3 com.badlogic.gdx.utils.LongMap::putResize (52 bytes) +Event: 77.689 Thread 0x0000019031633f60 nmethod 3398 0x0000019016f10f90 code [0x0000019016f11160, 0x0000019016f11588] + +GC Heap History (8 events): +Event: 1.691 GC heap before +{Heap before GC invocations=0 (full 0): + garbage-first heap total 260096K, used 26624K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 11 young (22528K), 0 survivors (0K) + Metaspace used 6734K, committed 6976K, reserved 1064960K + class space used 537K, committed 640K, reserved 1048576K +} +Event: 1.694 GC heap after +{Heap after GC invocations=1 (full 0): + garbage-first heap total 260096K, used 3654K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 2 young (4096K), 2 survivors (4096K) + Metaspace used 6734K, committed 6976K, reserved 1064960K + class space used 537K, committed 640K, reserved 1048576K +} +Event: 11.822 GC heap before +{Heap before GC invocations=1 (full 0): + garbage-first heap total 260096K, used 97862K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 16 young (32768K), 2 survivors (4096K) + Metaspace used 8498K, committed 8640K, reserved 1064960K + class space used 688K, committed 768K, reserved 1048576K +} +Event: 11.825 GC heap after +{Heap after GC invocations=2 (full 0): + garbage-first heap total 260096K, used 4476K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 1 young (2048K), 1 survivors (2048K) + Metaspace used 8498K, committed 8640K, reserved 1064960K + class space used 688K, committed 768K, reserved 1048576K +} +Event: 45.927 GC heap before +{Heap before GC invocations=2 (full 0): + garbage-first heap total 260096K, used 98684K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 18 young (36864K), 1 survivors (2048K) + Metaspace used 10743K, committed 10944K, reserved 1064960K + class space used 949K, committed 1024K, reserved 1048576K +} +Event: 45.930 GC heap after +{Heap after GC invocations=3 (full 0): + garbage-first heap total 260096K, used 7506K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 3 young (6144K), 3 survivors (6144K) + Metaspace used 10743K, committed 10944K, reserved 1064960K + class space used 949K, committed 1024K, reserved 1048576K +} +Event: 49.534 GC heap before +{Heap before GC invocations=3 (full 0): + garbage-first heap total 260096K, used 79186K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 6 young (12288K), 3 survivors (6144K) + Metaspace used 10770K, committed 10944K, reserved 1064960K + class space used 949K, committed 1024K, reserved 1048576K +} +Event: 49.535 GC heap after +{Heap after GC invocations=4 (full 0): + garbage-first heap total 260096K, used 7192K [0x0000000703a00000, 0x0000000800000000) + region size 2048K, 2 young (4096K), 2 survivors (4096K) + Metaspace used 10770K, committed 10944K, reserved 1064960K + class space used 949K, committed 1024K, reserved 1048576K +} + +Deoptimization events (20 events): +Event: 65.879 Thread 0x000001900ea74670 DEOPT PACKING pc=0x0000019016ea7322 sp=0x00000025ed0ff390 +Event: 65.879 Thread 0x000001900ea74670 DEOPT UNPACKING pc=0x0000019016306763 sp=0x00000025ed0fe850 mode 0 +Event: 66.079 Thread 0x000001900ea74670 DEOPT PACKING pc=0x0000019016ea9666 sp=0x00000025ed0ff400 +Event: 66.079 Thread 0x000001900ea74670 DEOPT UNPACKING pc=0x0000019016306763 sp=0x00000025ed0fe8b8 mode 0 +Event: 67.297 Thread 0x000001900ea74670 Uncommon trap: trap_request=0xffffff45 fr.pc=0x000001901dfbc750 relative=0x00000000000000b0 +Event: 67.297 Thread 0x000001900ea74670 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000001901dfbc750 method=com.csse3200.game.components.tasks.scanner.ScannerTask.update()V @ 52 c2 +Event: 67.297 Thread 0x000001900ea74670 DEOPT PACKING pc=0x000001901dfbc750 sp=0x00000025ed0ff3b0 +Event: 67.297 Thread 0x000001900ea74670 DEOPT UNPACKING pc=0x0000019016305c23 sp=0x00000025ed0ff360 mode 2 +Event: 67.813 Thread 0x000001900ea74670 Uncommon trap: trap_request=0xffffff45 fr.pc=0x000001901df95d78 relative=0x0000000000000758 +Event: 67.813 Thread 0x000001900ea74670 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000001901df95d78 method=com.csse3200.game.components.tasks.TrajectTask.update()V @ 28 c2 +Event: 67.813 Thread 0x000001900ea74670 DEOPT PACKING pc=0x000001901df95d78 sp=0x00000025ed0ff3a0 +Event: 67.813 Thread 0x000001900ea74670 DEOPT UNPACKING pc=0x0000019016305c23 sp=0x00000025ed0ff360 mode 2 +Event: 77.679 Thread 0x0000019034b7ab60 Uncommon trap: trap_request=0xffffffde fr.pc=0x000001901dfdc80c relative=0x0000000000001c6c +Event: 77.681 Thread 0x0000019034b7ab60 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000001901dfdc80c method=com.csse3200.game.components.TouchAttackComponent.onCollisionStart(Lcom/badlogic/gdx/physics/box2d/Fixture;Lcom/badlogic/gdx/physics/box2d/Fixture;)V @ 81 c2 +Event: 77.681 Thread 0x0000019034b7ab60 DEOPT PACKING pc=0x000001901dfdc80c sp=0x00000025f0eff030 +Event: 77.681 Thread 0x0000019034b7ab60 DEOPT UNPACKING pc=0x0000019016305c23 sp=0x00000025f0eff008 mode 2 +Event: 77.689 Thread 0x000001900ea74670 Uncommon trap: trap_request=0xfffffff6 fr.pc=0x000001901df8b088 relative=0x0000000000000308 +Event: 77.689 Thread 0x000001900ea74670 Uncommon trap: reason=null_check action=maybe_recompile pc=0x000001901df8b088 method=com.csse3200.game.physics.components.PhysicsMovementComponent.update()V @ 39 c2 +Event: 77.689 Thread 0x000001900ea74670 DEOPT PACKING pc=0x000001901df8b088 sp=0x00000025ed0ff450 +Event: 77.689 Thread 0x000001900ea74670 DEOPT UNPACKING pc=0x0000019016305c23 sp=0x00000025ed0ff3f0 mode 2 + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (20 events): +Event: 0.399 Thread 0x000001900ea74670 Exception (0x0000000712cb7d38) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 0.862 Thread 0x000001900ea74670 Exception (0x0000000712d03b48) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 1.110 Thread 0x000001900ea74670 Exception (0x0000000712a25120) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 1.110 Thread 0x000001900ea74670 Exception (0x0000000712a254b0) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 1.112 Thread 0x000001900ea74670 Exception (0x0000000712a2f810) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 1.112 Thread 0x000001900ea74670 Exception (0x0000000712a2fae0) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 1.237 Thread 0x000001900ea74670 Exception (0x0000000712944470) +thrown [t:\workspace\open\src\hotspot\share\classfile\systemDictionary.cpp, line 256] +Event: 1.251 Thread 0x000001900ea74670 Exception (0x00000007129c5b00) +thrown [t:\workspace\open\src\hotspot\share\prims\jni.cpp, line 516] +Event: 1.280 Thread 0x000001900ea74670 Exception (0x000000071260ccb0) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 1.282 Thread 0x000001900ea74670 Exception (0x00000007126170d0) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 4.411 Thread 0x000001900ea74670 Implicit null exception at 0x000001901ddf372c to 0x000001901ddf39a8 +Event: 7.925 Thread 0x000001900ea74670 Exception (0x00000007122c5ce0) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 15.795 Thread 0x000001900ea74670 Exception (0x0000000711cd1b10) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 15.796 Thread 0x000001900ea74670 Exception (0x0000000711cdb298) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 15.843 Thread 0x000001900ea74670 Exception (0x0000000711d78778) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 15.874 Thread 0x000001900ea74670 Exception (0x0000000711a45390) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 35.876 Thread 0x00000190348138e0 Implicit null exception at 0x000001901de478b2 to 0x000001901de47abc +Event: 53.231 Thread 0x000001900ea74670 Exception (0x0000000711b05260) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 53.234 Thread 0x000001900ea74670 Exception (0x0000000711b105e8) +thrown [t:\workspace\open\src\hotspot\share\interpreter\linkResolver.cpp, line 766] +Event: 77.689 Thread 0x000001900ea74670 Implicit null exception at 0x000001901df8addc to 0x000001901df8b07c + +VM Operations (20 events): +Event: 63.543 Executing VM operation: Cleanup +Event: 63.543 Executing VM operation: Cleanup done +Event: 64.543 Executing VM operation: Cleanup +Event: 64.544 Executing VM operation: Cleanup done +Event: 65.544 Executing VM operation: Cleanup +Event: 65.544 Executing VM operation: Cleanup done +Event: 66.545 Executing VM operation: Cleanup +Event: 66.545 Executing VM operation: Cleanup done +Event: 67.545 Executing VM operation: Cleanup +Event: 67.546 Executing VM operation: Cleanup done +Event: 68.546 Executing VM operation: Cleanup +Event: 68.546 Executing VM operation: Cleanup done +Event: 69.547 Executing VM operation: Cleanup +Event: 69.547 Executing VM operation: Cleanup done +Event: 70.547 Executing VM operation: Cleanup +Event: 70.547 Executing VM operation: Cleanup done +Event: 71.547 Executing VM operation: Cleanup +Event: 71.548 Executing VM operation: Cleanup done +Event: 72.548 Executing VM operation: Cleanup +Event: 72.548 Executing VM operation: Cleanup done + +Events (20 events): +Event: 65.714 Thread 0x000001903eca8510 Thread added: 0x000001903eca8510 +Event: 66.047 Thread 0x000001903eca9380 Thread added: 0x000001903eca9380 +Event: 66.430 Thread 0x000001903eca89e0 Thread added: 0x000001903eca89e0 +Event: 66.481 Thread 0x000001903eca8eb0 Thread added: 0x000001903eca8eb0 +Event: 66.697 Thread 0x000001903eca9850 Thread added: 0x000001903eca9850 +Event: 67.280 Thread 0x000001903ecaa1f0 Thread added: 0x000001903ecaa1f0 +Event: 67.397 Thread 0x000001903eca9d20 Thread added: 0x000001903eca9d20 +Event: 68.064 Thread 0x000001903ecaab90 Thread added: 0x000001903ecaab90 +Event: 68.147 Thread 0x000001903ecaba00 Thread added: 0x000001903ecaba00 +Event: 68.730 Thread 0x000001903ecab530 Thread added: 0x000001903ecab530 +Event: 68.847 Thread 0x0000019034b789b0 Thread added: 0x0000019034b789b0 +Event: 69.397 Thread 0x0000019034b73310 Thread added: 0x0000019034b73310 +Event: 69.763 Thread 0x0000019034b79350 Thread added: 0x0000019034b79350 +Event: 70.080 Thread 0x0000019034b75e60 Thread added: 0x0000019034b75e60 +Event: 70.514 Thread 0x0000019034b7ab60 Thread added: 0x0000019034b7ab60 +Event: 70.747 Thread 0x0000019034b74180 Thread added: 0x0000019034b74180 +Event: 71.365 Thread 0x0000019034b74b20 Thread added: 0x0000019034b74b20 +Event: 71.431 Thread 0x0000019034b77670 Thread added: 0x0000019034b77670 +Event: 72.097 Thread 0x0000019034b77b40 Thread added: 0x0000019034b77b40 +Event: 72.730 Thread 0x0000019034b76800 Thread added: 0x0000019034b76800 + + +Dynamic libraries: +0x00007ff643d90000 - 0x00007ff643d9e000 C:\Program Files\Java\jdk-17.0.2\bin\java.exe +0x00007ff8ac170000 - 0x00007ff8ac368000 C:\WINDOWS\SYSTEM32\ntdll.dll +0x00007ff8aa810000 - 0x00007ff8aa8cd000 C:\WINDOWS\System32\KERNEL32.DLL +0x00007ff8a9ed0000 - 0x00007ff8aa1c6000 C:\WINDOWS\System32\KERNELBASE.dll +0x00007ff8a98f0000 - 0x00007ff8a99f0000 C:\WINDOWS\System32\ucrtbase.dll +0x00007ff8871c0000 - 0x00007ff8871d8000 C:\Program Files\Java\jdk-17.0.2\bin\jli.dll +0x00007ff871500000 - 0x00007ff87151a000 C:\Program Files\Java\jdk-17.0.2\bin\VCRUNTIME140.dll +0x00007ff8abcd0000 - 0x00007ff8abe6e000 C:\WINDOWS\System32\USER32.dll +0x00007ff8a99f0000 - 0x00007ff8a9a12000 C:\WINDOWS\System32\win32u.dll +0x00007ff8ab350000 - 0x00007ff8ab37c000 C:\WINDOWS\System32\GDI32.dll +0x00007ff893940000 - 0x00007ff893bda000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e\COMCTL32.dll +0x00007ff8a9a50000 - 0x00007ff8a9b6a000 C:\WINDOWS\System32\gdi32full.dll +0x00007ff8a9850000 - 0x00007ff8a98ed000 C:\WINDOWS\System32\msvcp_win.dll +0x00007ff8abb80000 - 0x00007ff8abc1e000 C:\WINDOWS\System32\msvcrt.dll +0x00007ff8ab380000 - 0x00007ff8ab3b0000 C:\WINDOWS\System32\IMM32.DLL +0x00007ff89e8b0000 - 0x00007ff89e8bc000 C:\Program Files\Java\jdk-17.0.2\bin\vcruntime140_1.dll +0x00007ff857c70000 - 0x00007ff857cfd000 C:\Program Files\Java\jdk-17.0.2\bin\msvcp140.dll +0x00007fffeff40000 - 0x00007ffff0b01000 C:\Program Files\Java\jdk-17.0.2\bin\server\jvm.dll +0x00007ff8aaaf0000 - 0x00007ff8aab9e000 C:\WINDOWS\System32\ADVAPI32.dll +0x00007ff8abc20000 - 0x00007ff8abcbc000 C:\WINDOWS\System32\sechost.dll +0x00007ff8ab150000 - 0x00007ff8ab276000 C:\WINDOWS\System32\RPCRT4.dll +0x00007ff8ab090000 - 0x00007ff8ab098000 C:\WINDOWS\System32\PSAPI.DLL +0x00007ff8a7e10000 - 0x00007ff8a7e37000 C:\WINDOWS\SYSTEM32\WINMM.dll +0x00007ff8887b0000 - 0x00007ff8887b9000 C:\WINDOWS\SYSTEM32\WSOCK32.dll +0x00007ff8ab2e0000 - 0x00007ff8ab34b000 C:\WINDOWS\System32\WS2_32.dll +0x00007ff8a3a80000 - 0x00007ff8a3a8a000 C:\WINDOWS\SYSTEM32\VERSION.dll +0x00007ff8a8070000 - 0x00007ff8a8082000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll +0x00007ff8917d0000 - 0x00007ff8917da000 C:\Program Files\Java\jdk-17.0.2\bin\jimage.dll +0x00007ff8a7c20000 - 0x00007ff8a7e04000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL +0x00007ff8a7bd0000 - 0x00007ff8a7c04000 C:\WINDOWS\SYSTEM32\dbgcore.DLL +0x00007ff8a9d90000 - 0x00007ff8a9e12000 C:\WINDOWS\System32\bcryptPrimitives.dll +0x00007ff857c40000 - 0x00007ff857c65000 C:\Program Files\Java\jdk-17.0.2\bin\java.dll +0x00007ff857410000 - 0x00007ff8574e6000 C:\Program Files\Java\jdk-17.0.2\bin\jsvml.dll +0x00007ff8ab3b0000 - 0x00007ff8abaf5000 C:\WINDOWS\System32\SHELL32.dll +0x00007ff8a7430000 - 0x00007ff8a7bcb000 C:\WINDOWS\SYSTEM32\windows.storage.dll +0x00007ff8aa1d0000 - 0x00007ff8aa524000 C:\WINDOWS\System32\combase.dll +0x00007ff8a9290000 - 0x00007ff8a92be000 C:\WINDOWS\SYSTEM32\Wldp.dll +0x00007ff8ab0a0000 - 0x00007ff8ab14d000 C:\WINDOWS\System32\SHCORE.dll +0x00007ff8ab030000 - 0x00007ff8ab085000 C:\WINDOWS\System32\shlwapi.dll +0x00007ff8a9780000 - 0x00007ff8a97a5000 C:\WINDOWS\SYSTEM32\profapi.dll +0x00007ff85a070000 - 0x00007ff85a089000 C:\Program Files\Java\jdk-17.0.2\bin\net.dll +0x00007ff89dd80000 - 0x00007ff89de8a000 C:\WINDOWS\SYSTEM32\WINHTTP.dll +0x00007ff8a8ff0000 - 0x00007ff8a905a000 C:\WINDOWS\system32\mswsock.dll +0x00007ff859eb0000 - 0x00007ff859ec6000 C:\Program Files\Java\jdk-17.0.2\bin\nio.dll +0x00007ff867860000 - 0x00007ff867878000 C:\Program Files\Java\jdk-17.0.2\bin\zip.dll +0x00007ff8871a0000 - 0x00007ff8871b0000 C:\Program Files\Java\jdk-17.0.2\bin\verify.dll +0x0000000062910000 - 0x0000000062939000 C:\Users\Joey\AppData\Local\Temp\libgdxJoey\e787ab0a\gdx64.dll +0x00007ff8581f0000 - 0x00007ff858265000 C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7\lwjgl.dll +0x00007ff82eac0000 - 0x00007ff82ed19000 C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7\jemalloc.dll +0x00007ff857f50000 - 0x00007ff857fb1000 C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7\glfw.dll +0x00007ff8585e0000 - 0x00007ff858625000 C:\WINDOWS\SYSTEM32\dinput8.dll +0x00007ff894d10000 - 0x00007ff894d21000 C:\WINDOWS\SYSTEM32\xinput1_4.dll +0x00007ff8a9b70000 - 0x00007ff8a9bbe000 C:\WINDOWS\System32\cfgmgr32.dll +0x00007ff8a9440000 - 0x00007ff8a9473000 C:\WINDOWS\SYSTEM32\DEVOBJ.dll +0x00007ff8a6ea0000 - 0x00007ff8a6ecf000 C:\WINDOWS\SYSTEM32\dwmapi.dll +0x00007ff895130000 - 0x00007ff895282000 C:\WINDOWS\SYSTEM32\inputhost.dll +0x00007ff8aa530000 - 0x00007ff8aa5fd000 C:\WINDOWS\System32\OLEAUT32.dll +0x00007ff8a4eb0000 - 0x00007ff8a5005000 C:\WINDOWS\SYSTEM32\wintypes.dll +0x00007ff8a4d20000 - 0x00007ff8a4e16000 C:\WINDOWS\SYSTEM32\PROPSYS.dll +0x00007ff8a6700000 - 0x00007ff8a67f2000 C:\WINDOWS\SYSTEM32\CoreMessaging.dll +0x00007ff8a63a0000 - 0x00007ff8a66fe000 C:\WINDOWS\SYSTEM32\CoreUIComponents.dll +0x00007ff8a89b0000 - 0x00007ff8a89e3000 C:\WINDOWS\SYSTEM32\ntmarta.dll +0x00007ff8a6bd0000 - 0x00007ff8a6c6e000 C:\WINDOWS\system32\uxtheme.dll +0x00007ff8abe70000 - 0x00007ff8abf84000 C:\WINDOWS\System32\MSCTF.dll +0x00007ff83aef0000 - 0x00007ff83b087000 C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7\OpenAL.dll +0x00007ff8aa6e0000 - 0x00007ff8aa80a000 C:\WINDOWS\System32\ole32.dll +0x00007ff8abf90000 - 0x00007ff8ac039000 C:\WINDOWS\System32\clbcatq.dll +0x00007ff8a2180000 - 0x00007ff8a2205000 C:\WINDOWS\System32\MMDevApi.dll +0x00007ff8a2480000 - 0x00007ff8a2602000 C:\WINDOWS\SYSTEM32\AUDIOSES.DLL +0x00007ff8a8e00000 - 0x00007ff8a8e4b000 C:\WINDOWS\SYSTEM32\powrprof.dll +0x00007ff8a8c70000 - 0x00007ff8a8c82000 C:\WINDOWS\SYSTEM32\UMPDC.dll +0x00007ff8a6cb0000 - 0x00007ff8a6cc4000 C:\WINDOWS\SYSTEM32\resourcepolicyclient.dll +0x00007ff86fc80000 - 0x00007ff86fda5000 C:\WINDOWS\SYSTEM32\opengl32.dll +0x00007ff87e430000 - 0x00007ff87e45c000 C:\WINDOWS\SYSTEM32\GLU32.dll +0x00007ff8a14e0000 - 0x00007ff8a15e2000 C:\Windows\System32\AppXDeploymentClient.dll +0x00007fffeeed0000 - 0x00007fffeff37000 C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d8b7fef7fc5b1320\ig11icd64.dll +0x00007ff8a80e0000 - 0x00007ff8a81d3000 C:\WINDOWS\system32\dxgi.dll +0x00007ff8115e0000 - 0x00007ff8119cc000 C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d8b7fef7fc5b1320\igdml64.dll +0x00007ff89d020000 - 0x00007ff89d2e8000 C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d8b7fef7fc5b1320\igdgmm64.dll +0x00007ff8989b0000 - 0x00007ff89b577000 C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d8b7fef7fc5b1320\igc64.dll +0x00007ff856e60000 - 0x00007ff856ebd000 C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7\lwjgl_opengl.dll +0x00007ff89e2d0000 - 0x00007ff89e3ca000 C:\WINDOWS\SYSTEM32\textinputframework.dll +0x00000000628b0000 - 0x000000006290a000 C:\Users\Joey\AppData\Local\Temp\libgdxJoey\888fe1bc\gdx-box2d64.dll + +dbghelp: loaded successfully - version: 4.0.5 - missing functions: none +symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-17.0.2\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e;C:\Program Files\Java\jdk-17.0.2\bin\server;C:\Users\Joey\AppData\Local\Temp\libgdxJoey\e787ab0a;C:\Users\Joey\AppData\Local\Temp\lwjglJoey\3.3.1-build-7;C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d8b7fef7fc5b1320;C:\Users\Joey\AppData\Local\Temp\libgdxJoey\888fe1bc + +VM Arguments: +jvm_args: -XX:+ShowCodeDetailsInExceptionMessages +java_command: com.csse3200.game.desktop.DesktopLauncher +java_class_path (initial): C:\Users\Joey\OneDrive\Desktop\CSSE3200\repos\2023-studio-3\source\desktop\bin\main;\csse3200-game-core\bin\default;C:\Users\Joey\OneDrive\Desktop\CSSE3200\repos\2023-studio-3\source\core\bin\main;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-backend-lwjgl3\1.11.0\58a96db4cd349be4292d547856aa1e1c5f065f4e\gdx-backend-lwjgl3-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-platform\1.11.0\697fb13eada6d3c6ca648c9788692b0159add126\gdx-platform-1.11.0-natives-desktop.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-box2d-platform\1.11.0\62ff9baa1e57a11e0a4428a38c9660bf9f312fdc\gdx-box2d-platform-1.11.0-natives-desktop.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-tools\1.11.0\a5d30eafd0f2fbab314efdf6d98ebc27388b7c0a\gdx-tools-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx-controllers\gdx-controllers-desktop\2.2.2\625b3bdbe803e9c4af181b4791202cfcf776d805\gdx-controllers-desktop-2.2.2.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-backend-lwjgl\1.11.0\33555a2cf8b4d9db4122b2fe42e7674b343d8b4\gdx-backend-lwjgl-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-freetype\1.11.0\a3634ad2e6c56d251268d6ab5c0f66eee2841f2c\gdx-freetype-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-backend-headless\1.11.0\3c3d0c951db72891d894df1725d09179fd0bca00\gdx-backend-headless-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\net.dermetfan.libgdx-utils\libgdx-utils-box2d\0.13.4\918d79a20ea3c898cdb3611782c5b2bfa6ec575b\libgdx-utils-box2d-0.13.4.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-box2d\1.11.0\ad4facee800dd945d6d6e93dea2936bc135b5f\gdx-box2d-1.11.0.jar;C:\Users\Joey\.gradle\caches\modules-2\files-2.1\net.dermetfan.libgdx-utils\libgdx-utils\0.13.4\27 +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 4 {product} {ergonomic} + uint ConcGCThreads = 2 {product} {ergonomic} + uint G1ConcRefinementThreads = 8 {product} {ergonomic} + size_t G1HeapRegionSize = 2097152 {product} {ergonomic} + uintx GCDrainStackTargetSize = 64 {product} {ergonomic} + size_t InitialHeapSize = 266338304 {product} {ergonomic} + size_t MarkStackSize = 4194304 {product} {ergonomic} + size_t MaxHeapSize = 4234149888 {product} {ergonomic} + size_t MaxNewSize = 2539651072 {product} {ergonomic} + size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + bool ShowCodeDetailsInExceptionMessages = true {manageable} {command line} + size_t SoftMaxHeapSize = 4234149888 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {product lp64_product} {ergonomic} + bool UseCompressedOops = true {product lp64_product} {ergonomic} + bool UseG1GC = true {product} {ergonomic} + bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=C:\Program Files\Java\jdk-17.0.2 +PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk-17.0.2\bin;C:\Users\Joey\AppData\Local\Microsoft\WindowsApps;;C:\Users\Joey\AppData\Local\Programs\Microsoft VS Code\bin +USERNAME=Joey +LANG=en_US.UTF-8 +OS=Windows_NT +PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 126 Stepping 5, GenuineIntel + + + +--------------- S Y S T E M --------------- + +OS: + Windows 10 , 64 bit Build 19041 (10.0.19041.3393) +OS uptime: 2 days 5:31 hours + +CPU: total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 126 stepping 5 microcode 0xbc, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, avx512f, avx512dq, avx512cd, avx512bw, avx512vl, sha, fma, vzeroupper, avx512_vpopcntdq, avx512_vpclmulqdq, avx512_vaes, avx512_vnni, clflush, clflushopt, avx512_vbmi2, avx512_vbmi + +Memory: 4k page, system-wide physical 16151M (5498M free) +TotalPageFile size 22807M (AvailPageFile size 7442M) +current process WorkingSet (physical memory assigned to process): 508M, peak: 2470M +current process commit charge ("private bytes"): 681M, peak: 2648M + +vm_info: OpenJDK 64-Bit Server VM (17.0.2+8-86) for windows-amd64 JRE (17.0.2+8-86), built on Dec 7 2021 21:49:10 by "mach5one" with MS VC++ 16.8 / 16.9 (VS2019) + +END. diff --git a/source/core/assets/configs/Boss.json b/source/core/assets/configs/Boss.json index 8a7227370..3567235fb 100644 --- a/source/core/assets/configs/Boss.json +++ b/source/core/assets/configs/Boss.json @@ -1,5 +1,5 @@ { - "BossKing": { + "mobBoss": { "health": 100, "baseAttack": 25, "spookyFactor": 7 diff --git a/source/core/assets/images/Dusty_MoonBG.png b/source/core/assets/images/Dusty_MoonBG.png index aabbd3547..2301477d4 100644 Binary files a/source/core/assets/images/Dusty_MoonBG.png and b/source/core/assets/images/Dusty_MoonBG.png differ diff --git a/source/core/assets/images/desert_bg.png b/source/core/assets/images/desert_bg.png index 2301477d4..953e2c838 100644 Binary files a/source/core/assets/images/desert_bg.png and b/source/core/assets/images/desert_bg.png differ diff --git a/source/core/assets/images/desert_bg2.png b/source/core/assets/images/desert_bg2.png new file mode 100644 index 000000000..57597b9fd Binary files /dev/null and b/source/core/assets/images/desert_bg2.png differ diff --git a/source/core/assets/images/ice_bg.png b/source/core/assets/images/ice_bg.png index 2fae5a19e..aca79c945 100644 Binary files a/source/core/assets/images/ice_bg.png and b/source/core/assets/images/ice_bg.png differ diff --git a/source/core/assets/images/ice_bg1.png b/source/core/assets/images/ice_bg1.png new file mode 100644 index 000000000..2fae5a19e Binary files /dev/null and b/source/core/assets/images/ice_bg1.png differ diff --git a/source/core/assets/images/lava_bg.png b/source/core/assets/images/lava_bg.png index cca706805..b5b4c278e 100644 Binary files a/source/core/assets/images/lava_bg.png and b/source/core/assets/images/lava_bg.png differ diff --git a/source/core/assets/images/lava_bg1.png b/source/core/assets/images/lava_bg1.png new file mode 100644 index 000000000..cca706805 Binary files /dev/null and b/source/core/assets/images/lava_bg1.png differ diff --git a/source/core/assets/images/mobboss/demon.atlas b/source/core/assets/images/mobboss/demon.atlas new file mode 100644 index 000000000..93f1e2e6f --- /dev/null +++ b/source/core/assets/images/mobboss/demon.atlas @@ -0,0 +1,523 @@ +demon.png +size:2048,2048 +repeat:none +demon_cast_spell +index:5 +bounds:288,1760,288,160 +demon_cast_spell +index:2 +bounds:1440,1600,288,160 +demon_cast_spell +index:4 +bounds:1152,640,288,160 +demon_cast_spell +index:1 +bounds:1728,0,288,160 +demon_cleave +index:6 +bounds:0,1440,288,160 +demon_cleave +index:11 +bounds:576,1600,288,160 +demon_cleave +index:3 +bounds:1728,1760,288,160 +demon_cleave +index:8 +bounds:1152,1120,288,160 +demon_cleave +index:13 +bounds:576,640,288,160 +demon_cleave +index:5 +bounds:1440,800,288,160 +demon_cleave +index:10 +bounds:864,320,288,160 +demon_cleave +index:15 +bounds:1152,0,288,160 +demon_death +index:11 +bounds:0,1280,288,160 +demon_death +index:4 +bounds:0,1120,288,160 +demon_death +index:16 +bounds:576,1280,288,160 +demon_death +index:9 +bounds:0,800,288,160 +demon_death +index:1 +bounds:576,960,288,160 +demon_death +index:21 +bounds:864,1120,288,160 +demon_death +index:22 +bounds:864,1120,288,160 +demon_death +index:13 +bounds:1440,1280,288,160 +demon_death +index:6 +bounds:1440,1120,288,160 +demon_death +index:18 +bounds:1152,800,288,160 +demon_death +index:10 +bounds:288,0,288,160 +demon_death +index:3 +bounds:1152,320,288,160 +demon_death +index:15 +bounds:864,0,288,160 +demon_death +index:8 +bounds:1152,160,288,160 +demon_fire_breath +index:20 +bounds:288,1600,288,160 +demon_fire_breath +index:12 +bounds:0,960,288,160 +demon_fire_breath +index:3 +bounds:864,1280,288,160 +demon_fire_breath +index:17 +bounds:288,800,288,160 +demon_fire_breath +index:8 +bounds:288,640,288,160 +demon_fire_breath +index:14 +bounds:576,480,288,160 +demon_fire_breath +index:5 +bounds:576,320,288,160 +demon_fire_breath +index:19 +bounds:1440,640,288,160 +demon_fire_breath +index:11 +bounds:1728,640,288,160 +demon_fire_breath +index:2 +bounds:1440,0,288,160 +demon_idle +index:3 +bounds:864,1760,288,160 +demon_idle +index:5 +bounds:288,480,288,160 +demon_idle +index:2 +bounds:1152,480,288,160 +demon_smash +index:17 +bounds:0,1760,288,160 +demon_smash +index:6 +bounds:0,1600,288,160 +demon_smash +index:14 +bounds:576,1120,288,160 +demon_smash +index:3 +bounds:1152,1440,288,160 +demon_smash +index:8 +bounds:576,800,288,160 +demon_smash +index:11 +bounds:1152,960,288,160 +demon_smash +index:16 +bounds:288,160,288,160 +demon_smash +index:5 +bounds:864,480,288,160 +demon_smash +index:13 +bounds:1728,320,288,160 +demon_smash +index:2 +bounds:1728,160,288,160 +demon_take_hit +index:2 +bounds:576,1760,288,160 +demon_take_hit +index:4 +bounds:864,960,288,160 +demon_take_hit +index:1 +bounds:1728,960,288,160 +demon_walk +index:8 +bounds:288,1440,288,160 +demon_walk +index:5 +bounds:0,640,288,160 +demon_walk +index:11 +bounds:0,160,288,160 +demon_walk +index:2 +bounds:288,320,288,160 +demon_walk +index:7 +bounds:576,160,288,160 +idle +index:1 +bounds:864,1440,288,160 +idle +index:6 +bounds:1440,1440,288,160 +idle +index:3 +bounds:1440,960,288,160 +move +index:4 +bounds:1152,1760,288,160 +move +index:1 +bounds:1728,1600,288,160 +move +index:6 +bounds:1728,1280,288,160 +move +index:3 +bounds:1440,480,288,160 +projectile_explosion +index:7 +bounds:2016,1888,32,32 +projectile_explosion +index:4 +bounds:2016,1824,32,32 +projectile_explosion +index:11 +bounds:2016,1792,32,32 +projectile_explosion +index:9 +bounds:2016,1760,32,32 +projectile_explosion +index:1 +bounds:2016,1728,32,32 +projectile_explosion +index:6 +bounds:2016,1696,32,32 +projectile_explosion +index:3 +bounds:2016,1632,32,32 +projectile_explosion +index:10 +bounds:2016,1600,32,32 +projectile_explosion +index:8 +bounds:2016,1568,32,32 +projectile_explosion +index:5 +bounds:2016,1504,32,32 +projectile_explosion +index:2 +bounds:2016,1472,32,32 +projectile_idle +index:2 +bounds:2016,1856,32,32 +projectile_idle +index:1 +bounds:2016,1664,32,32 +projectile_idle +index:3 +bounds:2016,1536,32,32 +take_hit +index:5 +bounds:1440,1760,288,160 +take_hit +index:2 +bounds:0,320,288,160 +take_hit +index:4 +bounds:1728,480,288,160 +transform +index:2 +bounds:288,1280,288,160 +transform +index:31 +bounds:576,1440,288,160 +transform +index:18 +bounds:864,1600,288,160 +transform +index:10 +bounds:288,1120,288,160 +transform +index:23 +bounds:1152,1600,288,160 +transform +index:7 +bounds:288,960,288,160 +transform +index:15 +bounds:1152,1280,288,160 +transform +index:28 +bounds:0,480,288,160 +transform +index:20 +bounds:1728,1440,288,160 +transform +index:4 +bounds:864,800,288,160 +transform +index:12 +bounds:864,640,288,160 +transform +index:25 +bounds:1728,1120,288,160 +transform +index:9 +bounds:0,0,288,160 +transform +index:1 +bounds:1728,800,288,160 +transform +index:30 +bounds:576,0,288,160 +transform +index:17 +bounds:864,160,288,160 +transform +index:22 +bounds:1440,320,288,160 +transform +index:6 +bounds:1440,160,288,160 + +demon2.png +size:2048,2048 +repeat:none +demon_cast_spell +index:6 +bounds:288,1280,288,160 +demon_cast_spell +index:3 +bounds:1152,1120,288,160 +demon_cleave +index:2 +bounds:0,1760,288,160 +demon_cleave +index:7 +bounds:576,1440,288,160 +demon_cleave +index:12 +bounds:288,960,288,160 +demon_cleave +index:4 +bounds:864,960,288,160 +demon_cleave +index:9 +bounds:288,320,288,160 +demon_cleave +index:14 +bounds:576,320,288,160 +demon_death +index:20 +bounds:288,1600,288,160 +demon_death +index:12 +bounds:0,960,288,160 +demon_death +index:5 +bounds:576,1280,288,160 +demon_death +index:17 +bounds:576,960,288,160 +demon_death +index:2 +bounds:1728,1440,288,160 +demon_death +index:14 +bounds:864,640,288,160 +demon_death +index:7 +bounds:1152,800,288,160 +demon_death +index:19 +bounds:1440,640,288,160 +demon_fire_breath +index:16 +bounds:0,1440,288,160 +demon_fire_breath +index:7 +bounds:576,1600,288,160 +demon_fire_breath +index:21 +bounds:864,1600,288,160 +demon_fire_breath +index:13 +bounds:0,640,288,160 +demon_fire_breath +index:4 +bounds:0,480,288,160 +demon_fire_breath +index:18 +bounds:0,320,288,160 +demon_fire_breath +index:9 +bounds:1440,1120,288,160 +demon_fire_breath +index:10 +bounds:0,160,288,160 +demon_fire_breath +index:1 +bounds:1440,800,288,160 +demon_cleave +index:1 +bounds:1440,800,288,160 +demon_fire_breath +index:15 +bounds:864,320,288,160 +demon_fire_breath +index:6 +bounds:864,160,288,160 +demon_idle +index:4 +bounds:1152,1600,288,160 +demon_idle +index:1 +bounds:288,480,288,160 +demon_idle +index:6 +bounds:0,0,288,160 +demon_smash +index:18 +bounds:864,1760,288,160 +demon_smash +index:7 +bounds:0,1120,288,160 +demon_smash +index:10 +bounds:864,1280,288,160 +demon_smash +index:15 +bounds:288,640,288,160 +demon_smash +index:4 +bounds:576,800,288,160 +demon_smash +index:9 +bounds:1728,1280,288,160 +demon_smash +index:12 +bounds:864,480,288,160 +demon_smash +index:1 +bounds:1152,640,288,160 +demon_take_hit +index:3 +bounds:1152,1760,288,160 +demon_take_hit +index:5 +bounds:576,480,288,160 +demon_walk +index:4 +bounds:288,1760,288,160 +demon_walk +index:9 +bounds:288,1120,288,160 +demon_walk +index:10 +bounds:1440,1600,288,160 +demon_walk +index:1 +bounds:1728,1760,288,160 +demon_walk +index:6 +bounds:1440,1280,288,160 +demon_walk +index:12 +bounds:288,0,288,160 +demon_walk +index:3 +bounds:576,160,288,160 +idle +index:5 +bounds:0,1280,288,160 +idle +index:2 +bounds:864,1120,288,160 +idle +index:4 +bounds:1728,800,288,160 +move +index:8 +bounds:0,1600,288,160 +move +index:5 +bounds:1152,1440,288,160 +move +index:2 +bounds:864,800,288,160 +move +index:7 +bounds:1728,960,288,160 +take_hit +index:1 +bounds:864,1440,288,160 +take_hit +index:6 +bounds:1440,1440,288,160 +take_hit +index:3 +bounds:1728,1120,288,160 +transform +index:14 +bounds:576,1760,288,160 +transform +index:27 +bounds:288,1440,288,160 +transform +index:3 +bounds:1440,1760,288,160 +transform +index:32 +bounds:0,800,288,160 +transform +index:19 +bounds:576,1120,288,160 +transform +index:11 +bounds:288,800,288,160 +transform +index:24 +bounds:1152,1280,288,160 +transform +index:8 +bounds:1728,1600,288,160 +transform +index:16 +bounds:576,640,288,160 +transform +index:29 +bounds:1152,960,288,160 +transform +index:21 +bounds:1440,960,288,160 +transform +index:5 +bounds:288,160,288,160 +transform +index:13 +bounds:1152,480,288,160 +transform +index:26 +bounds:576,0,288,160 +default +index:29 +bounds:864,1760,288,160 diff --git a/source/core/assets/images/mobboss/demon.png b/source/core/assets/images/mobboss/demon.png new file mode 100644 index 000000000..7d7141a31 Binary files /dev/null and b/source/core/assets/images/mobboss/demon.png differ diff --git a/source/core/assets/images/mobboss/demon2.png b/source/core/assets/images/mobboss/demon2.png new file mode 100644 index 000000000..1e570a1b4 Binary files /dev/null and b/source/core/assets/images/mobboss/demon2.png differ diff --git a/source/core/assets/images/mobboss/patrick.atlas b/source/core/assets/images/mobboss/patrick.atlas new file mode 100644 index 000000000..6e1e1df86 --- /dev/null +++ b/source/core/assets/images/mobboss/patrick.atlas @@ -0,0 +1,198 @@ +patrick.png +size:2048,512 +repeat:none +patrick_attack +index:3 +bounds:2,97,140,93 +patrick_attack +index:8 +bounds:428,382,140,93 +patrick_attack +index:10 +bounds:286,97,140,93 +patrick_attack +index:5 +bounds:854,382,140,93 +patrick_attack +index:2 +bounds:712,97,140,93 +patrick_attack +index:7 +bounds:1138,287,140,93 +patrick_attack +index:4 +bounds:996,2,140,93 +patrick_attack +index:9 +bounds:1280,192,140,93 +patrick_attack +index:1 +bounds:1706,382,140,93 +patrick_attack +index:6 +bounds:1422,2,140,93 +patrick_cast +index:3 +bounds:144,287,140,93 +patrick_cast +index:8 +bounds:286,287,140,93 +patrick_cast +index:5 +bounds:286,2,140,93 +patrick_cast +index:2 +bounds:996,382,140,93 +patrick_cast +index:7 +bounds:1138,382,140,93 +patrick_cast +index:4 +bounds:1280,287,140,93 +patrick_cast +index:9 +bounds:1138,97,140,93 +patrick_cast +index:1 +bounds:1138,2,140,93 +patrick_cast +index:6 +bounds:1422,97,140,93 +patrick_death +index:4 +bounds:2,192,140,93 +patrick_death +index:9 +bounds:144,192,140,93 +patrick_death +index:1 +bounds:286,192,140,93 +patrick_death +index:6 +bounds:712,382,140,93 +patrick_death +index:3 +bounds:854,287,140,93 +patrick_death +index:8 +bounds:996,287,140,93 +patrick_death +index:10 +bounds:996,192,140,93 +patrick_death +index:5 +bounds:1138,192,140,93 +patrick_death +index:2 +bounds:1422,192,140,93 +patrick_death +index:7 +bounds:1564,192,140,93 +patrick_hurt +index:1 +bounds:144,2,140,93 +patrick_hurt +index:3 +bounds:854,192,140,93 +patrick_hurt +index:2 +bounds:1280,2,140,93 +patrick_idle +index:7 +bounds:2,287,140,93 +patrick_idle +index:4 +bounds:144,97,140,93 +patrick_idle +index:1 +bounds:712,287,140,93 +patrick_idle +index:6 +bounds:570,97,140,93 +patrick_idle +index:3 +bounds:854,97,140,93 +patrick_idle +index:8 +bounds:854,2,140,93 +patrick_idle +index:5 +bounds:1564,382,140,93 +patrick_idle +index:2 +bounds:1848,382,140,93 +patrick_spell +index:7 +bounds:2,382,140,93 +patrick_spell +index:13 +bounds:144,382,140,93 +patrick_spell +index:4 +bounds:2,2,140,93 +patrick_spell +index:3 +bounds:2,2,140,93 +patrick_spell +index:10 +bounds:428,287,140,93 +patrick_spell +index:9 +bounds:428,192,140,93 +patrick_spell +index:15 +bounds:570,287,140,93 +patrick_spell +index:16 +bounds:570,287,140,93 +patrick_spell +index:1 +bounds:570,192,140,93 +patrick_spell +index:2 +bounds:570,192,140,93 +patrick_spell +index:6 +bounds:428,2,140,93 +patrick_spell +index:12 +bounds:712,192,140,93 +patrick_spell +index:8 +bounds:1280,382,140,93 +patrick_spell +index:14 +bounds:996,97,140,93 +patrick_spell +index:5 +bounds:1422,287,140,93 +patrick_spell +index:11 +bounds:1280,97,140,93 +patrick_walk +index:4 +bounds:286,382,140,93 +patrick_walk +index:1 +bounds:570,382,140,93 +patrick_walk +index:6 +bounds:428,97,140,93 +patrick_walk +index:3 +bounds:570,2,140,93 +patrick_walk +index:8 +bounds:712,2,140,93 +patrick_walk +index:5 +bounds:1422,382,140,93 +patrick_walk +index:2 +bounds:1564,287,140,93 +patrick_walk +index:7 +bounds:1706,287,140,93 +default +index:2 +bounds:1848,382,140,93 \ No newline at end of file diff --git a/source/core/assets/images/mobboss/patrick.png b/source/core/assets/images/mobboss/patrick.png new file mode 100644 index 000000000..6699d771e Binary files /dev/null and b/source/core/assets/images/mobboss/patrick.png differ diff --git a/source/core/assets/images/mobs/boss2.atlas b/source/core/assets/images/mobs/boss2.atlas deleted file mode 100644 index 4b2867513..000000000 --- a/source/core/assets/images/mobs/boss2.atlas +++ /dev/null @@ -1,348 +0,0 @@ -boss2.png -size: 980, 651 -format: RGBA8888 -filter: Linear,Linear -repeat: none -Idle - rotate: false - xy: 0, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 140, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 280, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -default - rotate: false - xy: 280, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 420, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 560, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 700, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 840, 0 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 0, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Idle - rotate: false - xy: 140, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 280, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 420, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 560, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 700, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 840, 93 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 0, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 140, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 280, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Walk - rotate: false - xy: 420, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 560, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 700, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 840, 186 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 0, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 140, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 280, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 420, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 560, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 700, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A1 - rotate: false - xy: 840, 279 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 0, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 140, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 280, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 420, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 560, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Hurt - rotate: false - xy: 700, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 840, 372 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 0, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 140, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 280, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 420, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 560, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -boss_death - rotate: false - xy: 700, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Charging - rotate: false - xy: 840, 465 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Charging - rotate: false - xy: 0, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Charging - rotate: false - xy: 140, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Charging - rotate: false - xy: 280, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -Charging - rotate: false - xy: 420, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A2 - rotate: false - xy: 560, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 -A2 - rotate: false - xy: 700, 558 - size: 140, 93 - orig: 140, 93 - offset: 0, 0 - index: -1 diff --git a/source/core/assets/images/mobs/boss2.png b/source/core/assets/images/mobs/boss2.png deleted file mode 100644 index a9f7d1d81..000000000 Binary files a/source/core/assets/images/mobs/boss2.png and /dev/null differ diff --git a/source/core/assets/images/mobs/dragon_knight.atlas b/source/core/assets/images/mobs/dragon_knight.atlas new file mode 100644 index 000000000..59a0335b8 --- /dev/null +++ b/source/core/assets/images/mobs/dragon_knight.atlas @@ -0,0 +1,174 @@ + +dragon_knight.png +size: 512, 512 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +dragon_knight_attack + rotate: false + xy: 308, 105 + size: 99, 99 + orig: 99, 99 + offset: 0, 0 + index: -1 +dragon_knight_attack + rotate: false + xy: 410, 207 + size: 100, 99 + orig: 100, 99 + offset: 0, 0 + index: -1 +dragon_knight_attack + rotate: false + xy: 308, 4 + size: 99, 99 + orig: 99, 99 + offset: 0, 0 + index: -1 +dragon_knight_attack + rotate: false + xy: 2, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_attack + rotate: false + xy: 206, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_attack + rotate: false + xy: 2, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 104, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 308, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 410, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 2, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 308, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 206, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 206, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 2, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 104, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 2, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 206, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 308, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_death + rotate: false + xy: 104, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_run + rotate: false + xy: 104, 104 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_run + rotate: false + xy: 206, 410 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_run + rotate: false + xy: 410, 308 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +dragon_knight_run + rotate: false + xy: 104, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 104, 206 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/dragon_knight.png b/source/core/assets/images/mobs/dragon_knight.png new file mode 100644 index 000000000..85bcd9340 Binary files /dev/null and b/source/core/assets/images/mobs/dragon_knight.png differ diff --git a/source/core/assets/images/mobs/fire_worm.atlas b/source/core/assets/images/mobs/fire_worm.atlas new file mode 100644 index 000000000..d647dd3a1 --- /dev/null +++ b/source/core/assets/images/mobs/fire_worm.atlas @@ -0,0 +1,244 @@ + +fire_worm.png +size: 1024, 256 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +fire_worm_attack + rotate: false + xy: 233, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 387, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 79, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 618, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 388, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 80, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 541, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 156, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 850, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 464, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 156, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 695, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 387, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 2, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 619, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack + rotate: false + xy: 233, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 311, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 695, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 2, 156 + size: 76, 75 + orig: 76, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 79, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 541, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 310, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 772, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_death + rotate: false + xy: 542, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 696, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 310, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 2, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 464, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 234, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 773, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 465, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 157, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_walk + rotate: false + xy: 618, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 618, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/fire_worm.png b/source/core/assets/images/mobs/fire_worm.png new file mode 100644 index 000000000..9311b527a Binary files /dev/null and b/source/core/assets/images/mobs/fire_worm.png differ diff --git a/source/core/assets/images/mobs/fire_worm_attack.atlas b/source/core/assets/images/mobs/fire_worm_attack.atlas new file mode 100644 index 000000000..c8d2e2d1f --- /dev/null +++ b/source/core/assets/images/mobs/fire_worm_attack.atlas @@ -0,0 +1,118 @@ + +fire_worm_attack.png +size: 256, 512 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +fire_worm_attack1 + rotate: false + xy: 2, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack10 + rotate: false + xy: 2, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack11 + rotate: false + xy: 79, 387 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack12 + rotate: false + xy: 79, 79 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack13 + rotate: false + xy: 79, 233 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack14 + rotate: false + xy: 2, 387 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack15 + rotate: false + xy: 156, 233 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack16 + rotate: false + xy: 79, 310 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack2 + rotate: false + xy: 79, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack3 + rotate: false + xy: 79, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack4 + rotate: false + xy: 2, 233 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack5 + rotate: false + xy: 156, 156 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack6 + rotate: false + xy: 156, 310 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack7 + rotate: false + xy: 2, 310 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack8 + rotate: false + xy: 2, 2 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 +fire_worm_attack9 + rotate: false + xy: 156, 387 + size: 75, 75 + orig: 75, 75 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/fire_worm_attack.png b/source/core/assets/images/mobs/fire_worm_attack.png new file mode 100644 index 000000000..a9f32c3fc Binary files /dev/null and b/source/core/assets/images/mobs/fire_worm_attack.png differ diff --git a/source/core/assets/images/mobs/fire_worm_walk b/source/core/assets/images/mobs/fire_worm_walk new file mode 100644 index 000000000..0cb3f5ec3 --- /dev/null +++ b/source/core/assets/images/mobs/fire_worm_walk @@ -0,0 +1,69 @@ + +fire_worm_walk.png +size: 1024, 128 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +fire_worm_walk1 + rotate: false + xy: 646, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk2 + rotate: false + xy: 278, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk3 + rotate: false + xy: 2, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk4 + rotate: false + xy: 462, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk5 + rotate: false + xy: 186, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk6 + rotate: false + xy: 738, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk7 + rotate: false + xy: 370, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk8 + rotate: false + xy: 94, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 +fire_worm_walk9 + rotate: false + xy: 554, 2 + size: 90, 90 + orig: 90, 90 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/fire_worm_walk.png b/source/core/assets/images/mobs/fire_worm_walk.png new file mode 100644 index 000000000..44e515833 Binary files /dev/null and b/source/core/assets/images/mobs/fire_worm_walk.png differ diff --git a/source/core/assets/images/mobs/ghost_king.png b/source/core/assets/images/mobs/ghost_king.png deleted file mode 100644 index 78c763be7..000000000 Binary files a/source/core/assets/images/mobs/ghost_king.png and /dev/null differ diff --git a/source/core/assets/images/mobs/rangeBossRight.png b/source/core/assets/images/mobs/rangeBossRight.png deleted file mode 100644 index b44e5efbc..000000000 Binary files a/source/core/assets/images/mobs/rangeBossRight.png and /dev/null differ diff --git a/source/core/assets/images/mobs/satyr.png b/source/core/assets/images/mobs/satyr.png deleted file mode 100644 index 940dd68ad..000000000 Binary files a/source/core/assets/images/mobs/satyr.png and /dev/null differ diff --git a/source/core/assets/images/mobs/skeleton.atlas b/source/core/assets/images/mobs/skeleton.atlas new file mode 100644 index 000000000..f0117d879 --- /dev/null +++ b/source/core/assets/images/mobs/skeleton.atlas @@ -0,0 +1,272 @@ + +skeleton.png +size: 2048, 128 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +skeleton_attack + rotate: false + xy: 386, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 898, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 450, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 2, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 706, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 1090, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 642, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 258, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 962, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 514, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 130, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 770, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_attack + rotate: false + xy: 322, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 1026, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 66, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 834, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 1154, 55 + size: 62, 45 + orig: 62, 45 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 578, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 194, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 898, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 450, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 2, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 706, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 258, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_death + rotate: false + xy: 1026, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 386, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 514, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 66, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 770, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 1090, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 642, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 194, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 962, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 578, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 130, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 834, 2 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +skeleton_walk + rotate: false + xy: 322, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 322, 52 + size: 62, 48 + orig: 62, 48 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/skeleton.png b/source/core/assets/images/mobs/skeleton.png new file mode 100644 index 000000000..cbcbd1ed1 Binary files /dev/null and b/source/core/assets/images/mobs/skeleton.png differ diff --git a/source/core/assets/images/mobs/water_queen.atlas b/source/core/assets/images/mobs/water_queen.atlas new file mode 100644 index 000000000..f3d5ea8fc --- /dev/null +++ b/source/core/assets/images/mobs/water_queen.atlas @@ -0,0 +1,195 @@ + +water_queen.png +size: 2048, 128 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +water_queen_attack + rotate: false + xy: 932, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 1116, 69 + size: 90, 55 + orig: 90, 55 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 2, 64 + size: 100, 60 + orig: 100, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 646, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 1208, 71 + size: 90, 53 + orig: 90, 53 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 1024, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 564, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 196, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_attack + rotate: false + xy: 840, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 278, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 922, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 462, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 94, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 738, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 370, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 2, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 656, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_death + rotate: false + xy: 288, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 748, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 380, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 1014, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 554, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 186, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 830, 2 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 472, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +water_queen_walk + rotate: false + xy: 104, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 104, 64 + size: 90, 60 + orig: 90, 60 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/water_queen.png b/source/core/assets/images/mobs/water_queen.png new file mode 100644 index 000000000..bbed31311 Binary files /dev/null and b/source/core/assets/images/mobs/water_queen.png differ diff --git a/source/core/assets/images/mobs/water_slime.atlas b/source/core/assets/images/mobs/water_slime.atlas new file mode 100644 index 000000000..767f1cd29 --- /dev/null +++ b/source/core/assets/images/mobs/water_slime.atlas @@ -0,0 +1,104 @@ + +water_slime.png +size: 512, 32 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +water_slime_attack + rotate: false + xy: 308, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_attack + rotate: false + xy: 104, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_attack + rotate: false + xy: 376, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_attack + rotate: false + xy: 206, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_attack + rotate: false + xy: 2, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_death + rotate: false + xy: 138, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_death + rotate: false + xy: 410, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_death + rotate: false + xy: 240, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_death + rotate: false + xy: 36, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_walk + rotate: false + xy: 274, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_walk + rotate: false + xy: 70, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_walk + rotate: false + xy: 342, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +water_slime_walk + rotate: false + xy: 172, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 172, 2 + size: 32, 25 + orig: 32, 25 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/water_slime.png b/source/core/assets/images/mobs/water_slime.png new file mode 100644 index 000000000..66b1b071f Binary files /dev/null and b/source/core/assets/images/mobs/water_slime.png differ diff --git a/source/core/assets/images/mobs/wizard.atlas b/source/core/assets/images/mobs/wizard.atlas new file mode 100644 index 000000000..f9a87a81f --- /dev/null +++ b/source/core/assets/images/mobs/wizard.atlas @@ -0,0 +1,174 @@ + +wizard.png +size: 2048, 256 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +wizard_attack + rotate: false + xy: 356, 94 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 238, 94 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 2, 2 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 2, 2 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 120, 2 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 2, 94 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 238, 2 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_attack + rotate: false + xy: 120, 94 + size: 116, 90 + orig: 116, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 1146, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 810, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 474, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 916, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 580, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 1140, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_death + rotate: false + xy: 804, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 468, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 1034, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 698, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 356, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 922, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 586, 94 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 1028, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +wizard_run + rotate: false + xy: 692, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 +default + rotate: false + xy: 692, 2 + size: 110, 90 + orig: 110, 90 + offset: 0, 0 + index: -1 diff --git a/source/core/assets/images/mobs/wizard.png b/source/core/assets/images/mobs/wizard.png new file mode 100644 index 000000000..bcb6208b0 Binary files /dev/null and b/source/core/assets/images/mobs/wizard.png differ diff --git a/source/core/assets/images/mobs/xeno-grunt-attack-1.png b/source/core/assets/images/mobs/xeno-grunt-attack-1.png deleted file mode 100644 index 79bb1676e..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-attack-1.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-attack-2.png b/source/core/assets/images/mobs/xeno-grunt-attack-2.png deleted file mode 100644 index 32631a182..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-attack-2.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-death-falling.png b/source/core/assets/images/mobs/xeno-grunt-death-falling.png deleted file mode 100644 index d7487689b..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-death-falling.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-death-grounded.png b/source/core/assets/images/mobs/xeno-grunt-death-grounded.png deleted file mode 100644 index 3bcc06dcd..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-death-grounded.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-death.png b/source/core/assets/images/mobs/xeno-grunt-death.png deleted file mode 100644 index 97c730a6c..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-death.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-falling.png b/source/core/assets/images/mobs/xeno-grunt-falling.png deleted file mode 100644 index 3bcf63b99..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-falling.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-idle.png b/source/core/assets/images/mobs/xeno-grunt-idle.png deleted file mode 100644 index ddb65f0ce..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-idle.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-jump-effect.png b/source/core/assets/images/mobs/xeno-grunt-jump-effect.png deleted file mode 100644 index 157cabede..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-jump-effect.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-jumping.png b/source/core/assets/images/mobs/xeno-grunt-jumping.png deleted file mode 100644 index f45338cca..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-jumping.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-knockback.png b/source/core/assets/images/mobs/xeno-grunt-knockback.png deleted file mode 100644 index 5b1e3f518..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-knockback.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-melee-attack.png b/source/core/assets/images/mobs/xeno-grunt-melee-attack.png deleted file mode 100644 index e0f21b656..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-melee-attack.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-prep-jump.png b/source/core/assets/images/mobs/xeno-grunt-prep-jump.png deleted file mode 100644 index 10d2328a4..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-prep-jump.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-projectile-explosion.png b/source/core/assets/images/mobs/xeno-grunt-projectile-explosion.png deleted file mode 100644 index f7f131968..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-projectile-explosion.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-range-attack.png b/source/core/assets/images/mobs/xeno-grunt-range-attack.png deleted file mode 100644 index fd7bde932..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-range-attack.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-range-projectile.png b/source/core/assets/images/mobs/xeno-grunt-range-projectile.png deleted file mode 100644 index a607bbc44..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-range-projectile.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-run-damaged.png b/source/core/assets/images/mobs/xeno-grunt-run-damaged.png deleted file mode 100644 index 5b621b2d0..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-run-damaged.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xeno-grunt-run.png b/source/core/assets/images/mobs/xeno-grunt-run.png deleted file mode 100644 index 252bf19b3..000000000 Binary files a/source/core/assets/images/mobs/xeno-grunt-run.png and /dev/null differ diff --git a/source/core/assets/images/mobs/xenoGruntDeath.atlas b/source/core/assets/images/mobs/xenoGruntDeath.atlas deleted file mode 100644 index 4226e0569..000000000 --- a/source/core/assets/images/mobs/xenoGruntDeath.atlas +++ /dev/null @@ -1,40 +0,0 @@ -xeno-grunt-death.png -size: 1600, 320 -format: RGBA8888 -filter: Nearest,Nearest -repeat: none -xeno_die - rotate: false - xy: 0, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_die - rotate: false - xy: 320, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_die - rotate: false - xy: 640, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_die - rotate: false - xy: 960, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_die - rotate: false - xy: 1280, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 \ No newline at end of file diff --git a/source/core/assets/images/mobs/xenoGruntMeleeAttack.atlas b/source/core/assets/images/mobs/xenoGruntMeleeAttack.atlas deleted file mode 100644 index 6ef6c274f..000000000 --- a/source/core/assets/images/mobs/xenoGruntMeleeAttack.atlas +++ /dev/null @@ -1,117 +0,0 @@ -xeno-grunt-melee-attack.png -size: 2880, 640 -format: RGBA8888 -filter: Nearest,Nearest -repeat: none -xeno_melee_1 - rotate: false - xy: 0, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_melee_1 - rotate: false - xy: 320, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_melee_1 - rotate: false - xy: 640, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_melee_1 - rotate: false - xy: 960, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_melee_1 - rotate: false - xy: 1280, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 -xeno_melee_1 - rotate: false - xy: 1600, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 5 -xeno_melee_1 - rotate: false - xy: 1920, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 6 -xeno_melee_1 - rotate: false - xy: 2240, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 7 -xeno_melee_1 - rotate: false - xy: 2560, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 8 -xeno_melee_2 - rotate: false - xy: 0, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_melee_2 - rotate: false - xy: 320, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_melee_2 - rotate: false - xy: 640, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_melee_2 - rotate: false - xy: 960, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_melee_2 - rotate: false - xy: 1280, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 -xeno_melee_2 - rotate: false - xy: 1600, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 5 -xeno_melee_2 - rotate: false - xy: 1920, 320 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 6 \ No newline at end of file diff --git a/source/core/assets/images/mobs/xenoGruntRangedAttack.atlas b/source/core/assets/images/mobs/xenoGruntRangedAttack.atlas deleted file mode 100644 index 6862a0c1d..000000000 --- a/source/core/assets/images/mobs/xenoGruntRangedAttack.atlas +++ /dev/null @@ -1,47 +0,0 @@ -xeno-grunt-range-attack.png -size: 2240, 320 -format: RGBA8888 -filter: Nearest,Nearest -repeat: none -xeno_shoot - rotate: false - xy: 0, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_shoot - rotate: false - xy: 320, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_shoot - rotate: false - xy: 640, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_shoot - rotate: false - xy: 960, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_shoot - rotate: false - xy: 1280, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 -xeno_shoot - rotate: false - xy: 1600, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 5 diff --git a/source/core/assets/images/mobs/xenoGruntRunning.atlas b/source/core/assets/images/mobs/xenoGruntRunning.atlas deleted file mode 100644 index b6ef430d3..000000000 --- a/source/core/assets/images/mobs/xenoGruntRunning.atlas +++ /dev/null @@ -1,68 +0,0 @@ -xeno-grunt-run.png -size: 2560, 320 -format: RGBA8888 -filter: Nearest,Nearest -repeat: none -xeno_run - rotate: false - xy: 0, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_run - rotate: false - xy: 320, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_run - rotate: false - xy: 640, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_run - rotate: false - xy: 960, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_run - rotate: false - xy: 1280, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 -xeno_run - rotate: false - xy: 1600, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 5 -xeno_run - rotate: false - xy: 1920, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 6 -xeno_run - rotate: false - xy: 2240, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 7 -default - rotate: false - xy: 2240, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 \ No newline at end of file diff --git a/source/core/assets/images/mobs/xenoGruntRunningDamaged.atlas b/source/core/assets/images/mobs/xenoGruntRunningDamaged.atlas deleted file mode 100644 index 1862955d1..000000000 --- a/source/core/assets/images/mobs/xenoGruntRunningDamaged.atlas +++ /dev/null @@ -1,68 +0,0 @@ -xeno-grunt-run-damaged.png -size: 2560, 320 -format: RGBA8888 -filter: Nearest,Nearest -repeat: none -xeno_hurt - rotate: false - xy: 0, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 -xeno_hurt - rotate: false - xy: 320, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 1 -xeno_hurt - rotate: false - xy: 640, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 2 -xeno_hurt - rotate: false - xy: 960, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 3 -xeno_hurt - rotate: false - xy: 1280, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 4 -xeno_hurt - rotate: false - xy: 1600, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 5 -xeno_hurt - rotate: false - xy: 1920, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 6 -xeno_hurt - rotate: false - xy: 2240, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 7 -default - rotate: false - xy: 2240, 0 - size: 320, 320 - orig: 320, 320 - offset: 0, 0 - index: 0 \ No newline at end of file diff --git a/source/core/assets/images/projectiles/mobKing_projectile.atlas b/source/core/assets/images/projectiles/mobBoss_projectile.atlas similarity index 97% rename from source/core/assets/images/projectiles/mobKing_projectile.atlas rename to source/core/assets/images/projectiles/mobBoss_projectile.atlas index ae151e03b..e0ddcbdd0 100644 --- a/source/core/assets/images/projectiles/mobKing_projectile.atlas +++ b/source/core/assets/images/projectiles/mobBoss_projectile.atlas @@ -1,5 +1,5 @@ -mobKing_projectile.png +mobBoss_projectile.png size: 256, 32 format: RGBA8888 filter: Nearest, Nearest diff --git a/source/core/assets/images/projectiles/mobKing_projectile.png b/source/core/assets/images/projectiles/mobBoss_projectile.png similarity index 100% rename from source/core/assets/images/projectiles/mobKing_projectile.png rename to source/core/assets/images/projectiles/mobBoss_projectile.png diff --git a/source/core/assets/images/projectiles/projectile.png b/source/core/assets/images/projectiles/projectile.png new file mode 100644 index 000000000..412fd559f Binary files /dev/null and b/source/core/assets/images/projectiles/projectile.png differ diff --git a/source/core/assets/replay_pid2865.log b/source/core/assets/replay_pid2865.log index ba517fe3c..f9f6db55d 100644 --- a/source/core/assets/replay_pid2865.log +++ b/source/core/assets/replay_pid2865.log @@ -53,7 +53,7 @@ instanceKlass @bci com/csse3200/game/components/npc/Boss1AnimationController cr instanceKlass @bci com/csse3200/game/components/npc/Boss1AnimationController create ()V 66 member ; # com/csse3200/game/components/npc/Boss1AnimationController$$Lambda$104+0x0000000800ceca98 instanceKlass @bci com/csse3200/game/components/npc/Boss1AnimationController create ()V 48 member ; # com/csse3200/game/components/npc/Boss1AnimationController$$Lambda$103+0x0000000800cec888 instanceKlass @bci com/csse3200/game/components/npc/Boss1AnimationController create ()V 30 member ; # com/csse3200/game/components/npc/Boss1AnimationController$$Lambda$102+0x0000000800cec678 -instanceKlass com/csse3200/game/entities/factories/BossKingFactory +instanceKlass com/csse3200/game/entities/factories/MobBossFactory instanceKlass java/util/stream/AbstractSpinedBuffer instanceKlass java/util/stream/Node$Builder$OfInt instanceKlass java/util/stream/Node$Builder diff --git a/source/core/src/main/com/csse3200/game/GdxGame.java b/source/core/src/main/com/csse3200/game/GdxGame.java index 43f525990..8cbb484cb 100644 --- a/source/core/src/main/com/csse3200/game/GdxGame.java +++ b/source/core/src/main/com/csse3200/game/GdxGame.java @@ -3,7 +3,6 @@ import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; -import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.files.UserSettings; import com.csse3200.game.screens.*; import org.slf4j.Logger; diff --git a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java index 30a2b5234..6ba2f3163 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -1,23 +1,24 @@ package com.csse3200.game.areas; import com.badlogic.gdx.audio.Music; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.GridPoint2; -import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import com.csse3200.game.components.ProjectileEffects; import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.areas.terrain.TerrainFactory.TerrainType; import com.csse3200.game.components.TouchAttackComponent; -import com.csse3200.game.components.player.PlayerStatsDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.*; import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.screens.AssetLoader; +import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.utils.math.RandomUtils; import com.csse3200.game.services.ResourceService; -import com.csse3200.game.services.GameEndService; import com.csse3200.game.services.ServiceLocator; import com.csse3200.game.components.gamearea.GameAreaDisplay; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Random; @@ -39,8 +40,10 @@ public class ForestGameArea extends GameArea { private static final int NUM_BOSS = 4; private AssetLoader assetLoader; - private static final int NUM_BOSSKING2=3; - private static final int NUM_BOSSKING1=1; + private static final int NUM_MOBBOSS2=3; + private static final int NUM_MOBBOSS1=1; + + private Random random = new Random(); private int wave = 0; private Timer waveTimer; @@ -48,9 +51,130 @@ public class ForestGameArea extends GameArea { private Timer bossSpawnTimer; private int bossSpawnInterval = 10000; // 1 minute in milliseconds private static final int NUM_WEAPON_TOWERS = 3; - private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(0, 0); + private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(2, 4); // Temporary spawn point for testing private static final float WALL_WIDTH = 0.1f; + + // Required to load assets before using them + private static final String[] forestTextures = { + "images/desert_bg.png", + "images/ice_bg.png", + "images/lava_bg.png", + "images/projectiles/projectile.png", + "images/ingamebg.png", + "images/box_boy_leaf.png", + "images/background/building1.png", + "images/ghost_1.png", + "images/grass_2.png", + "images/grass_3.png", + "images/hex_grass_1.png", + "images/background/mountain.png", + "images/ghost_king.png", + "images/ghost_1.png", + "images/terrain 2 normal.png", + "images/terrain 2 hex.png", + "images/hex_grass_2.png", + "images/hex_grass_3.png", + "images/iso_grass_1.png", + "images/iso_grass_2.png", + "images/iso_grass_3.png", + "images/towers/turret.png", + "images/towers/turret01.png", + "images/towers/turret_deployed.png", + "images/towers/fire_tower_atlas.png", + "images/towers/stun_tower.png", + "images/background/building2.png", + "images/mobs/robot.png", + "images/mobs/boss2.png", + "images/mobs/Attack_1.png", + "images/mobs/Attack_2.png", + "images/mobs/Charge_1.png", + "images/mobs/Charge_2.png", + "images/mobs/Dead.png", + "images/mobs/Enabling-5.png", + "images/mobs/satyr.png", + "images/mobs/Hurt.png", + "images/mobs/Idle.png", + "images/mobs/rangeBossRight.png", + "images/towers/wallTower.png", + "images/background/building2.png", + "images/iso_grass_3.png", + "images/terrain_use.png", + "images/Dusty_MoonBG.png", + "images/economy/scrap.png", + "images/economy/crystal.png", + "images/economy/econ-tower.png", + "images/projectiles/bossProjectile.png", + "images/towers/mine_tower.png", + "images/towers/TNTTower.png", + "images/towers/DroidTower.png", + "images/projectiles/basic_projectile.png", + "images/projectiles/mobProjectile.png", + "images/projectiles/engineer_projectile.png", + "images/projectiles/mobBoss_projectile.png", + "images/projectiles/snow_ball.png", + "images/projectiles/burn_effect.png", + "images/projectiles/stun_effect.png", + "images/projectiles/firework_anim.png", + "images/projectiles/pierce_anim.png", + "images/projectiles/snow_ball.png", + "images/mobboss/demon.png", + "images/mobboss/demon2.png", + "images/mobs/fire_worm.png", + "images/mobboss/patrick.png" + }; + private static final String[] forestTextureAtlases = { + "images/economy/econ-tower.atlas", + "images/terrain_iso_grass.atlas", + "images/ghost.atlas", + "images/mobs/boss2.atlas", + "images/ghostKing.atlas", + "images/towers/turret.atlas", + "images/towers/turret01.atlas", + "images/mobs/xenoGrunt.atlas", + "images/towers/fire_tower_atlas.atlas", + "images/towers/stun_tower.atlas", + "images/mobs/xenoGruntRunning.atlas", + "images/xenoGrunt.atlas", + "images/mobs/robot.atlas", + "images/mobs/rangeBossRight.atlas", + "images/towers/DroidTower.atlas", + "images/mobs/robot.atlas", + "images/mobs/rangeBossRight.atlas", + "images/towers/TNTTower.atlas", + "images/projectiles/basic_projectile.atlas", + "images/projectiles/bossProjectile.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/engineer_projectile.atlas", + "images/projectiles/mobBoss_projectile.atlas", + "images/projectiles/snow_ball.atlas", + "images/projectiles/pierce_anim.atlas", + "images/projectiles/burn_effect.atlas", + "images/projectiles/firework_anim.atlas", + "images/projectiles/mobProjectile.atlas", + "images/projectiles/stun_effect.atlas", + "images/mobboss/demon.atlas", + "images/mobs/fire_worm.atlas", + "images/mobs/dragon_knight.atlas", + "images/mobs/skeleton.atlas", + "images/mobs/wizard.atlas", + "images/mobs/water_queen.atlas", + "images/mobs/water_slime.atlas", + "images/mobboss/patrick.atlas" + }; + private static final String[] forestSounds = { + "sounds/Impact4.ogg", + "sounds/economy/click.wav", + "sounds/economy/click_1.wav", + "sounds/towers/gun_shot_trimmed.mp3", + "sounds/towers/deploy.mp3", + "sounds/towers/stow.mp3", + "sounds/engineers/firing_auto.mp3", + "sounds/engineers/firing_single.mp3", + "sounds/projectiles/on_collision.mp3", + "sounds/projectiles/explosion.mp3" + }; private static final String backgroundMusic = "sounds/background/Sci-Fi1.ogg"; private final TerrainFactory terrainFactory; @@ -60,8 +184,8 @@ public class ForestGameArea extends GameArea { // Variables to be used with spawn projectile methods. This is the variable // that should occupy the direction param. private static final int towardsMobs = 100; - private Entity bossKing2; - private Entity bossKing1; + private Entity mobBoss2; + private Entity mobBoss1; /** * Initialise this ForestGameArea to use the provided TerrainFactory. @@ -101,14 +225,23 @@ private void spawnWave() { switch (wave) { case 1: case 2: - spawnXenoGrunts(); + spawnFireWorm(); + spawnDragonKnight(); + break; case 3: - bossKing2 = spawnBossKing2(); + spawnSkeleton(); + spawnWizard(); + // mobBoss2 = spawnMobBoss2(); break; case 4: - bossKing2 = spawnBossKing2(); + spawnWaterQueen(); + spawnWaterSlime(); + // mobBoss2 = spawnMobBoss2(); + break; + case 5: + spawnDemonBoss(); default: // Handle other wave scenarios if needed break; @@ -123,37 +256,27 @@ private void spawnWave() { public void create() { // Load game assets loadAllAssets(); + logger.info("Lol"); displayUI(); + logger.info("Lol"); spawnTerrain(); + logger.info("Lol"); // Set up infrastructure for end game tracking player = spawnPlayer(); - player.getEvents().addListener("spawnWave", this::spawnXenoGrunts); - + player.getEvents().addListener("spawnWave", this::spawnWave); playMusic(); - - // Types of projectile -// spawnAoeProjectile(new Vector2(0, 10), player, towardsMobs, new Vector2(2f, 2f), 1); - spawnProjectile(new Vector2(0, 10), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f)); - spawnMultiProjectile(new Vector2(0, 10), PhysicsLayer.NPC, towardsMobs, 20, new Vector2(2f, 2f), 7); - spawnEffectProjectile(new Vector2(0, 10), PhysicsLayer.HUMANS, towardsMobs, new Vector2(2f, 2f), ProjectileEffects.BURN, true); - spawnPierceFireBall(new Vector2(2, 3), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f)); - spawnRicochetFireball(new Vector2(2, 4), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f)); - spawnSplitFireWorksFireBall(new Vector2(2, 5), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), 12); - spawnEffectProjectile(new Vector2(2, 6), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), ProjectileEffects.SLOW, false); spawnXenoGrunts(); - spawnWeaponTower(); - //bossKing1 = spawnBossKing1(); startWaveTimer(); -// spawnIncome(); + spawnScrap(); + spawnDeflectXenoGrunt(15, 5); + spawnSplittingXenoGrunt(15, 4); spawnScrap(); spawnTNTTower(); - + spawnWeaponTower(); spawnGapScanners(); spawnDroidTower(); - bossKing2 = spawnBossKing2(); - } private void displayUI() { @@ -165,8 +288,8 @@ private void displayUI() { } private void spawnTerrain() { - // Background terrain - terrain = terrainFactory.createTerrain(TerrainType.FOREST_DEMO); + + terrain = terrainFactory.createTerrain(TerrainType.ALL_DEMO); spawnEntity(new Entity().addComponent(terrain)); // Terrain walls @@ -175,9 +298,11 @@ private void spawnTerrain() { Vector2 worldBounds = new Vector2(tileBounds.x * tileSize, tileBounds.y * tileSize); // Left - // ! THIS ONE DOESNT WORK. GRIDPOINTS2UTIL.ZERO is (0, 4), not (0, 0) spawnEntityAt( - ObstacleFactory.createWall(WALL_WIDTH, worldBounds.y), new GridPoint2(1, 0), false, false); + ObstacleFactory.createWall(WALL_WIDTH, worldBounds.y), + new GridPoint2(0, 2), + false, + false); // Right spawnEntityAt( ObstacleFactory.createWall(WALL_WIDTH, worldBounds.y), @@ -187,16 +312,18 @@ private void spawnTerrain() { // Top spawnEntityAt( ObstacleFactory.createWall(worldBounds.x, WALL_WIDTH * 7), - new GridPoint2(0, tileBounds.y - 1), + new GridPoint2(0, tileBounds.y), false, false); // Bottom - // spawnEntityAt( - // ObstacleFactory.createWall(worldBounds.x, WALL_WIDTH), GridPoint2Utils.ZERO, false, false); - // * TMPORARY spawnEntityAt( - ObstacleFactory.createWall(worldBounds.x, WALL_WIDTH * 7), new GridPoint2(0, 0), false, false); + ObstacleFactory.createWall(worldBounds.x, WALL_WIDTH ), + new GridPoint2(0, 2), + false, + false); } + + // private void spawnBuilding1() { // GridPoint2 minPos = new GridPoint2(0, 0); // GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); @@ -248,12 +375,10 @@ private void spawnBuilding2() { spawnEntityAt(building2, randomPos, true, false); } } - - + private Entity spawnPlayer() { Entity newPlayer = PlayerFactory.createPlayer(); spawnEntityAt(newPlayer, PLAYER_SPAWN, true, true); - newPlayer.addComponent(new TouchAttackComponent(PhysicsLayer.NPC)); return newPlayer; } @@ -277,7 +402,7 @@ private Entity spawnPlayer(GridPoint2 position) { // } // } -// private Entity spawnBossKing1() { +// private Entity spawnMobBoss1() { // GridPoint2 minPos = new GridPoint2(0, 0); // GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); // GridPoint2 randomPos @@ -287,19 +412,28 @@ private Entity spawnPlayer(GridPoint2 position) { // return ghostKing; // } + private void spawnDemonBoss() { + Entity demon = MobBossFactory.createDemonBoss(); + spawnEntityAt(demon, new GridPoint2(19, 5), true, false); + } + + private void spawnPatrick() { + Entity patrick = MobBossFactory.createPatrickBoss(2500); + spawnEntityAt(patrick, new GridPoint2(18, 5), true, false); + } - private Entity spawnBossKing1() { - int[] pickedLanes = new Random().ints(0, 8) + private Entity spawnMobBoss1() { + int[] pickedLanes = random.ints(0, 8) .distinct().limit(5).toArray(); - for (int i = 0; i < NUM_BOSSKING1; i++) { + for (int i = 0; i < NUM_MOBBOSS1; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); - bossKing1 = BossKingFactory.createBossKing1(player, pickedLanes[i]); - spawnEntityAt(bossKing1, + mobBoss1 = MobBossFactory.createMobBoss1(pickedLanes[i]); + spawnEntityAt(mobBoss1, randomPos, true, false); } - return bossKing1; + return mobBoss1; } @@ -344,170 +478,126 @@ private void spawnProjectile(Vector2 position, short targetLayer, int space, int Entity Projectile = ProjectileFactory.createFireBall(targetLayer, new Vector2(direction, position.y + space), speed); Projectile.setPosition(position); spawnEntity(Projectile); - } - - -// private Entity spawnBossKing() { -// for (int i = 0; i < NUM_BOSS; i++) { -// int fixedX = terrain.getMapBounds(0).x - 1; // Rightmost x-coordinate -// int randomY = MathUtils.random(0, maxPos.y); -// GridPoint2 randomPos = new GridPoint2(fixedX, randomY); -// bossKing1 = BossKingFactory.createBossKing1(player); -// spawnEntityAt(bossKing1, -// randomPos, -// true, -// false); -// } -// return bossKing1; -// -// } - + } private void spawnXenoGrunts() { - int[] pickedLanes = new Random().ints(1, 7) + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); - System.out.println(randomPos); - Entity xenoGrunt = NPCFactory.createXenoGrunt(player); + Entity xenoGrunt = NPCFactory.createXenoGrunt(); xenoGrunt.setScale(1.5f, 1.5f); spawnEntityAt(xenoGrunt, randomPos, true, false); } } -// private Entity spawnGhostKing() { -// GridPoint2 minPos = new GridPoint2(0, 0); -// GridPoint2 maxPos = terrain.getMapBounds(0).sub(0, 0); -// GridPoint2 randomPos -// = RandomUtils.random(minPos, maxPos); -// // = new GridPoint2(26, 26); -// Entity ghostKing = NPCFactory.createGhostKing(player); -// spawnEntityAt(ghostKing, randomPos, true, true); -// return ghostKing; -// -// } + // * TEMPORARY FOR TESTING + private void spawnSplittingXenoGrunt(int x, int y) { + GridPoint2 pos = new GridPoint2(x, y); + Entity xenoGrunt = NPCFactory.createSplittingXenoGrunt(); + xenoGrunt.setScale(1.5f, 1.5f); + spawnEntityAt(xenoGrunt, pos, true, true); + } -// private Entity spawnBossKing2() { -// GridPoint2 minPos = new GridPoint2(0, 0); -// GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); -// -// for (int i = 0; i < NUM_BOSS; i++) { -// int fixedX = terrain.getMapBounds(0).x - 1; // Rightmost x-coordinate -// int randomY = MathUtils.random(0, maxPos.y); -// GridPoint2 randomPos = new GridPoint2(fixedX, randomY); -// bossKing2 = BossKingFactory.createBossKing2(player); -// spawnEntityAt(bossKing2, -// randomPos, -// true, -// false); -// } -// return bossKing2; -// } + // * TEMPORARY FOR TESTING + private void spawnDodgingDragonKnight(int x, int y) { + GridPoint2 pos = new GridPoint2(x, y); + Entity fireworm = NPCFactory.createDodgingDragonKnight(); + fireworm.setScale(1.5f, 1.5f); + spawnEntityAt(fireworm, pos, true, true); + } + + // * TEMPORARY FOR TESTING + private void spawnDeflectXenoGrunt(int x, int y) { + GridPoint2 pos = new GridPoint2(x, y); + Entity xenoGrunt = NPCFactory.createDeflectXenoGrunt(); + xenoGrunt.setScale(1.5f, 1.5f); + spawnEntityAt(xenoGrunt, pos, true, true); + } - private Entity spawnBossKing2() { - int[] pickedLanes = new Random().ints(0, 8) + private void spawnFireWorm() { + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); - for (int i = 0; i < NUM_BOSSKING2; i++) { + for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); - bossKing2 = BossKingFactory.createBossKing2(player); - spawnEntityAt(bossKing2, - randomPos, - true, - false); + Entity fireWorm = NPCFactory.createFireWorm(); + fireWorm.setScale(1.5f, 1.5f); + spawnEntityAt(fireWorm, randomPos, true, false); } - return bossKing2; } - - /** - * Creates multiple projectiles that travel simultaneous. They all have same - * the starting point but different destinations. - * - * @param position The position of the Entity that's shooting the projectile. - * @param targetLayer The enemy layer of the "shooter". - * @param direction The direction the projectile should head towards. - * @param space The space between the projectiles' destination. - * @param speed The speed of the projectiles. - * @param quantity The amount of projectiles to spawn. - */ - private void spawnMultiProjectile(Vector2 position, short targetLayer, int direction, int space, Vector2 speed, int quantity) { - int half = quantity / 2; - for (int i = 0; i < quantity; i++) { - spawnProjectile(position, targetLayer, space * half, direction, speed); - --half; + + private void spawnSkeleton() { + int[] pickedLanes = new Random().ints(1, 7) + .distinct().limit(5).toArray(); + for (int i = 0; i < NUM_GRUNTS; i++) { + GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); + Entity skeleton = NPCFactory.createSkeleton(); + skeleton.setScale(1.5f, 1.5f); + spawnEntityAt(skeleton, randomPos, true, false); } } - - /** - * Returns projectile that can do an area of effect damage - * - * @param position The position of the Entity that's shooting the projectile. - * @param targetLayer The enemy layer of the "shooter". - * @param direction The direction the projectile should head towards. - * @param speed The speed of the projectiles. - * @param effect Type of effect. - * @param aoe Whether it is an aoe projectile. - */ - private void spawnEffectProjectile(Vector2 position, short targetLayer, int direction, Vector2 speed, - ProjectileEffects effect, boolean aoe) { - Entity Projectile = ProjectileFactory.createEffectProjectile(targetLayer, new Vector2(direction, position.y), speed, effect, aoe); - Projectile.setPosition(position); - spawnEntity(Projectile); + + private void spawnDragonKnight() { + int[] pickedLanes = random.ints(1, 7) + .distinct().limit(5).toArray(); + for (int i = 0; i < NUM_GRUNTS; i++) { + GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); + Entity fireWorm = NPCFactory.createDragonKnight(); + fireWorm.setScale(1.5f, 1.5f); + spawnEntityAt(fireWorm, randomPos, true, false); + } } - - /** - * Spawns a pierce fireball. - * Pierce fireball can go through targetlayers without disappearing but damage - * will still be applied. - * - * @param position The position of the Entity that's shooting the projectile. - * @param targetLayer The enemy layer of the "shooter". - * @param direction The direction the projectile should head towards. - * @param speed The speed of the projectiles. - */ - private void spawnPierceFireBall(Vector2 position, short targetLayer, int direction, Vector2 speed) { - Entity projectile = ProjectileFactory.createPierceFireBall(targetLayer, new Vector2(direction, position.y), speed); - projectile.setPosition(position); - spawnEntity(projectile); + + private void spawnWizard() { + int[] pickedLanes = new Random().ints(1, 7) + .distinct().limit(5).toArray(); + for (int i = 0; i < NUM_GRUNTS; i++) { + GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); + Entity wizard = NPCFactory.createWizard(); + wizard.setScale(1.5f, 1.5f); + spawnEntityAt(wizard, randomPos, true, false); + } } - - /** - * Spawns a ricochet fireball - * Ricochet fireballs bounce off targets with a specified maximum count of 3 - * Possible extensions: Make the bounce count flexible with a param. - * - * @param position The position of the Entity that's shooting the projectile. - * @param targetLayer The enemy layer of the "shooter". - * @param direction The direction the projectile should head towards. - * @param speed The speed of the projectiles. - */ - private void spawnRicochetFireball(Vector2 position, short targetLayer, int direction, Vector2 speed) { - // Bounce count set to 0. - Entity projectile = ProjectileFactory.createRicochetFireball(targetLayer, new Vector2(direction, position.y), speed, 0); - projectile.setPosition(position); - spawnEntity(projectile); + + private void spawnWaterQueen() { + int[] pickedLanes = new Random().ints(1, 7) + .distinct().limit(5).toArray(); + for (int i = 0; i < NUM_GRUNTS; i++) { + GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); + Entity waterQueen = NPCFactory.createWaterQueen(); + waterQueen.setScale(1.5f, 1.5f); + spawnEntityAt(waterQueen, randomPos, true, false); + } } - - /** - * Spawns a split firework fireball. - * Splits into mini projectiles that spreads out after collision. - * - * @param position The position of the Entity that's shooting the projectile. - * @param targetLayer The enemy layer of the "shooter". - * @param direction The direction the projectile should head towards. - * @param speed The speed of the projectiles. - * @param amount The amount of projectiles appearing after collision. - */ - private void spawnSplitFireWorksFireBall(Vector2 position, short targetLayer, int direction, Vector2 speed, int amount) { - Entity projectile = ProjectileFactory.createSplitFireWorksFireball(targetLayer, new Vector2(direction, position.y), speed, amount); - projectile.setPosition(position); - spawnEntity(projectile); + + private void spawnWaterSlime() { + int[] pickedLanes = new Random().ints(1, 7) + .distinct().limit(5).toArray(); + for (int i = 0; i < NUM_GRUNTS; i++) { + GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); + Entity waterSlime = NPCFactory.createWaterSlime(); + waterSlime.setScale(1.5f, 1.5f); + spawnEntityAt(waterSlime, randomPos, true, false); + } } + +// private Entity spawnGhostKing() { +// GridPoint2 minPos = new GridPoint2(0, 0); +// GridPoint2 maxPos = terrain.getMapBounds(0).sub(0, 0); +// GridPoint2 randomPos +// = RandomUtils.random(minPos, maxPos); +// // = new GridPoint2(26, 26); +// Entity ghostKing = NPCFactory.createGhostKing(player); +// spawnEntityAt(ghostKing, randomPos, true, true); +// return ghostKing; +// +// } private void spawnWeaponTower() { - GridPoint2 minPos = new GridPoint2(0, 0); + GridPoint2 minPos = new GridPoint2(0, 2); GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); - - for (int i = 0; i < NUM_WEAPON_TOWERS; i++) { + + for (int i = 0; i < NUM_WEAPON_TOWERS + 10; i++) { GridPoint2 randomPos1 = RandomUtils.random(minPos, maxPos); GridPoint2 randomPos2 = RandomUtils.random(minPos, maxPos); Entity wallTower = TowerFactory.createWallTower(); @@ -517,9 +607,23 @@ private void spawnWeaponTower() { spawnEntityAt(stunTower, randomPos2, true, true); } } + + // * TEMPORARY FOR TESTING + private void spawnFireTowerTowerAt(int x, int y) { + GridPoint2 pos = new GridPoint2(x, y); + Entity fireTower = TowerFactory.createFireTower(); + + spawnEntityAt(fireTower, pos, true, true); + } + private void spawnDroidTowerAt(int x, int y) { + GridPoint2 pos = new GridPoint2(x, y); + Entity droidTower = TowerFactory.createDroidTower(); + + spawnEntityAt(droidTower, pos, true, true); + } private void spawnTNTTower() { - GridPoint2 minPos = new GridPoint2(0, 0); + GridPoint2 minPos = new GridPoint2(0, 2); GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); for (int i = 0; i < NUM_WEAPON_TOWERS; i++) { @@ -531,7 +635,7 @@ private void spawnTNTTower() { } private void spawnDroidTower() { - GridPoint2 minPos = new GridPoint2(0, 0); + GridPoint2 minPos = new GridPoint2(0, 2); GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); for (int i = 0; i < NUM_WEAPON_TOWERS; i++) { diff --git a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java index 0f087d6fd..d6377e4a1 100644 --- a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java +++ b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java @@ -1,40 +1,24 @@ package com.csse3200.game.areas.terrain; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.OrthographicCamera; -import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TiledMapRenderer; import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell; import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; -import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; import com.badlogic.gdx.math.GridPoint2; -import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; -import com.badlogic.gdx.utils.viewport.ScreenViewport; -import com.badlogic.gdx.utils.viewport.Viewport; -import com.csse3200.game.areas.terrain.TerrainComponent.TerrainOrientation; import com.csse3200.game.components.CameraComponent; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import com.csse3200.game.screens.GameLevelData; -import static com.csse3200.game.screens.MainGameScreen.viewportHeight; -import static com.csse3200.game.screens.MainGameScreen.viewportWidth; /** Factory for creating game terrains. */ public class TerrainFactory { - public static final GridPoint2 MAP_SIZE = new GridPoint2(20, 8); - private static OrthographicCamera camera; - private final TerrainOrientation orientation; - private static Stage stage; - private Texture whiteTexture; - int selectedLevel = GameLevelData.getSelectedLevel(); + + private final OrthographicCamera camera; + private final TerrainComponent.TerrainOrientation orientation; /** * Create a terrain factory with Orthogonal orientation @@ -42,19 +26,7 @@ public class TerrainFactory { * @param cameraComponent Camera to render terrains to. Must be ortographic. */ public TerrainFactory(CameraComponent cameraComponent) { - this(cameraComponent, TerrainOrientation.ORTHOGONAL); - camera.position.set(viewportWidth / 2f, (viewportHeight / 2f), 10); - Viewport viewport = new ScreenViewport(camera); - viewport.update(viewportWidth, viewportHeight, true); - stage = new Stage(viewport, new SpriteBatch()); - - camera.update(); - - Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); - pixmap.setColor(1, 1, 1, 1); - pixmap.fill(); - whiteTexture = new Texture(pixmap); - pixmap.dispose(); + this(cameraComponent, TerrainComponent.TerrainOrientation.ORTHOGONAL); } /** @@ -63,39 +35,52 @@ public TerrainFactory(CameraComponent cameraComponent) { * @param cameraComponent Camera to render terrains to. Must be orthographic. * @param orientation orientation to render terrain at */ - public TerrainFactory(CameraComponent cameraComponent, TerrainOrientation orientation) { + public TerrainFactory(CameraComponent cameraComponent, TerrainComponent.TerrainOrientation orientation) { this.camera = (OrthographicCamera) cameraComponent.getCamera(); this.orientation = orientation; } /** - * Create a terrain of the given type, using the orientation of the factory. This can be extended - * to add additional game terrains. - * + * Create a terrain of the given type, using the orientation of the factory. + * This can be extended to add additional game terrains. * @param terrainType Terrain to create * @return Terrain component which renders the terrain */ public TerrainComponent createTerrain(TerrainType terrainType) { ResourceService resourceService = ServiceLocator.getResourceService(); switch (terrainType) { - case FOREST_DEMO: - TextureRegion orthoGrass = + case ALL_DEMO: + TextureRegion orthogonal = new TextureRegion(resourceService.getAsset("images/terrain_use.png", Texture.class)); - return createForestDemoTerrain(1f, orthoGrass); - + return createTerrain(1f, orthogonal); default: return null; } } - private TerrainComponent createForestDemoTerrain( - float tileWorldSize, TextureRegion grass) { - GridPoint2 tilePixelSize = new GridPoint2(grass.getRegionWidth(), grass.getRegionHeight()); - TiledMap tiledMap = createForestDemoTiles(tilePixelSize, grass); + /** + * Creates and returns a terrain component . + * + * @param tileWorldSize The world size of a tile. + * @param terrain The texture region representing grass. + * @return A TerrainComponent instance representing the created terrain. + */ + + private TerrainComponent createTerrain(float tileWorldSize, TextureRegion terrain) { + GridPoint2 tilePixelSize = new GridPoint2(terrain.getRegionWidth(), terrain.getRegionHeight()); + TiledMap tiledMap = createTiles(tilePixelSize, terrain); TiledMapRenderer renderer = createRenderer(tiledMap, tileWorldSize / tilePixelSize.x); return new TerrainComponent(camera, tiledMap, renderer, orientation, tileWorldSize); } + /** + * Creates and returns a renderer for the provided tiled map and scale. + * + * @param tiledMap The tiled map for which the renderer is created. + * @param tileScale The scale factor for the tiles. + * @return A TiledMapRenderer instance suitable for the given map and scale. + */ + private TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) { switch (orientation) { case ORTHOGONAL: @@ -105,235 +90,43 @@ private TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) { } } - private TiledMap createForestDemoTiles(GridPoint2 tileSize, TextureRegion grass) { + /** + * Creates a tiled map filled with forest demo tiles using the provided grass texture. + * + * @param tileSize The dimensions (width and height) of a tile in pixels. + * @param terrain The texture region representing grass. + * @return A TiledMap instance representing the created map. + */ + private TiledMap createTiles(GridPoint2 tileSize, TextureRegion terrain) { TiledMap tiledMap = new TiledMap(); - /** - * Creates a background layer for a tiled map with the specified dimensions and tile size. - * - * @param width The width of the layer in tiles. - * @param height The height of the layer in tiles. - * @param tileWidth The width of each individual tile in pixels. - * @param tileHeight The height of each individual tile in pixels. - */ - // Create a background layer - TiledMapTileLayer backgroundLayer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y); - /** - * Define a TextureRegion to be used as the background texture. - */ - - TextureRegion backgroundTextureRegion ; - - switch (selectedLevel) { - case 0: // Desert - backgroundTextureRegion = new TextureRegion(ServiceLocator.getResourceService().getAsset("images/desert_bg.png", Texture.class)); - break; - case 1: // Ice - backgroundTextureRegion = new TextureRegion(ServiceLocator.getResourceService().getAsset("images/ice_bg.png", Texture.class)); - break; - case 2: // Lava - backgroundTextureRegion = new TextureRegion(ServiceLocator.getResourceService().getAsset("images/lava_bg.png", Texture.class)); - break; - default: - // Use a default background for other levels or planets - backgroundTextureRegion = new TextureRegion(ServiceLocator.getResourceService().getAsset("images/desert_bg.png", Texture.class)); - break; - } - /** - * Creates a single cell with the specified background texture region and adds it to the background layer - * of a tiled map. The background layer represents the entire background image of the map. - * - * @param backgroundTextureRegion The TextureRegion to use as the background texture. - * @param tileSizeX The width of each individual tile in pixels. - * @param tileSizeY The height of each individual tile in pixels. - * @param tiledMap The TiledMap to which the background layer should be added. - */ - Cell cell = new Cell(); - cell.setTile(new StaticTiledMapTile(backgroundTextureRegion)); - backgroundLayer.setCell(0, 0, cell); - - tiledMap.getLayers().add(backgroundLayer); - - /** - * Creates a grass layer for the tiled map with the specified dimensions and tile size, filling it with - * grass tiles using the provided grass terrain tile. - * - * @param tileSizeX The width of each individual tile in pixels. - * @param tileSizeY The height of each individual tile in pixels. - * @param grassTile The TerrainTile representing the grass tile to be used for the layer. - * @param tiledMap The TiledMap to which the grass layer should be added. - */ - TerrainTile grassTile = new TerrainTile(grass); - TiledMapTileLayer grassLayer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y); - fillTiles(grassLayer, new GridPoint2(20, 8), grassTile); - tiledMap.getLayers().add(grassLayer); - - /** - * Creates lanes of invisible tiles in the TiledMap. These lanes are added as separate layers - * and are typically used for gameplay purposes. - * - * @param tiledMap The TiledMap to which the lanes should be added. - * @param tileSize The size of each tile in pixels (width and height). - * @param numberOfLanes The total number of lanes to create. - * @param mapWidth The width of the TiledMap in tiles. - * @param mapHeight The height of the TiledMap in tiles. - * @return The modified TiledMap with the added invisible lanes. - */ - int numberOfLanes = 8; - int laneHeight = 1; // Height of each lane in tiles - int mapWidth = 20; - int mapHeight = 8; - int laneTileHeight = mapHeight / numberOfLanes; - - for (int i = 0; i < numberOfLanes; i++) { - TiledMapTileLayer laneLayer = new TiledMapTileLayer(mapWidth, laneHeight, tileSize.x, tileSize.y); - fillInvisibleTiles(laneLayer, new GridPoint2(mapWidth, laneHeight)); - tiledMap.getLayers().add(laneLayer); - } + TerrainTile Tile = new TerrainTile(terrain); + TiledMapTileLayer Layer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y); + fillInvisibleTiles(Layer, new GridPoint2(20, 8), Tile); + tiledMap.getLayers().add(Layer); return tiledMap; } + /** - * Fills a TiledMapTileLayer with invisible tiles, creating a lgaayer of transparent tiles. + * Fills the provided tile layer with invisible tiles to create a transparent layer. * - * @param layer The TiledMapTileLayer to fill with invisible tiles. - * @param mapSize The size of the layer in tiles (width and height). + * @param layer The tile layer to fill. + * @param mapSize The size of the map in tiles. + * @param tile The tile used to fill the layer. */ - private void fillInvisibleTiles(TiledMapTileLayer layer, GridPoint2 mapSize) { - for (int x = 0; x < mapSize.x; x++) { - for (int y = 0; y < mapSize.y; y++) { - Cell cell = new Cell(); - // Set an invisible tile (using a transparent texture) - StaticTiledMapTile invisibleTile = new StaticTiledMapTile(new TextureRegion(whiteTexture)); - cell.setTile(invisibleTile); - layer.setCell(x, y, cell); - } - } - } - -//tile class - public static class Tile { - private int row; - private int col; - private Object object; - - public Tile(int row, int col) { - this.row = row; - this.col = col; - this.object = null; // Initially, no object is placed on the tile - } - - public void setObject(Object object) { - this.object = object; - } - - public Object getObject() { - return object; - } - - public String getLogCoordinates() { - return "(" + row + ", " + col + ")"; - } - } - -// grid class -public static class Grid { - private Tile[][] tiles; - - public Grid(int numRows, int numCols) { - tiles = new Tile[numRows][numCols]; - - for (int row = 0; row < numRows; row++) { - for (int col = 0; col < numCols; col++) { - tiles[row][col] = new Tile(row,col); - } - } - } - - public void placeObject(int row, int col, Object object) { - if (isValidCoordinate(row, col)) { - tiles[row][col].setObject(object); - } else { - System.out.println("Invalid coordinates."); - } - } - - public Object getObject(int row, int col) { - if (isValidCoordinate(row, col)) { - return tiles[row][col].getObject(); - } else { - System.out.println("Invalid coordinates."); - return null; - } - } - - public String getLogCoordinates(int row, int col) { - if (isValidCoordinate(row, col)) { - return tiles[row][col].getLogCoordinates(); - } else { - return "Invalid coordinates."; - } - } - - private boolean isValidCoordinate(int row, int col) { - return row >= 0 && row < tiles.length && col >= 0 && col < tiles[0].length; - } - - public void placeEntity(int row, int col, Object existingEntity) { - } - - public Object getEntity(int row, int col) { - return null; - } -} - -// Array class 1+2 -public class Array { - public static void main(String[] args) { - int numRows = 8; - int numCols = 20; - - Grid grid = new Grid(numRows, numCols); - - // Place an existing entity in a specific tile - int row = 3; - int col = 5; - // Replace 'Object' with the type of existing entity you want to place - Object existingEntity = new YourExistingEntity(); - - grid.placeEntity(row, col, existingEntity); - - // Get the entity from a tile - Object entity = grid.getEntity(row, col); - System.out.println("Entity at " + grid.getLogCoordinates(row, col) + ": " + entity); - } - - private static class YourExistingEntity { - } -} - - - - - - private static void fillTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TerrainTile tile) { - BitmapFont font = new BitmapFont(); - TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); - textButtonStyle.font = font; - textButtonStyle.fontColor = Color.WHITE; + private void fillInvisibleTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TerrainTile tile) { for (int x = 0; x < mapSize.x; x++) { - for (int y = 0; y < mapSize.y; y++) { + for (int y = 2; y < mapSize.y; y++) { Cell cell = new Cell(); cell.setTile(tile); layer.setCell(x, y, cell); - TextButton button = new TextButton("" + x + y * 20, textButtonStyle); - stage.addActor(button); } } } public enum TerrainType { - FOREST_DEMO + ALL_DEMO } } diff --git a/source/core/src/main/com/csse3200/game/components/CombatStatsComponent.java b/source/core/src/main/com/csse3200/game/components/CombatStatsComponent.java index cdf8bacbe..aa5ccc5d5 100644 --- a/source/core/src/main/com/csse3200/game/components/CombatStatsComponent.java +++ b/source/core/src/main/com/csse3200/game/components/CombatStatsComponent.java @@ -6,8 +6,6 @@ import com.csse3200.game.entities.configs.ProjectileConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - import java.util.ArrayList; import java.util.Currency; import java.util.Random; @@ -41,6 +39,7 @@ public class CombatStatsComponent extends Component { private ArrayList drops; private ArrayList closeRangeAbilities; private ArrayList longRangeAbilities; //TODO change String to Projectiles + private Random rand = new Random(); public CombatStatsComponent(int health, int baseAttack) { setHealth(health); @@ -171,10 +170,9 @@ public void hit(CombatStatsComponent attacker) { } /** - * pick a random number from range 0 to the size of the list provided - * */ + * Picks a random number from range 0 to the size of the list provided. + */ public int pickRandom(ArrayList pickFrom) { - Random rand = new Random(); return rand.nextInt(pickFrom.size()); } diff --git a/source/core/src/main/com/csse3200/game/components/CostComponent.java b/source/core/src/main/com/csse3200/game/components/CostComponent.java index 43cbcbfe1..6d7e5fbeb 100644 --- a/source/core/src/main/com/csse3200/game/components/CostComponent.java +++ b/source/core/src/main/com/csse3200/game/components/CostComponent.java @@ -1,15 +1,10 @@ package com.csse3200.game.components; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * Component used to store information related to cost. * Any entities that necessitate a cost should register an instance of this class. */ public class CostComponent extends Component { - - private int cost; public CostComponent(int cost) { diff --git a/source/core/src/main/com/csse3200/game/components/DeleteOnMapEdgeComponent.java b/source/core/src/main/com/csse3200/game/components/DeleteOnMapEdgeComponent.java index 4359c118d..2e6243828 100644 --- a/source/core/src/main/com/csse3200/game/components/DeleteOnMapEdgeComponent.java +++ b/source/core/src/main/com/csse3200/game/components/DeleteOnMapEdgeComponent.java @@ -5,6 +5,8 @@ import com.csse3200.game.entities.Entity; import com.csse3200.game.physics.BodyUserData; import com.csse3200.game.physics.PhysicsLayer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Entities with this component will self destruct after hitting the grid edge @@ -12,6 +14,8 @@ */ public class DeleteOnMapEdgeComponent extends Component { + private static final Logger logger = LoggerFactory.getLogger(DeleteOnMapEdgeComponent.class); + @Override public void create() { entity.getEvents().addListener("collisionEnd", this::onCollisionEnd); @@ -27,7 +31,7 @@ private void onCollisionEnd(Fixture me, Fixture other) { Vector2 position = selfEntity.getPosition(); if (position.x <= 1 || position.x >= 18 || position.y < 0 || position.y >= 6.5) { - System.out.println("DELETION POSITION: " + position); + logger.debug("DELETION POSITION: " + position); selfEntity.setFlagForDelete(true); } } diff --git a/source/core/src/main/com/csse3200/game/components/EffectsComponent.java b/source/core/src/main/com/csse3200/game/components/EffectsComponent.java index 76314fd87..10b8806a5 100644 --- a/source/core/src/main/com/csse3200/game/components/EffectsComponent.java +++ b/source/core/src/main/com/csse3200/game/components/EffectsComponent.java @@ -74,8 +74,6 @@ private void onCollisionEnd(Fixture me, Fixture other) { return; } - System.out.println("target layer: " + otherEntity.getLayer()); - // Apply effect if (effect == ProjectileEffects.FIREBALL) { if (aoe) { diff --git a/source/core/src/main/com/csse3200/game/components/MobProjectileAnimationController.java b/source/core/src/main/com/csse3200/game/components/MobProjectileAnimationController.java new file mode 100644 index 000000000..e1a55775e --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/MobProjectileAnimationController.java @@ -0,0 +1,23 @@ +package com.csse3200.game.components; + +import com.csse3200.game.rendering.AnimationRenderComponent; + + +public class MobProjectileAnimationController extends Component { + AnimationRenderComponent animator; + + /** + * Creation call for a TowerAnimationController, fetches the animationRenderComponent that this controller will + * be attached to and registers all the event listeners required to trigger the animations and sounds. + */ + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("rotate", this::animateStartRotate); + } + + void animateStartRotate() { + animator.startAnimation("rotate"); + } +} diff --git a/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java b/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java index 6527271e8..c8a578d88 100644 --- a/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java +++ b/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java @@ -60,7 +60,7 @@ private void onCollisionEnd(Fixture me, Fixture other) { // * RIGHT NOW TARGET IS NPC, SUBJECT TO CHANGE // Speed is a bit faster than normal but can change. Entity newProjectile = ProjectileFactory.createFireworks(PhysicsLayer.NPC, - new Vector2(100, projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2))), new Vector2(3f, 3f)); + new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2)))), new Vector2(3f, 3f)); newProjectile.setPosition(newXPosition, (float) projectile.getPosition().y); diff --git a/source/core/src/main/com/csse3200/game/components/TouchAttackComponent.java b/source/core/src/main/com/csse3200/game/components/TouchAttackComponent.java index 80c93f434..46ef5ebc9 100644 --- a/source/core/src/main/com/csse3200/game/components/TouchAttackComponent.java +++ b/source/core/src/main/com/csse3200/game/components/TouchAttackComponent.java @@ -3,6 +3,7 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.Fixture; +import com.csse3200.game.components.npc.DeflectingComponent; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.Weapon; import com.csse3200.game.physics.BodyUserData; @@ -11,12 +12,17 @@ import com.csse3200.game.physics.components.PhysicsComponent; /** - * When this entity touches a valid enemy's hitbox, deal damage to them and apply a knockback. - * Has an optional disposeOnHit property that disposes projectile upon collision. + * When this entity touches a valid enemy's hitbox, deal damage to them and + * apply a knockback. + * Has an optional disposeOnHit property that disposes projectile upon + * collision. * - *

Requires CombatStatsComponent, HitboxComponent on this entity. + *

+ * Requires CombatStatsComponent, HitboxComponent on this entity. * - *

Damage is only applied if target entity has a CombatStatsComponent. Knockback is only applied + *

+ * Damage is only applied if target entity has a CombatStatsComponent. Knockback + * is only applied * if target entity has a PhysicsComponent. */ public class TouchAttackComponent extends Component { @@ -29,6 +35,7 @@ public class TouchAttackComponent extends Component { /** * Create a component which attacks entities on collision, without knockback. + * * @param targetLayer The physics layer of the target's collider. */ public TouchAttackComponent(short targetLayer) { @@ -37,8 +44,9 @@ public TouchAttackComponent(short targetLayer) { /** * Create a component which attacks entities on collision, with knockback. + * * @param targetLayer The physics layer of the target's collider. - * @param knockback The magnitude of the knockback applied to the entity. + * @param knockback The magnitude of the knockback applied to the entity. */ public TouchAttackComponent(short targetLayer, float knockback) { this.targetLayer = targetLayer; @@ -46,9 +54,11 @@ public TouchAttackComponent(short targetLayer, float knockback) { } /** - * Create a component which attacks entities on collision, with knockback and self-dispose. - * @param targetLayer The physics layer of the target's collider. - * @param knockback The magnitude of the knockback applied to the entity. + * Create a component which attacks entities on collision, with knockback and + * self-dispose. + * + * @param targetLayer The physics layer of the target's collider. + * @param knockback The magnitude of the knockback applied to the entity. * @param disposeOnHit Whether this entity should be disposed on hit. */ public TouchAttackComponent(short targetLayer, float knockback, boolean disposeOnHit) { @@ -78,14 +88,21 @@ public void onCollisionStart(Fixture me, Fixture other) { // Try to attack target. Entity target = ((BodyUserData) other.getBody().getUserData()).entity; + + // If enemy has deflecting component, don't delete it. + Component deflectComponent = target.getComponent(DeflectingComponent.class); + if (deflectComponent != null && deflectComponent.enabled) + return; + CombatStatsComponent targetStats = target.getComponent(CombatStatsComponent.class); if (targetStats != null) { - // If entity has abilities, pick one at random and apply it else use baseAttack damage - if (combatStats.getWeapon(target) != null) { - targetStats.hit(combatStats.getWeapon(target).getDamage()); - } else { - targetStats.hit(combatStats.getBaseAttack()); - } + // If entity has abilities, pick one at random and apply it else use baseAttack + // damage + if (combatStats.getWeapon(target) != null) { + targetStats.hit(combatStats.getWeapon(target).getDamage()); + } else { + targetStats.hit(combatStats.getBaseAttack()); + } } // Apply knockback PhysicsComponent physicsComponent = target.getComponent(PhysicsComponent.class); @@ -106,7 +123,6 @@ public void setDisposeOnHit(boolean disposeOnHit) { this.disposeOnHit = disposeOnHit; } - public void setKnockBack(float knockback) { this.knockbackForce = knockback; } @@ -123,6 +139,12 @@ private void onCollisionEnd(Fixture me, Fixture other) { return; } + Entity otherEntity = ((BodyUserData) other.getBody().getUserData()).entity; + + // If enemy has enabled deflection component, don't dispose it. + if (otherEntity.getComponent(DeflectingComponent.class) != null) + return; + if (disposeOnHit) { Entity projectile = ((BodyUserData) me.getBody().getUserData()).entity; projectile.setFlagForDelete(true); @@ -138,5 +160,13 @@ public Weapon chooseWeapon(Fixture other) { return weapon; } + /** + * Sets the target layer of this component, changing which entity to "attack" + * and/or apply knockback to. + * + * @param targetLayer + */ + public void setTargetLayer(short targetLayer) { + this.targetLayer = targetLayer; + } } - diff --git a/source/core/src/main/com/csse3200/game/components/bosses/DemonAnimationController.java b/source/core/src/main/com/csse3200/game/components/bosses/DemonAnimationController.java new file mode 100644 index 000000000..764b415a4 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/bosses/DemonAnimationController.java @@ -0,0 +1,44 @@ +package com.csse3200.game.components.bosses; + +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; + +public class DemonAnimationController extends Component { + AnimationRenderComponent animator; + + /** + * Creation call for a DemonAnimationController, fetches the animationRenderComponent that this controller will + * be attached to and registers all the event listeners required to trigger the animations and sounds. + */ + @Override + public void create() { + super.create(); + animator = entity.getComponent(AnimationRenderComponent.class); + registerAnimationListener("demon_walk"); + registerAnimationListener("demon_cleave"); + registerAnimationListener("demon_take_hit"); + registerAnimationListener("demon_idle"); + registerAnimationListener("demon_death"); + registerAnimationListener("demon_cast_spell"); + registerAnimationListener("demon_fire_breath"); + registerAnimationListener("demon_smash"); + registerAnimationListener("demon_take_hit"); + registerAnimationListener("idle"); + registerAnimationListener("move"); + registerAnimationListener("projectile_explosion"); + registerAnimationListener("projectile_idle"); + registerAnimationListener("take_hit"); + registerAnimationListener("transform"); + registerAnimationListener("transform_reverse"); + } + + private void registerAnimationListener(String animationName) { + if (animationName.equals("transform_reverse")) { + entity.getEvents().addListener(animationName, () -> + animator.startAnimation("transform")); + } else { + entity.getEvents().addListener(animationName, () -> + animator.startAnimation(animationName)); + } + } +} diff --git a/source/core/src/main/com/csse3200/game/components/bosses/PatrickAnimationController.java b/source/core/src/main/com/csse3200/game/components/bosses/PatrickAnimationController.java new file mode 100644 index 000000000..597e6235a --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/bosses/PatrickAnimationController.java @@ -0,0 +1,30 @@ +package com.csse3200.game.components.bosses; + +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; + +public class PatrickAnimationController extends Component { + AnimationRenderComponent animator; + + /** + * Creation call for a DemonAnimationController, fetches the animationRenderComponent that this controller will + * be attached to and registers all the event listeners required to trigger the animations and sounds. + */ + @Override + public void create() { + super.create(); + animator = entity.getComponent(AnimationRenderComponent.class); + registerAnimationListener("patrick_attack"); + registerAnimationListener("patrick_cast"); + registerAnimationListener("patrick_death"); + registerAnimationListener("patrick_hurt"); + registerAnimationListener("patrick_idle"); + registerAnimationListener("patrick_spell"); + registerAnimationListener("patrick_walk"); + } + + private void registerAnimationListener(String animationName) { + entity.getEvents().addListener(animationName, () -> + animator.startAnimation(animationName)); + } +} \ No newline at end of file diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java index 0b9703a39..5f3a12996 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/CurrencyDisplay.java @@ -1,16 +1,13 @@ package com.csse3200.game.components.gamearea; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; -import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; -import com.badlogic.gdx.scenes.scene2d.Action; import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Table; @@ -18,7 +15,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.Drawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.utils.Align; -import com.csse3200.game.entities.Entity; import com.csse3200.game.services.ServiceLocator; import com.csse3200.game.ui.UIComponent; import com.badlogic.gdx.scenes.scene2d.actions.Actions; diff --git a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java index 27ace6b42..83582470b 100644 --- a/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/gamearea/GameAreaDisplay.java @@ -6,24 +6,13 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; -import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.*; -import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; -import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; -import com.badlogic.gdx.scenes.scene2d.utils.Drawable; -import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; -import com.badlogic.gdx.utils.Null; -import com.csse3200.game.components.maingame.MainGameExitDisplay; import com.csse3200.game.ui.UIComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.badlogic.gdx.scenes.scene2d.ui.Dialog; -import com.badlogic.gdx.scenes.scene2d.ui.Table; - -import java.util.concurrent.TimeUnit; /** * Displays the name of the current game area. diff --git a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java index 39b132139..d8c3faebc 100644 --- a/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java +++ b/source/core/src/main/com/csse3200/game/components/maingame/UIElementsDisplay.java @@ -28,7 +28,7 @@ public void create() { private void addActors() { table = new Table(); - table.top().right(); + table.top(); table.setFillParent(true); TextButton remainingMobsButton = new ButtonFactory().createButton("Remaining mobs:"); @@ -44,8 +44,8 @@ public void changed(ChangeEvent changeEvent, Actor actor) { } }); - table.add(remainingMobsButton).padTop(0f).padRight(10f); - table.add(testSlider).padTop(90).padRight(10f); + table.add(remainingMobsButton).padTop(0f).padRight(100f); + table.add(testSlider).padTop(10).padRight(10f); stage.addActor(table); } diff --git a/source/core/src/main/com/csse3200/game/components/npc/DeflectingComponent.java b/source/core/src/main/com/csse3200/game/components/npc/DeflectingComponent.java new file mode 100644 index 000000000..8ebd3c50a --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/DeflectingComponent.java @@ -0,0 +1,123 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.physics.box2d.Fixture; +import com.csse3200.game.ai.tasks.AITaskComponent; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.Component; +import com.csse3200.game.components.TouchAttackComponent; +import com.csse3200.game.components.tasks.TrajectTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.physics.BodyUserData; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.HitboxComponent; +import com.csse3200.game.physics.components.PhysicsMovementComponent; + +/** + * A component that deflects incoming projectiles a set amount of projectile + * collision events. + * + * The target layer to be deflected is flexible, meaning it can deflect other + * entities as well, including but not limited to it's own target layer. + *

+ * This class assumes the projectile has only a TrajectTask. If there are + * multiple tasks, the other tasks will be disposed. + *

+ */ +public class DeflectingComponent extends Component { + private short targetLayer; + private short dmgLayer; + private HitboxComponent hitboxComponent; + private int deflectLimitAmount; + private int maxHealth; + + /** + * Initialise a Deflecting component that deflects projectile, reversing the + * incoming direcition of the entity. Any effects, such as damage, will be + * negated when deflected. + * + * The projectile's damage target layer will also be changed. + * + * @param targetLayer Target layer to deflect on + * @param dmgLayer Target layer for the projectile to hit. + * @param deflectLimitAmount Amount of deflections to occur for the disabling of + * this component. + */ + public DeflectingComponent(short targetLayer, short dmgLayer, + int deflectLimitAmount) { + this.targetLayer = targetLayer; + this.dmgLayer = dmgLayer; + this.deflectLimitAmount = deflectLimitAmount; // Assumes deflect amount > 0. + } + + @Override + public void create() { + entity.getEvents().addListener("collisionStart", this::deflectProj); + System.out.println("CREATED"); + hitboxComponent = entity.getComponent(HitboxComponent.class); + maxHealth = entity.getComponent(CombatStatsComponent.class) + .getMaxHealth(); + } + + @Override + public void update() { + resetHealth(); + } + + /** + * Deflects projectile to the opposite direction + * @param me Self entity fixture + * @param other Colliding projectile fixture. + */ + private void deflectProj(Fixture me, Fixture other) { + // If self fixture does not match or the colliding target + if (hitboxComponent.getFixture() != me + || !PhysicsLayer.contains(targetLayer, other.getFilterData().categoryBits)) + return; + + if (deflectLimitAmount-- <= 0) { + entity.getComponent(this.getClass()).setEnabled(false); + // reset health + resetHealth(); + return; + } + + // Obtain projectile entity. + Entity projectile = ((BodyUserData) other.getBody().getUserData()).entity; + + // projectile.getComponent(TouchAttackComponent.class).setEnabled(false); + + // Disposes all tasks for the curr projectile. At this curr time, it assumes + // projectile only has one significant task, and that is the TrajectTask. + projectile.getComponent(AITaskComponent.class).disposeAll(); + + // Obtain current direction of projectile + Vector2 direction = projectile.getComponent( + PhysicsMovementComponent.class).getTarget(); + + // Add new traject task with the target in the opposite x-direction. + projectile.getComponent(AITaskComponent.class) + .addTask(new TrajectTask(new Vector2(-direction.x, direction.y))); + + // Reverse visual image of projectile + Vector2 scale = projectile.getScale(); + projectile.setScale(-scale.x, scale.y); + + // Change target layer of projectile. + projectile.getComponent(TouchAttackComponent.class) + .setTargetLayer(dmgLayer); + + // Make sure projectile is not deleted in the next frame. + projectile.setFlagForDelete(false); + + // Reset health + resetHealth(); + } + + /** + * Reverses the entity's health ater each subsequent collisions. + */ + private void resetHealth() { + entity.getComponent(CombatStatsComponent.class).setHealth(maxHealth); + } +} diff --git a/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java b/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java new file mode 100644 index 000000000..bada67e3c --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java @@ -0,0 +1,146 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.components.Component; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.components.PhysicsMovementComponent; +import com.csse3200.game.physics.raycast.RaycastHit; +import com.csse3200.game.services.ServiceLocator; + +/** + * A component that adds a dodging event listener to the current attached + * entity. The entity will dodge another entity that is presumably coming at its + * current position. It will dodge at a certain angle in the vertical direction + * with an altered speed. + *

+ * This component handles the detection of a certain mob layer within a certain + * horizontal range using a raycast. It also handles the vertical speed doding + * configuration. + *

+ * + *

+ * Created for the mob entity to dodge incoming projectiles but can be used for + * other entities and functionalities if needed. + *

+ */ +public class DodgingComponent extends Component { + private final RaycastHit hit = new RaycastHit(); + private short targetLayer; + private float rangeDetection; + private float dodgeSpeed = 1.75f; + // Original entity y's speed + private float originalSpeed; + private PhysicsEngine physics; + + // Sometimes the raycast mechanic doesn't detect the other entity because of the + // target's (or self) collider size does not match. This value makes sure the + // top and bottom detection is also taken care of, ensuring the entity will + // dodge. + private static final float Y_OFFSET_MOB_DETECTION = 0.35f; + + /** + * Initialises a component that dodges an incoming entity based on its target + * layer. The range detection is defaultto 0.25f. + * + * @param targetLayer The target layer to be detected horizontally. + */ + public DodgingComponent(short targetLayer) { + this.targetLayer = targetLayer; + this.rangeDetection = 0.25f; + } + + /** + * Initialises a component that dodges an incoming entity based on its target + * layer. This initialisation also sets the range detection whereby the dodge + * event is triggered. + * + * @param targetLayer The target layer to be detected horizontally. + * @param rangeDetection The range where the entity of the target layer is + * detected, activating the dodge event. + */ + public DodgingComponent(short targetLayer, float rangeDetection) { + this.targetLayer = targetLayer; + this.rangeDetection = rangeDetection; + } + + public DodgingComponent(short targetLayer, float rangeDetection, float dodgeSpeed) { + this.targetLayer = targetLayer; + this.rangeDetection = rangeDetection; + this.dodgeSpeed = dodgeSpeed; + } + + /** + * Called when the entity is created and registered. + * + * Entity created will have the dodge entity event. Also registers the original + * speed of the current entity. + */ + @Override + public void create() { + physics = ServiceLocator.getPhysicsService().getPhysics(); + entity.getEvents().addListener("dodgeIncomingEntity", this::changeTraverseDirection); + originalSpeed = entity.getComponent(PhysicsMovementComponent.class).getSpeed().y; + } + + /** + * Changes the moving direction of the attached entity with this component. + *

+ * Relies heavily on the isTargetVisible() method, and setting the vertical + * angle direction and speed helper methods found in this component class. + *

+ * + * @param mobPos The current Vector2 mob position in the map. + */ + public void changeTraverseDirection(Vector2 mobPos) { + if (isTargetVisible(mobPos)) { + // If mob is in the top half quadrant of the map grid, make the entity dodge + // downwards. + setVerticalAngleDirection(mobPos.y > 3.5 ? mobPos.y - 15 : mobPos.y + 15); + setVerticalSpeed(dodgeSpeed); + } else { + setVerticalAngleDirection(mobPos.y); + setVerticalSpeed(originalSpeed); + } + } + + /** + * Detects if the a target is visible based on the range detection, current + * Vector2 position of the mob and the target layer initialised with this class. + * + * @param mobPos The current Vector2 position of the mob + * @return True if a target is visible, false otherwise. + */ + private boolean isTargetVisible(Vector2 mobPos) { + Vector2 maxRange = new Vector2(mobPos.x - rangeDetection, mobPos.y); + // check also the upper and lower boundaries of the mob with the offset y mob + // detection. + Vector2 upperYMaxRangePos = new Vector2(mobPos.x - 3, mobPos.y - Y_OFFSET_MOB_DETECTION); + Vector2 lowerYMaxRangePos = new Vector2(mobPos.x - 3, mobPos.y + Y_OFFSET_MOB_DETECTION); + + // Raycast the upper, middle and lower detection range. + return physics.raycast(mobPos, maxRange, targetLayer, hit) + || physics.raycast(mobPos, upperYMaxRangePos, targetLayer, hit) + || physics.raycast(mobPos, lowerYMaxRangePos, targetLayer, hit); + } + + /** + * Sets vertical direction of the moving entity based on a float value. This + * method alters the setaTarget method in the PhysicsMovementComponent of the + * entity. + * + * @param y A float value that alters the moving direction of the entity. + */ + private void setVerticalAngleDirection(float y) { + entity.getComponent(PhysicsMovementComponent.class).setTarget(new Vector2(0, y)); + } + + /** + * Sets the vertical speed of the entity based on a float value. This method + * alters the setSpeed method in the PhysicsMovementComponent of the entity. + * + * @param y Float value that alters the entity's vertical movement speed. + */ + private void setVerticalSpeed(float y) { + entity.getComponent(PhysicsMovementComponent.class).setSpeed(new Vector2(1f, y)); + } +} diff --git a/source/core/src/main/com/csse3200/game/components/npc/DragonKnightAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/DragonKnightAnimationController.java new file mode 100644 index 000000000..35ef7fe1e --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/DragonKnightAnimationController.java @@ -0,0 +1,45 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class DragonKnightAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + } + + void animateWalk() { + animator.startAnimation("dragon_knight_run"); + } + + void animateAttack() { + animator.startAnimation("dragon_knight_attack"); + } + + void animateDeath() { + animator.startAnimation("dragon_knight_death"); + } + + +} + diff --git a/source/core/src/main/com/csse3200/game/components/npc/FireWormAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/FireWormAnimationController.java new file mode 100644 index 000000000..ff2855322 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/FireWormAnimationController.java @@ -0,0 +1,50 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class FireWormAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + entity.getEvents().addListener("stop", this::stopAnimation); + } + + void animateWalk() { + animator.startAnimation("fire_worm_walk"); + } + + void animateAttack() { + animator.startAnimation("fire_worm_attack"); + } + + void animateDeath() { + animator.startAnimation("fire_worm_death"); + } + + void stopAnimation() { + animator.startAnimation("default"); + } + + +} + diff --git a/source/core/src/main/com/csse3200/game/components/npc/SkeletonAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/SkeletonAnimationController.java new file mode 100644 index 000000000..0a219b3c6 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/SkeletonAnimationController.java @@ -0,0 +1,43 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class SkeletonAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + } + + void animateWalk() { + animator.startAnimation("skeleton_walk"); + } + + void animateAttack() { + animator.startAnimation("skeleton_attack"); + } + + void animateDeath() { + animator.startAnimation("skeleton_death"); + } +} + diff --git a/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java b/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java new file mode 100644 index 000000000..4a34b95ee --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java @@ -0,0 +1,149 @@ +package com.csse3200.game.components.npc; + +import com.csse3200.game.components.Component; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.NPCFactory; +import com.csse3200.game.services.ServiceLocator; + +/** + * A component that splits the target mob entity into multiple entities after + * after the mob dies. This class adds a method to the existing event listener + * "dieStart". + *

+ * Amount of moblings spawned must be provided in the construcor. + * Scaled size of the moblings can be altered in the X and Y direction if + * desired. If not provided scaling alteration is assumed to be 0.75. + *

+ */ +public class SplitMoblings extends Component { + private int amount; + private float scaleX, scaleY; + public static final float DEFAULT_MINIFIED_SCALE = 0.75f; + public static final double OFFSET_DISTANCE = 1.5; + public static final int FULL_CIRCLE_ANGLE = 360; + public static final float MIN_X_BOUNDS = 1; + public static final float MAX_X_BOUNDS = (float) 18.5; + public static final float MIN_Y_BOUNDS = 0; + public static final float MAX_Y_BOUNDS = 8; + + /** + * Initialises a component that splits mob into multiple moblings. Amount of + * moblings split based on the amount provided param. + * + * @param amount Amount of moblings to be split. + * @require amount > 0 + */ + public SplitMoblings(int amount) { + this.amount = amount; + scaleX = scaleY = DEFAULT_MINIFIED_SCALE; + } + + /** + * Initialises a component that splits mob into multiple moblings. Amount of + * moblings split is based on the amount provided param. + * The overalling scaling (x and y) is also altered in the param. + * + * @param amount Amount of moblings to be split. + * @param scale X and Y scaling of the moblings in respect to the original size + * of the mobs. + * @require amount > 0 + */ + public SplitMoblings(int amount, float scale) { + this.amount = amount; + this.scaleX = this.scaleY = scale; + } + + /** + * Initialises a component that splits mob into multiple moblings. Amount of + * moblings split is based on the amount provided param. + * The individual scaling (x and y) is also altered in the param. + * + * @param amount Amount of moblings to be split. + * @param scaleX X scaling of the moblings compared to original size. + * @param scaleY Y scaling of the moblings compared to original size. + * @require amount > 0 + */ + public SplitMoblings(int amount, float scaleX, float scaleY) { + this.amount = amount; + this.scaleX = scaleX; + this.scaleY = scaleY; + } + + @Override + public void create() { + entity.getEvents().addListener("dieStart", this::onDeath); + } + + /** + * Splits into multiple xeno grunts after death + */ + private void onDeath() { + float initialScaleX = entity.getScale().x; + float initialScaleY = entity.getScale().y; + + // If there's only one amount to be spawned, spawn it 1 x-coordinate to the + // left. + if (amount == 1) { + float newXPosition = (float) (entity.getPosition().x - OFFSET_DISTANCE); + float newYPosition = (float) (entity.getPosition().y); + + if (withinBounds(newXPosition, newYPosition)) + spawnAdditionalMob(newXPosition, newYPosition, initialScaleX, initialScaleY); + } + + // Inspired by: + // https://stackoverflow.com/questions/37145768/distribute-points-evenly-on-circle-circumference-in-quadrants-i-and-iv-only + for (int i = 0; i < amount; i++) { + float currAngle = (360 / amount) * i; + double radians = currAngle * Math.PI / 180; + + float newX = entity.getPosition().x + (float) OFFSET_DISTANCE * + (float) Math.cos(radians); + float newY = entity.getPosition().y + (float) OFFSET_DISTANCE * + (float) Math.sin(radians); + + if (withinBounds(newX, newY)) + spawnAdditionalMob(newX, newY, initialScaleX, initialScaleY); + } + } + + /** + * Helper function that spawns a xeno grunt based on a x and y-coordinate and + * scales down/up the entity based on the initial scale and this object's + * scale. + * + * @param positionX New spawn x-coordinate + * @param positionY New spawn y-coordinate + * @param initialScaleX Initial horizontal scale of the entity + * @param initialScaleY Initial vertical scale of the entity + */ + public void spawnAdditionalMob(float positionX, float positionY, float initialScaleX, float initialScaleY) { + // ? ENTITY PARAM KINDA USELESS? + Entity xenoGrunt = NPCFactory.createXenoGrunt(); + xenoGrunt.setPosition(positionX, positionY); + + xenoGrunt.setScale(initialScaleX * scaleX, initialScaleY * scaleY); + + ServiceLocator.getEntityService().register(xenoGrunt); + } + + /** + * Helper to check if the current projectile position is within map bounds. + * Prevents spawning of mobs outof bounds. + * + * @param currX x-coordinate of the gamegrid. + * @param currY y-coordinate of the gamegrid. + * @return true if current position is within bounds of the map constraints. + * False otherwise. + */ + private boolean withinBounds(float currX, float currY) { + if (currX >= MIN_X_BOUNDS + && currX <= MAX_X_BOUNDS + && currY >= MIN_Y_BOUNDS + && currY <= MAX_Y_BOUNDS) { + return true; + } + ; + return false; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/npc/WaterQueenAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/WaterQueenAnimationController.java new file mode 100644 index 000000000..6c0e7d98f --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/WaterQueenAnimationController.java @@ -0,0 +1,43 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class WaterQueenAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + } + + void animateWalk() { + animator.startAnimation("water_queen_walk"); + } + + void animateAttack() { + animator.startAnimation("water_queen_attack"); + } + + void animateDeath() { + animator.startAnimation("water_queen_death"); + } +} + diff --git a/source/core/src/main/com/csse3200/game/components/npc/WaterSlimeAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/WaterSlimeAnimationController.java new file mode 100644 index 000000000..c0fd94b3b --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/WaterSlimeAnimationController.java @@ -0,0 +1,44 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class WaterSlimeAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + } + + void animateWalk() { + animator.startAnimation("water_slime_walk"); + } + + void animateAttack() { + animator.startAnimation("water_slime_attack"); + } + + void animateDeath() { + animator.startAnimation("water_slime_death"); + } +} + + diff --git a/source/core/src/main/com/csse3200/game/components/npc/WizardAnimationController.java b/source/core/src/main/com/csse3200/game/components/npc/WizardAnimationController.java new file mode 100644 index 000000000..94470081b --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/npc/WizardAnimationController.java @@ -0,0 +1,43 @@ +package com.csse3200.game.components.npc; + +import com.badlogic.gdx.audio.Sound; +import com.csse3200.game.components.Component; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +import java.util.Random; + +/** + * This class listens to events relevant to a ghost entity's state and plays the animation when one + * of the events is triggered. + */ +public class WizardAnimationController extends Component { + // // For on collision sounds later + // private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3"; + // Sound onCollisionSound = ServiceLocator.getResourceService().getAsset( + // COLLISION_SFX, Sound.class); + AnimationRenderComponent animator; + Random rand = new Random(); + + @Override + public void create() { + super.create(); + animator = this.entity.getComponent(AnimationRenderComponent.class); + entity.getEvents().addListener("wanderStart", this::animateWalk); + entity.getEvents().addListener("shootStart", this::animateAttack); + entity.getEvents().addListener("dieStart", this::animateDeath); + } + + void animateWalk() { + animator.startAnimation("wizard_run"); + } + + void animateAttack() { + animator.startAnimation("wizard_attack"); + } + + void animateDeath() { + animator.startAnimation("wizard_death"); + } +} + diff --git a/source/core/src/main/com/csse3200/game/components/player/PlayerActions.java b/source/core/src/main/com/csse3200/game/components/player/PlayerActions.java index dd56f5c7a..acb46b5a5 100644 --- a/source/core/src/main/com/csse3200/game/components/player/PlayerActions.java +++ b/source/core/src/main/com/csse3200/game/components/player/PlayerActions.java @@ -4,6 +4,10 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.csse3200.game.components.Component; +import com.csse3200.game.components.ProjectileEffects; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.physics.components.PhysicsComponent; import com.csse3200.game.services.ServiceLocator; @@ -67,5 +71,11 @@ void stopWalking() { void attack() { Sound attackSound = ServiceLocator.getResourceService().getAsset("sounds/Impact4.ogg", Sound.class); attackSound.play(); + Entity projectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, + new Vector2(20f, entity.getPosition().y), new Vector2(2, 2), + ProjectileEffects.BURN, false); + projectile.setPosition(entity.getPosition().x, entity.getPosition().y); + projectile.setScale(1f, 1f); + ServiceLocator.getEntityService().register(projectile); } } diff --git a/source/core/src/main/com/csse3200/game/components/projectile/MobKingProjectAnimController.java b/source/core/src/main/com/csse3200/game/components/projectile/MobBossProjectAnimController.java similarity index 82% rename from source/core/src/main/com/csse3200/game/components/projectile/MobKingProjectAnimController.java rename to source/core/src/main/com/csse3200/game/components/projectile/MobBossProjectAnimController.java index 828daf597..471e07de1 100644 --- a/source/core/src/main/com/csse3200/game/components/projectile/MobKingProjectAnimController.java +++ b/source/core/src/main/com/csse3200/game/components/projectile/MobBossProjectAnimController.java @@ -3,10 +3,10 @@ import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; -public class MobKingProjectAnimController extends Component { +public class MobBossProjectAnimController extends Component { /** Event names */ - private static final String START = "startMobKing"; - private static final String FINAL = "startMobKingFinal"; + private static final String START = "startMobBoss"; + private static final String FINAL = "startMobBossFinal"; /** Animation name constants */ private static final String START_ANIM = "mob_boss"; diff --git a/source/core/src/main/com/csse3200/game/components/projectile/OnCollisionAnimationController.java b/source/core/src/main/com/csse3200/game/components/projectile/OnCollisionAnimationController.java index 7efbfa55d..33a9bc183 100644 --- a/source/core/src/main/com/csse3200/game/components/projectile/OnCollisionAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/projectile/OnCollisionAnimationController.java @@ -1,7 +1,6 @@ package com.csse3200.game.components.projectile; import com.csse3200.game.components.Component; -import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.ServiceLocator; import com.badlogic.gdx.audio.Sound; diff --git a/source/core/src/main/com/csse3200/game/components/tasks/CurrencyTask.java b/source/core/src/main/com/csse3200/game/components/tasks/CurrencyTask.java index f2c8ede84..c9e21d846 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/CurrencyTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/CurrencyTask.java @@ -9,8 +9,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.TimeUnit; - /** * The CurrencyTask updates the in-game currency based on time intervals. */ diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java index fa6e41433..3cc5de175 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java @@ -14,7 +14,6 @@ import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.physics.raycast.RaycastHit; -import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; @@ -126,16 +125,15 @@ public void updateMobState() { mobState = STATE.STOW; } else { if (this.meleeOrProjectile() instanceof Melee) { - System.out.println("Melee attack"); TouchAttackComponent attackComp = owner.getEntity().getComponent(TouchAttackComponent.class); HitboxComponent hitboxComp = owner.getEntity().getComponent(HitboxComponent.class); attackComp.onCollisionStart(hitboxComp.getFixture(), target); this.owner.getEntity().getEvents().trigger("meleeStart"); } else { - Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f)); - newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y)); -// newProjectile.setScale(-1f, 0.5f); - ServiceLocator.getEntityService().register(newProjectile); + // Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f)); + // newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y)); + // newProjectile.setScale(-1f, 1f); + // ServiceLocator.getEntityService().register(newProjectile); // System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n"); this.owner.getEntity().getEvents().trigger(FIRING); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobDeathTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobDeathTask.java index 124151714..615f0e1ff 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobDeathTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobDeathTask.java @@ -4,10 +4,8 @@ import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.components.CombatStatsComponent; import com.badlogic.gdx.math.Vector2; -import com.csse3200.game.currency.Currency; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.DropFactory; -import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.raycast.RaycastHit; import com.csse3200.game.services.ServiceLocator; diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java new file mode 100644 index 000000000..d7c1f546f --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java @@ -0,0 +1,76 @@ +package com.csse3200.game.components.tasks; + +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.services.GameTime; +import com.csse3200.game.services.ServiceLocator; + +/** + * This task runs the AI that adds a dodge mechanic/functionality for the mobs + * in the MobsFactory. Inherits from the MobWanderTask that handles the death + * and movement mechanics of the entity. + *

+ * Relies heavily on the attached DodgingComponent + * that adds the + * "dodgeIncomingEntity" event to the attached entity. + *

+ */ +public class MobDodgeTask extends MobWanderTask { + + private final int priority; // active priority + + private GameTime timeSource; + private long endTime; + + // Helps task wait between each interval. + private final int DELAY_INTERVAL = 500; + + /** + * Initialises a mob dodge task with a specified wander range, wait time, and + * priority level. + * + * @param wanderRange Distance in X and Y the entity can move from its position + * when start() is + * called. + * @param waitTime How long in seconds to wait between wandering. + * @param priority Priority level compared to other added tasks. + */ + public MobDodgeTask(Vector2 wanderRange, float waitTime, int priority) { + super(wanderRange, waitTime); + this.priority = priority; + + timeSource = ServiceLocator.getTimeSource(); + } + + /** + * Start running the task. Usually called by the AI controller. + */ + @Override + public void start() { + super.start(); + owner.getEntity().getEvents().trigger("wanderStart"); + + endTime = timeSource.getTime() + (1 * DELAY_INTERVAL); + } + + /** + * Run a frame of the task. In this extension of the update(), the + * "dodgeIncomingEntity" event will be detected and triggered on set intervals. + */ + @Override + public void update() { + super.update(); + if (timeSource.getTime() >= endTime) { + owner.getEntity().getEvents().trigger("dodgeIncomingEntity", owner.getEntity().getCenterPosition()); + endTime = timeSource.getTime() + (1 * DELAY_INTERVAL); + } + + } + + /** + * Returns the priority level of this dodge task initialised in the constructor. + */ + @Override + public int getPriority() { + return priority; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java new file mode 100644 index 000000000..f339e4999 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java @@ -0,0 +1,240 @@ +package com.csse3200.game.components.tasks; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.physics.box2d.Fixture; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.components.TouchAttackComponent; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.Melee; +import com.csse3200.game.entities.Weapon; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.HitboxComponent; +import com.csse3200.game.physics.components.PhysicsMovementComponent; +import com.csse3200.game.physics.raycast.RaycastHit; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.GameTime; +import com.csse3200.game.services.ServiceLocator; + + +/** + * Task that allows mobs to shoot projectiles or melee attack towers + */ +public class MobShootTask extends DefaultTask implements PriorityTask { + private static final int INTERVAL = 1; // time interval to scan for towers in + private static final short TARGET = PhysicsLayer.HUMANS; // mobs detecting for towers + // ^ fix this + + private static final String WALKING = "wanderStart"; + private static final String DEPLOY = "deployStart"; + private static final String FIRING = "shootStart"; + private static final String IDLE = "stop"; + + private Fixture target; + + private final int priority; + private final float maxRange; + private Vector2 mobPosition = new Vector2(10f,10f); + private final Vector2 maxRangePosition = new Vector2(); + private final PhysicsEngine physics; + private GameTime timeSource; + private long endTime; + private final RaycastHit hit = new RaycastHit(); + + private final long delay = 1000; // delay between shots + private long startTime; + + private enum STATE { + IDLE, DEPLOY, FIRING, WALKING + } + + private STATE mobState = STATE.IDLE; + + /** + * @param priority Task priority when targets are detected (0 when nothing detected). Must be a positive integer. + * @param maxRange Maximum effective range of the weapon mob. This determines the detection distance of targets + */ + public MobShootTask(int priority, float maxRange) { + this.priority = priority; + this.maxRange = maxRange; + startTime = 0; + + physics = ServiceLocator.getPhysicsService().getPhysics(); + timeSource = ServiceLocator.getTimeSource(); + } + + /** + * Starts the task running, triggers the initial "idleStart" event. + */ + @Override + public void start() { + super.start(); + startTime = timeSource.getTime(); + this.mobPosition = owner.getEntity().getCenterPosition(); + this.maxRangePosition.set(0, mobPosition.y); + //owner.getEntity().getEvents().trigger(IDLE); + endTime = timeSource.getTime() + (INTERVAL * 500); +// owner.getEntity().getEvents().trigger("shootStart"); + } + + /** + * The update method is what is run every time the TaskRunner in the AiTaskComponent calls update(). + * Triggers events depending on the presence or otherwise of targets in the detection range + */ + @Override + public void update() { + updateMobState(); + + if (mobState == STATE.WALKING) { + status = Status.FINISHED; + } + } + + /** + * Mob state machine. Updates mob state by scanning for towers, and + * triggers the appropriate events corresponding to the STATE enum. + */ + public void updateMobState() { + switch (mobState) { + + case IDLE -> { + + // targets detected in idle mode - start deployment +// owner.getEntity().getEvents().trigger(DEPLOY); + mobState = STATE.WALKING; + + } + + case DEPLOY -> { + // currently deploying, + if (isTargetVisible() != false) { + owner.getEntity().getComponent(PhysicsMovementComponent.class).setEnabled(false); + this.owner.getEntity().getEvents().trigger(FIRING); + mobState = STATE.FIRING; + } else { + this.owner.getEntity().getEvents().trigger(WALKING); + mobState = STATE.WALKING; + } + } + + case FIRING -> { + // targets gone or cannot be attacked - stop firing + if (!isTargetVisible() == false) { + this.owner.getEntity().getEvents().trigger(WALKING); + mobState = STATE.WALKING; + } else { + + Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f)); + newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y)); + newProjectile.setScale(-1f, 1f); + ServiceLocator.getEntityService().register(newProjectile); + +// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n"); + this.owner.getEntity().getEvents().trigger(FIRING); + mobState = STATE.WALKING; + } + + owner.getEntity().getComponent(PhysicsMovementComponent.class).setEnabled(true); + + } + + case WALKING -> { + // currently stowing +// if (isTargetVisible()) { +// // owner.getEntity().getEvents().trigger(DEPLOY); +// mobState = STATE.DEPLOY; +// } else { +// owner.getEntity().getEvents().trigger(IDLE); +// mobState = STATE.IDLE; +// } + owner.getEntity().getEvents().trigger(WALKING); + } + } + } + + /** + * For stopping the attack task + */ + @Override + public void stop() { + if (mobState == STATE.FIRING || mobState == STATE.DEPLOY) { + this.updateMobState(); + } else { + super.stop(); + owner.getEntity().getEvents().trigger(WALKING); + } + } + + /** + * Returns the current priority of the task. + * @return active priority value if targets detected, inactive priority otherwise + */ + @Override + public int getPriority() { + if (status == Status.ACTIVE) { + return getActivePriority(); + } + return getInactivePriority(); + } + + /** + * Fetches the active priority of the Task if a target is visible. + * @return (int) active priority if a target is visible, -1 otherwise + */ + private int getActivePriority() { + if ((startTime + delay) < timeSource.getTime() && isTargetVisible() != false) { + return priority; + } + return -1; + } + + /** + * Fetches the inactive priority of the Task if a target is not visible. + * @return (int) -1 if a target is not visible, active priority otherwise + */ + private int getInactivePriority() { + if ((startTime + delay) < timeSource.getTime() && isTargetVisible() != false) { + return priority; + } + return -1; + } + + /** + * Uses a raycast to determine whether there are any targets in detection range + * @return true if a target is visible, false otherwise + */ + private boolean isTargetVisible() { + Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f); + return physics.raycast(owner.getEntity().getPosition(), newVector, TARGET, hit); + } + + /** + * Uses a custom raycast method to find the closest target to the mob. Based on the distance to the + * target, the mob will choose a weapon to attack with. + * + * If the object does not have a CombatStatsComponent (which handles dealing damage etc), then + * the function will return null. If it returns null when the mob is in state FIRING or DEPLOY, it will not fire + * and will WALKING. + * + * returns the Weapon (Melee or Projectile) the mob will use to attack the target. null if immune target or no target + * */ +// private Weapon meleeOrProjectile() { +// // Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f); +// // Fixture hitraycast = physics.raycastGetHit(owner.getEntity().getPosition(), newVector, TARGET); +// setTarget(); +// TouchAttackComponent comp = owner.getEntity().getComponent(TouchAttackComponent.class); +// Weapon chosenWeapon = null; +// if (comp != null) { +// chosenWeapon = comp.chooseWeapon(target); +// } + +// return chosenWeapon; +// } + + private void setTarget() { + Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f); + target = physics.raycastGetHit(owner.getEntity().getPosition(), newVector, TARGET); + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobWanderTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobWanderTask.java index ccd7acf8c..501e60609 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobWanderTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobWanderTask.java @@ -59,7 +59,7 @@ public void start() { currentTask = movementTask; -// this.owner.getEntity().getEvents().trigger("wanderStart"); + // this.owner.getEntity().getEvents().trigger("wanderStart"); } @Override diff --git a/source/core/src/main/com/csse3200/game/components/tasks/NewMobWanderTask.java b/source/core/src/main/com/csse3200/game/components/tasks/NewMobWanderTask.java new file mode 100644 index 000000000..2a6291e66 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/NewMobWanderTask.java @@ -0,0 +1,156 @@ +package com.csse3200.game.components.tasks; + +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.ai.tasks.Task; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.DropFactory; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.raycast.RaycastHit; +import com.csse3200.game.services.GameTime; + +/** + * Wander around by moving a random position within a range of the starting position. Wait a little + * bit between movements. Requires an entity with a PhysicsMovementComponent. + */ +public class NewMobWanderTask extends DefaultTask implements PriorityTask { + private static final Logger logger = LoggerFactory.getLogger(MobWanderTask.class); + + private final float waitTime; + private Vector2 startPos; + private MovementTask movementTask; + private WaitTask waitTask; + private Task currentTask; + private boolean isDead = false; + private Vector2 mobPosition; + private final PhysicsEngine physics; + private static final short TARGET = PhysicsLayer.HUMANS; + private final RaycastHit hit = new RaycastHit(); + + /** + * @param waitTime How long in seconds to wait between wandering. + */ + public NewMobWanderTask(float waitTime) { + this.waitTime = waitTime; + physics = ServiceLocator.getPhysicsService().getPhysics(); + } + + @Override + public int getPriority() { + return 1; // Low priority task + } + + @Override + public void start() { + super.start(); + startPos = owner.getEntity().getPosition(); + + waitTask = new WaitTask(waitTime); + waitTask.create(owner); + movementTask = new MovementTask(getDirection()); + movementTask.create(owner); + + movementTask.start(); + currentTask = movementTask; + + this.owner.getEntity().getEvents().trigger("wanderStart"); + } + + @Override + public void update() { + + //Update the position of the mob + mobPosition = owner.getEntity().getPosition(); + + // If the mob is at zero health, kill the mob, + // play the death animation and stop the task + // This method is the idea of Ahmad who very kindly helped + // with section, massive props to him for his help! + if (!isDead && owner.getEntity().getComponent(CombatStatsComponent.class).isDead()) { + this.owner.getEntity().getEvents().trigger("dieStart"); + currentTask.stop(); + isDead = true; + } + + // Check if the mob has finished death animation + else if (isDead && owner.getEntity().getComponent(AnimationRenderComponent.class).isFinished()) { + + // Drop scrap at the mobs location for player + // to collect. + Entity scrap = DropFactory.createScrapDrop(); + scrap.setPosition(mobPosition.x,mobPosition.y); + ServiceLocator.getEntityService().register(scrap); + + // Delete the mob. + owner.getEntity().setFlagForDelete(true); + + } + // If not dead, do normal things... + else if (!isDead) { + + if (currentTask.getStatus() != Status.ACTIVE) { + if (currentTask == movementTask) { + if (isTargetVisible()) { + Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f)); + newProjectile.setScale(-1f, 1f); + newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y)); + ServiceLocator.getEntityService().register(newProjectile); + + // System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n"); + this.owner.getEntity().getEvents().trigger("shootStart"); + System.out.println("TESTING SHOOT"); + } + } else { + startMoving(); + + } + } + currentTask.update(); + } + } + + + private void startWaiting() { + logger.debug("Starting waiting"); + this.owner.getEntity().getEvents().trigger("stop"); + swapTask(waitTask); + } + + private void startMoving() { + logger.debug("Starting moving"); + movementTask.setTarget(getDirection()); + this.owner.getEntity().getEvents().trigger("wanderStart"); + swapTask(movementTask); + } + + private void swapTask(Task newTask) { + if (currentTask != null) { + currentTask.stop(); + } + currentTask = newTask; + currentTask.start(); + } + + private Vector2 getDirection() { + float y = startPos.y; + return new Vector2(0, y); + } + + /** + * Uses a raycast to determine whether there are any targets in detection range + * @return true if a target is visible, false otherwise + */ + private boolean isTargetVisible() { + Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f); + return physics.raycast(owner.getEntity().getPosition(), newVector, TARGET, hit); + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/ShootTask.java b/source/core/src/main/com/csse3200/game/components/tasks/ShootTask.java new file mode 100644 index 000000000..3fb457e02 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/ShootTask.java @@ -0,0 +1,91 @@ +package com.csse3200.game.components.tasks; + +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.entities.Entity; +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.raycast.RaycastHit; +import com.csse3200.game.rendering.DebugRenderer; +import com.csse3200.game.services.ServiceLocator; + + +/** + * Task that prints a message to the terminal whenever it is called. + */ +public class ShootTask extends DefaultTask implements PriorityTask { + private String message; + private final Entity target; + private final int priority; + private final float viewDistance; + private final float maxChaseDistance; + private final PhysicsEngine physics; + private final DebugRenderer debugRenderer; + private final RaycastHit hit = new RaycastHit(); + + /** + * @param target The entity to shoot at. + * @param priority Task priority when shooting (0 when not chasing). + * @param viewDistance Maximum distance from the entity at which shooting can start. + * @param maxChaseDistance Maximum distance from the entity while shooting before giving up. + */ + public ShootTask(Entity target, int priority, float viewDistance, float maxChaseDistance) { + this.target = target; + this.priority = priority; + this.viewDistance = viewDistance; + this.maxChaseDistance = maxChaseDistance; + this.message = "Shoot Task Activated " + target; + physics = ServiceLocator.getPhysicsService().getPhysics(); + debugRenderer = ServiceLocator.getRenderService().getDebug(); + + } + + @Override + public void start() { + super.start(); + System.out.println(this.message); + } + + @Override + public int getPriority() { + if (status == Status.ACTIVE) { + return getActivePriority(); + } + + return getInactivePriority(); + } + + private float getDistanceToTarget() { + return owner.getEntity().getPosition().dst(target.getPosition()); + } + + private int getActivePriority() { + float dst = getDistanceToTarget(); + if (dst > maxChaseDistance || !isTargetVisible()) { + return -1; // Too far, stop chasing + } + return priority; + } + + private int getInactivePriority() { + float dst = getDistanceToTarget(); + if (dst < viewDistance && isTargetVisible()) { + return priority; + } + return -1; + } + + private boolean isTargetVisible() { + Vector2 from = owner.getEntity().getCenterPosition(); + Vector2 to = target.getCenterPosition(); + + // If there is an obstacle in the path to the player, not visible. + if (physics.raycast(from, to, PhysicsLayer.OBSTACLE, hit)) { + debugRenderer.drawLine(from, hit.point); + return false; + } + debugRenderer.drawLine(from, to); + return true; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/TowerCombatTask.java b/source/core/src/main/com/csse3200/game/components/tasks/TowerCombatTask.java index f986f9667..9d1f74538 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/TowerCombatTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/TowerCombatTask.java @@ -3,7 +3,6 @@ import com.badlogic.gdx.math.Vector2; import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; -import com.csse3200.game.components.ProjectileEffects; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; diff --git a/source/core/src/main/com/csse3200/game/components/tasks/TrajectTask.java b/source/core/src/main/com/csse3200/game/components/tasks/TrajectTask.java index 04967ba8e..9dbc8cf5c 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/TrajectTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/TrajectTask.java @@ -40,7 +40,7 @@ public void start() { this.owner.getEntity().getEvents().trigger(START); this.owner.getEntity().getEvents().trigger("rotate"); this.owner.getEntity().getEvents().trigger("start"); - this.owner.getEntity().getEvents().trigger("startMobKing"); + this.owner.getEntity().getEvents().trigger("startMobBoss"); } public void switchProjectileState() { diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java new file mode 100644 index 000000000..5597fbd08 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java @@ -0,0 +1,464 @@ +package com.csse3200.game.components.tasks.bosstask; + +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.Timer; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.ProjectileEffects; +import com.csse3200.game.components.tasks.MovementTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.MobBossFactory; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.HitboxComponent; +import com.csse3200.game.physics.components.PhysicsMovementComponent; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.GameTime; +import com.csse3200.game.services.ServiceLocator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The AI Task for the demon boss entity. The demon boss will first play its transform animation + * before beginning its sequence. Its sequence is based on its state and the different game + * scenarios that happen in game dictate its state. + */ +public class DemonBossTask extends DefaultTask implements PriorityTask { + + // Constants + private static final int PRIORITY = 3; + private static final Vector2 DEMON_SPEED = new Vector2(1f, 1f); + private static final float STOP_DISTANCE = 0.1f; + private static final float JUMP_DISTANCE = 3.0f; + private static final int Y_TOP_BOUNDARY = 6; + private static final int Y_BOT_BOUNDARY = 1; + private static final int BREATH_ANIM_TIME = 2; + private static final int SMASH_RADIUS = 3; + private static final int MOVE_FORWARD_DELAY = 30; + private static final float BREATH_DURATION = 4.2f; + private static final int SMASH_DAMAGE = 30; + private static final int CLEAVE_DAMAGE = 50; + private static final int HEAL_TIMES = 10; + private static final int HEALTH_TO_ADD = 10; + + // Private variables + private static final Logger logger = LoggerFactory.getLogger(DemonBossTask.class); + private Vector2 currentPos; + private final PhysicsEngine physics; + private final GameTime gameTime; + private Vector2 jumpPos; + private MovementTask jumpTask; + private DemonState state = DemonState.IDLE; + private DemonState prevState; + private AnimationRenderComponent animation; + private Entity demon; + private int numBalls = 6; + private static int xRightBoundary = 17; + private static int xLeftBoundary = 12; + private ProjectileEffects effect = ProjectileEffects.BURN; + private boolean aoe = true; + + // Flags + private boolean startFlag = false; + private boolean isJumping; + private boolean halfHealthFlag = false; + private boolean isHealing = false; + + /** + * The different demon states. + */ + private enum DemonState { + TRANSFORM, IDLE, CAST, CLEAVE, DEATH, BREATH, SMASH, TAKE_HIT, + WALK, TRANSFORM_REVERSE, SLIME_IDLE, SLIME_MOVE, PROJECTILE_EXPLOSION, + PROJECTILE_IDLE, SLIME_TAKE_HIT + } + + /** + * The demon boss task constructor. Initialises the physics and time. + */ + public DemonBossTask() { + physics = ServiceLocator.getPhysicsService().getPhysics(); + gameTime = ServiceLocator.getTimeSource(); + } + + /** + * Starts transform animation, triggers idle animation which starts + * sequence, and dynamically shifts the demons boundary to the left. + */ + @Override + public void start() { + super.start(); + demon = owner.getEntity(); + animation = demon.getComponent(AnimationRenderComponent.class); // get animation + currentPos = demon.getPosition(); // get current position + demon.getComponent(PhysicsMovementComponent.class).setSpeed(DEMON_SPEED); // set speed + + Timer.schedule(new Timer.Task() { + @Override + public void run() { + changeState(DemonState.TRANSFORM); + animate(); + startFlag = true; + } + }, 0.1f); + + // shift demon's boundary left every 30s + for (int i = 1; i < 6; i++) { + Timer.schedule(new Timer.Task() { + @Override + public void run() { + xLeftBoundary -= 2; + xRightBoundary -= 2; + } + }, MOVE_FORWARD_DELAY * i); + } + } + + /** + * This function is called every frame and is responsible for updating the + * animation, the position and the state scenarios. + */ + @Override + public void update() { + // give game time to load in then start + if (!startFlag) { + return; + } + + animate(); + currentPos = demon.getPosition(); + int health = demon.getComponent(CombatStatsComponent.class).getHealth(); + + // handle initial demon transformation + if (animation.getCurrentAnimation().equals("transform") && animation.isFinished()) { + changeState(DemonState.IDLE); // start sequence + } + + // detect death stages + if (health <= 0) { + // spawn slimey boy + Entity slimey = MobBossFactory.createSlimeyBoy(); + slimey.setPosition(demon.getPosition().x, demon.getPosition().y); + slimey.setScale(5f, 5f); + ServiceLocator.getEntityService().register(slimey); + demon.setFlagForDelete(true); + } + + // detect half health + if (health <= demon.getComponent(CombatStatsComponent.class).getMaxHealth() / 2 && + !halfHealthFlag) { + halfHealth(); + halfHealthFlag = true; + } + + // detect sequence changes and runs the relevant state accordingly + switch (state) { + case IDLE -> jump(getJumpPos()); + case SMASH -> { + if (jumpComplete()) { + if (getNearbyHumans(SMASH_RADIUS).isEmpty()) { + fireBreath(); + } + else { + cleave(); + } + } + } + case BREATH, CLEAVE -> { + if (animation.isFinished()) { + changeState(DemonState.IDLE); + } + } + case CAST -> { + if (!isHealing) { + changeState(DemonState.IDLE); + } + } + case TRANSFORM -> { + if (health <= 0) { + if (animation.isFinished()) { + changeState(DemonState.DEATH); + } + } + } + } + } + + /** + * Changes the state of the demon. + * + * @param state state to be changed to + */ + private void changeState(DemonState state) { + prevState = this.state; + this.state = state; + } + + /** + * Changes the animation of the demon if a state change occurs. + */ + private void animate() { + // Check if same animation is being called + if (prevState.equals(state)) { + return; // skip rest of function + } + + switch (state) { + case CAST -> demon.getEvents().trigger("demon_cast_spell"); + case IDLE -> demon.getEvents().trigger("demon_idle"); + case WALK -> demon.getEvents().trigger("demon_walk"); + case DEATH -> demon.getEvents().trigger("demon_death"); + case BREATH -> demon.getEvents().trigger("demon_fire_breath"); + case SMASH -> demon.getEvents().trigger("demon_smash"); + case CLEAVE -> demon.getEvents().trigger("demon_cleave"); + case TAKE_HIT -> demon.getEvents().trigger("demon_take_hit"); + case TRANSFORM -> demon.getEvents().trigger("transform"); + case TRANSFORM_REVERSE -> demon.getEvents().trigger("transform_reverse"); + case SLIME_IDLE -> demon.getEvents().trigger("idle"); + case SLIME_MOVE -> demon.getEvents().trigger("move"); + case SLIME_TAKE_HIT -> demon.getEvents().trigger("take_hit"); + case PROJECTILE_IDLE -> demon.getEvents().trigger("projectile_explosion"); + case PROJECTILE_EXPLOSION -> demon.getEvents().trigger("projectile_idle"); + default -> logger.debug("Demon animation {state} not found"); + } + prevState = state; + } + + /** + * Returns the priority of this task. + * + * @return priority of task + */ + @Override + public int getPriority() { + return PRIORITY; + } + + /** + * Returns a list of nearby entities with PhysicsLayer.HUMAN. + * + * @return nearby entities with the PhysicsLayer of HUMAN + */ + private Array getNearbyHumans(int radius) { + Array nearbyEntities = ServiceLocator.getEntityService(). + getNearbyEntities(demon, radius); + Array nearbyHumans = new Array<>(); + + // iterate through nearby entities checking if they have desired properties + for (int i = 0; i < nearbyEntities.size; i++) { + Entity targetEntity = nearbyEntities.get(i); + HitboxComponent targetHitbox = targetEntity.getComponent(HitboxComponent.class); + if (targetHitbox == null) { + break; + } + + // check target layer + if (!PhysicsLayer.contains(PhysicsLayer.HUMANS, targetHitbox. + getLayer())) { + break; + } + + nearbyHumans.add(targetEntity); + } + return nearbyHumans; + } + + /** + * Changes state of demon and moves it to the desired position. + * + * @param finalPos position for demon to jump to + */ + private void jump(Vector2 finalPos) { + changeState(DemonState.SMASH); + isJumping = true; + + jumpTask = new MovementTask(finalPos); + jumpTask.create(owner); + jumpTask.start(); + + logger.debug("Demon jump starting"); + } + + /** + * Returns a a random position 3 units away for the demon to jump to. + * + * @return a position 3 units away from the demon to jump to + */ + private Vector2 getJumpPos() { + // check if boundary has shifted causing demon to be out of bounds + if (currentPos.x > xRightBoundary) { + jumpPos = new Vector2(currentPos.x - JUMP_DISTANCE, currentPos.y); //jump back into boundary + return jumpPos; + } + + float randomAngle = MathUtils.random(0, 2 * MathUtils.PI); + float x = JUMP_DISTANCE * MathUtils.cos(randomAngle); + float y = JUMP_DISTANCE * MathUtils.sin(randomAngle); + + // check boundaries + if (x + currentPos.x > xRightBoundary || x + currentPos.x < xLeftBoundary) { + x *= -1; + } + if (y + currentPos.y > Y_TOP_BOUNDARY || y + currentPos.y < Y_BOT_BOUNDARY) { + y *= -1; + } + + // get final jump position + float finalX = x + currentPos.x; + float finalY = y + currentPos.y; + jumpPos = new Vector2(finalX, finalY); + return jumpPos; + } + + /** + * Returns a boolean to confirm whether the demon has completed a jump or not. + * + * @return if demon has completed jump or not + */ + private boolean jumpComplete() { + if (currentPos.dst(jumpPos) <= STOP_DISTANCE && isJumping) { + applyAoeDamage(getNearbyHumans(SMASH_RADIUS), SMASH_DAMAGE); // do damage upon landing + isJumping = false; + jumpTask.stop(); + return true; + } + return false; + } + + /** + * Changes current breath attack with the given parameters. + * + * @param numBalls numbers of projectiles to be fired + * @param effect effect the projectile will apply + * @param aoe whether the effect will be applied in a radius or not + */ + public void changeBreathAttack(int numBalls, ProjectileEffects effect, boolean aoe) { + this.numBalls = numBalls; + this.effect = effect; + this.aoe = aoe; + } + + /** + * Fire breath attack that launches an amount of projectiles with a given effect at the humans. + */ + private void fireBreath() { + changeState(DemonState.BREATH); + + float delay = (BREATH_DURATION - BREATH_ANIM_TIME) / numBalls; + + float startAngle = (float) Math.toRadians(135); + float endAngle = (float) Math.toRadians(225); + float angleIncrement = (endAngle - startAngle) / (numBalls - 1); + + // spawn projectiles + for (int i = 0; i < numBalls; i++) { + // calculate unit vectors for projectiles + float currentAngle = startAngle + i * angleIncrement; + float x = MathUtils.cos(currentAngle) * 20; + float y = MathUtils.sin(currentAngle) * 20; + Vector2 destination = new Vector2(x, y); + + // Create burn projectiles + Timer.schedule(new Timer.Task() { + @Override + public void run() { + Entity projectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.HUMANS, destination, + new Vector2(2, 2), effect, aoe); + projectile.setPosition(demon.getPosition().x, demon.getPosition().y); + projectile.setScale(-1f, 1f); + ServiceLocator.getEntityService().register(projectile); + } + }, delay * i + BREATH_ANIM_TIME); + } + } + + /** + * Applies aoe damage to nearby human entities. + * + * @param targets array of human entities to deal damage to + */ + private void applyAoeDamage(Array targets, int damage) { + for (int i = 0; i < targets.size; i++) { + Entity targetEntity = targets.get(i); + + CombatStatsComponent targetCombatStats = targetEntity. + getComponent(CombatStatsComponent.class); + if (targetCombatStats != null) { + targetCombatStats.hit(damage); + } + } + } + + /** +<<<<<<< HEAD + * Returns the closest human entity from a given array. + * + * @param targets array of human entities + * @return closest human entity + */ + private Entity getClosestHuman(Array targets) { + Entity closestEntity = null; + float closestDistance = SMASH_RADIUS; + + for (int i = 0; i < targets.size; i++) { + Entity targetEntity = targets.get(i); + Vector2 targetPosition = targetEntity.getPosition(); + float distance = currentPos.dst(targetPosition); + + if (distance < closestDistance) { + closestEntity = targetEntity; + closestDistance = distance; + } + } + return closestEntity; + } + + /** + * Change state to cleave and deals damage to target. +======= + * Change state to cleave and deal damage to target +>>>>>>> AOE-Projectile + */ + private void cleave() { + changeState(DemonState.CLEAVE); + Entity target = ServiceLocator.getEntityService().getClosestEntityOfLayer(demon, + PhysicsLayer.HUMANS); + CombatStatsComponent targetCombatStats = target. + getComponent(CombatStatsComponent.class); + Timer.schedule(new Timer.Task() { + @Override + public void run() { + targetCombatStats.hit(CLEAVE_DAMAGE); + } + }, 2f); + } + + /** + * When at half health demon starts healing by a certain amount every second + */ + private void halfHealth() { + changeState(DemonState.CAST); + isHealing = true; + Timer.schedule(new Timer.Task() { + @Override + public void run() { + isHealing = false; + } + }, HEAL_TIMES); + + // add health every 10s + for (int i = 0; i < HEAL_TIMES; i++) { + Timer.schedule(new Timer.Task() { + @Override + public void run() { + demon.getComponent(CombatStatsComponent.class).addHealth(HEALTH_TO_ADD); + } + }, (float) i /2); + } + } +} + diff --git a/source/core/src/main/com/csse3200/game/components/tasks/FinalBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java similarity index 95% rename from source/core/src/main/com/csse3200/game/components/tasks/FinalBossMovementTask.java rename to source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java index f4c3fc9c5..3cdf87858 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/FinalBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java @@ -1,10 +1,12 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.bosstask; import com.badlogic.gdx.math.Vector2; import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.ai.tasks.Task; import com.csse3200.game.components.ProjectileEffects; +import com.csse3200.game.components.tasks.MovementTask; +import com.csse3200.game.components.tasks.WaitTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; @@ -118,7 +120,7 @@ private void startSwappingLane() { currentTask.stop(); - float laneHeight = viewportHeight / 8; + float laneHeight = (float) (viewportHeight / 8); if (currLane == 0) { // Move up diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bossDeathTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/MobBossDeathTask.java similarity index 94% rename from source/core/src/main/com/csse3200/game/components/tasks/bossDeathTask.java rename to source/core/src/main/com/csse3200/game/components/tasks/bosstask/MobBossDeathTask.java index 8bbec6617..3d02358f2 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bossDeathTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/MobBossDeathTask.java @@ -1,4 +1,4 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.bosstask; import com.badlogic.gdx.math.Vector2; import com.csse3200.game.ai.tasks.DefaultTask; @@ -16,7 +16,7 @@ /** * Task that prints a message to the terminal whenever it is called. */ -public class bossDeathTask extends DefaultTask implements PriorityTask { +public class MobBossDeathTask extends DefaultTask implements PriorityTask { private static final int INTERVAL = 1; // time interval to scan for towers in private final int priority; @@ -31,7 +31,7 @@ public class bossDeathTask extends DefaultTask implements PriorityTask { /** * @param priority Task priority when shooting (0 when not chasing). */ - public bossDeathTask(int priority) { + public MobBossDeathTask(int priority) { this.priority = priority; physics = ServiceLocator.getPhysicsService().getPhysics(); @@ -117,5 +117,4 @@ private void dropCurrency() { ServiceLocator.getEntityService().register(scrap.setScale(2,2)); } - } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java new file mode 100644 index 000000000..bbfb4d4e0 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java @@ -0,0 +1,256 @@ +package com.csse3200.game.components.tasks.bosstask; + +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Timer; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.ProjectileEffects; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.physics.PhysicsEngine; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.PhysicsMovementComponent; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.GameTime; +import com.csse3200.game.services.ServiceLocator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PatrickTask extends DefaultTask implements PriorityTask { + + // Constants + private static final int PRIORITY = 3; + private static final Vector2 PATRICK_SPEED = new Vector2(1f, 1f); + private static final float MAX_RADIUS = 20f; + private static final int ATTACK_DAMAGE = 100; + private static final float RANGE_MIN_X = 10f; + private static final float RANGE_MAX_X = 18f; + private static final float RANGE_MIN_Y = 1f; + private static final float RANGE_MAX_Y = 6f; + private static final int HALF_HEALTH_ATTACKS = 5; + + // Private variables + private static final Logger logger = LoggerFactory.getLogger(PatrickTask.class); + private Vector2 currentPos; + private PhysicsEngine physics; + private GameTime gameTime; + private PatrickState state = PatrickState.IDLE; + private PatrickState prevState; + private AnimationRenderComponent animation; + private Entity patrick; + private int shotsFired; + private PatrickTeleportTask teleportTask; + private Vector2 initialPos; + private Entity meleeTarget; + + // Flags + private boolean meleeFlag = false; + private boolean rangeFlag = false; + private boolean spawnFlag = false; + private boolean halfHealthFlag = false; + private boolean teleportFlag = false; + private boolean startFlag = false; + private enum PatrickState { + IDLE, WALK, ATTACK, HURT, DEATH, SPELL, APPEAR + } + + public PatrickTask() { + physics = ServiceLocator.getPhysicsService().getPhysics(); + gameTime = ServiceLocator.getTimeSource(); + } + + @Override + public void start() { + super.start(); + patrick = owner.getEntity(); + animation = owner.getEntity().getComponent(AnimationRenderComponent.class); // get animation + currentPos = owner.getEntity().getPosition(); // get current position + patrick.getComponent(PhysicsMovementComponent.class).setSpeed(PATRICK_SPEED); // set speed + + // give game time to load + Timer.schedule(new Timer.Task() { + @Override + public void run() { + changeState(PatrickState.APPEAR); + startFlag = true; + spawnFlag = true; + } + }, 0.1f); + } + + @Override + public void update() { + // give game time to load + if (!startFlag) { + return; + } + + // update teleport task while teleporting + if (teleportFlag) { + teleportTask.update(); + if (teleportTask.getStatus().equals(Status.FINISHED)) { + teleportFlag = false; + changeState(PatrickState.APPEAR); + } else { + return; + } + } + + animate(); + int health = patrick.getComponent(CombatStatsComponent.class).getHealth(); + + // detect half health + if (health <= patrick.getComponent(CombatStatsComponent.class).getMaxHealth() / 2 && + !halfHealthFlag) { + halfHealth(); + halfHealthFlag = true; + } + + // handle state switches + switch (state) { + case APPEAR -> { + if (spawnFlag) { + meleeAttack(); + spawnFlag = false; + } else if (meleeFlag) { + changeState(PatrickState.ATTACK); + meleeFlag = false; + } else if (rangeFlag) { + // shoot 3 projectiles + if (shotsFired > 2) { + rangeFlag = false; + spawnFlag = true; + shotsFired = 0; // reset shots fired + } else { + changeState(PatrickState.IDLE); + } + } + } + case IDLE -> { + if (animation.isFinished()) { + rangeAttack(); + } + } + case ATTACK -> { + if (animation.isFinished()) { + meleeTarget.getComponent(CombatStatsComponent.class).hit(ATTACK_DAMAGE); + teleport(initialPos); + rangeFlag = true; + } + } + } + } + + /** + * Changes the state of patrick + * @param state state to be changed to + */ + private void changeState(PatrickState state) { + prevState = this.state; + this.state = state; + } + + /** + * Changes the animation of the demon if a state change occurs + */ + private void animate() { + // Check if same animation is being called + if (prevState.equals(state)) { + return; // skip rest of function + } + + switch (state) { + case IDLE -> owner.getEntity().getEvents().trigger("patrick_idle"); + case WALK -> owner.getEntity().getEvents().trigger("patrick_walk"); + case HURT -> owner.getEntity().getEvents().trigger("patrick_hurt"); + case SPELL -> owner.getEntity().getEvents().trigger("patrick_spell"); + case APPEAR -> owner.getEntity().getEvents().trigger("patrick_death"); + case ATTACK -> owner.getEntity().getEvents().trigger("patrick_attack"); + default -> logger.debug("Patrick animation {state} not found"); + } + prevState = state; + } + + @Override + public int getPriority() { + return PRIORITY; + } + + private ProjectileEffects getEffect() { + int randomNumber = MathUtils.random(0, 3); + switch (randomNumber) { + case 1 -> { + return ProjectileEffects.BURN; + } + case 2 -> { + return ProjectileEffects.SLOW; + } + case 3 -> { + return ProjectileEffects.STUN; + } + default -> { + return ProjectileEffects.FIREBALL; + } + } + } + + private void teleport(Vector2 pos) { + teleportTask = new PatrickTeleportTask(patrick, pos); + teleportTask.create(owner); + teleportTask.start(); + teleportFlag = true; + } + + private void meleeAttack() { + initialPos = patrick.getPosition(); + meleeTarget = ServiceLocator.getEntityService().getClosestEntityOfLayer( + patrick, PhysicsLayer.HUMANS); + teleport(meleeTarget.getPosition()); + meleeFlag = true; + } + + private void spawnRandProjectile(Vector2 destination) { + // spawn random projectile + Entity projectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.HUMANS, + destination, new Vector2(2, 2), + getEffect(), false); + projectile.setPosition(patrick.getPosition().x, patrick.getPosition().y); + projectile.setScale(-1f, 1f); + ServiceLocator.getEntityService().register(projectile); + shotsFired++; + } + + private void randomTeleport() { + // teleport to random position + float randomX = MathUtils.random(RANGE_MIN_X, RANGE_MAX_X); + float randomY = MathUtils.random(RANGE_MIN_Y, RANGE_MAX_Y); + teleport(new Vector2(randomX, randomY)); + } + + private void rangeAttack() { + randomTeleport(); + spawnRandProjectile(new Vector2(0f, patrick.getPosition().y)); + } + + private void halfHealth() { + float startAngle = (float) Math.toRadians(135); + float endAngle = (float) Math.toRadians(225); + float angleIncrement = (endAngle - startAngle) / (HALF_HEALTH_ATTACKS - 1); + + for (int i = 0; i < HALF_HEALTH_ATTACKS; i++) { + randomTeleport(); + + // calculate unit vectors for projectiles + float currentAngle = startAngle + i * angleIncrement; + float x = MathUtils.cos(currentAngle) * 20; + float y = MathUtils.sin(currentAngle) * 20; + Vector2 destination = new Vector2(x, y); + spawnRandProjectile(destination); + } + if (shotsFired == HALF_HEALTH_ATTACKS) { + meleeFlag = true; + } + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java new file mode 100644 index 000000000..54ef0e71a --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java @@ -0,0 +1,94 @@ +package com.csse3200.game.components.tasks.bosstask; + +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.tasks.MovementTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.MobBossFactory; +import com.csse3200.game.rendering.AnimationRenderComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PatrickTeleportTask extends DefaultTask { + private static final Logger logger = LoggerFactory.getLogger(MovementTask.class); + private Entity patrick; + private final Vector2 location; + private PatrickState state = PatrickState.IDLE; + private PatrickState prevState; + private AnimationRenderComponent animation; + private Status status = Status.INACTIVE; + private int health; + private enum PatrickState { + CAST, APPEAR, SPELL, IDLE + } + + public PatrickTeleportTask(Entity patrick, Vector2 location) { + this.patrick = patrick; + this.location = location; + } + + @Override + public void start() { + super.start(); + animation = owner.getEntity().getComponent(AnimationRenderComponent.class); + health = owner.getEntity().getComponent(CombatStatsComponent.class).getHealth(); + changeState(PatrickState.CAST); + } + + @Override + public void update() { + animate(); + + switch (state) { + case CAST -> { + if (animation.isFinished()) { + patrick.setPosition(location); + changeState(PatrickState.SPELL); + } + } + case SPELL -> { + if (animation.isFinished()) { + changeState(PatrickState.APPEAR); + } + } + case APPEAR -> { + if (animation.isFinished()) { + status = Status.FINISHED; + } + } + } + } + + /** + * Changes the state of patrick + * @param state state to be changed to + */ + private void changeState(PatrickState state) { + prevState = this.state; + this.state = state; + } + + /** + * Changes the animation of the demon if a state change occurs + */ + private void animate() { + // Check if same animation is being called + if (prevState.equals(state)) { + return; // skip rest of function + } + + switch (state) { + case SPELL -> owner.getEntity().getEvents().trigger("patrick_spell"); + case APPEAR -> owner.getEntity().getEvents().trigger("patrick_death"); + case CAST -> owner.getEntity().getEvents().trigger("patrick_cast"); + default -> logger.debug("Patrick animation {state} not found"); + } + prevState = state; + } + + @Override + public Status getStatus() { + return status; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/RangeBossTask.java similarity index 91% rename from source/core/src/main/com/csse3200/game/components/tasks/RangeBossTask.java rename to source/core/src/main/com/csse3200/game/components/tasks/bosstask/RangeBossTask.java index 52673faf7..ec7486a8e 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/RangeBossTask.java @@ -1,12 +1,11 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.bosstask; import com.badlogic.gdx.math.Vector2; import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.ai.tasks.Task; -import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.factories.ProjectileFactory; -import com.csse3200.game.components.ProjectileEffects; +import com.csse3200.game.components.tasks.MovementTask; +import com.csse3200.game.components.tasks.WaitTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; @@ -29,8 +28,8 @@ public class RangeBossTask extends DefaultTask implements PriorityTask { private WaitTask waitTask; private Task currentTask; /** Animation event names */ - private static final String START = "startMobKing"; - private static final String FINAL = "startMobKingFinal"; + private static final String START = "startMobBoss"; + private static final String FINAL = "startMobBossFinal"; private enum STATE { START, FINAL } @@ -69,7 +68,7 @@ public void start() { this.owner.getEntity().getEvents().trigger("rangeBossMovementStart"); } - public void switchMobKingBallState() { + public void switchMobBossBallState() { switch (bossBallState) { case START: owner.getEntity().getEvents().trigger(FINAL); @@ -90,7 +89,7 @@ public void update() { this.owner.getEntity().getEvents().trigger("attack1Start"); } owner.getEntity().getEvents().trigger(START); - switchMobKingBallState(); + switchMobBossBallState(); startWaiting(); } else { startMoving(); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java new file mode 100644 index 000000000..5cef0c8ec --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java @@ -0,0 +1,153 @@ +package com.csse3200.game.components.tasks.bosstask; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.tasks.MovementTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.PhysicsMovementComponent; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SlimeyBoyTask extends DefaultTask implements PriorityTask { + + // Constants + private static final int PRIORITY = 3; + private static final Vector2 SLIMEY_SPEED = new Vector2(0.5f, 0.5f); + private static final Vector2 DEFAULT_POS = new Vector2(0, 4); + private static final float MAX_RADIUS = 40f; + + // Private variables + private static final Logger logger = LoggerFactory.getLogger(SlimeyBoyTask.class); + private Entity slimey; + private AnimationRenderComponent animation; + private Vector2 currentPos; + private SlimeState state = SlimeState.IDLE; // set initial state to random unused state + private SlimeState prevState; + private Entity targetEntity; + + private enum SlimeState { + IDLE, MOVE, PROJECTILE_EXPLOSION, PROJECTILE_IDLE, TAKE_HIT, TRANSFORM + } + + @Override + public void start() { + super.start(); + slimey = owner.getEntity(); + animation = owner.getEntity().getComponent(AnimationRenderComponent.class); // get animation + currentPos = owner.getEntity().getPosition(); // get current position + slimey.getComponent(PhysicsMovementComponent.class).setSpeed(SLIMEY_SPEED); // set speed + changeState(SlimeState.TRANSFORM); + } + + @Override + public void update() { + animate(); + currentPos = slimey.getPosition(); + int health = slimey.getComponent(CombatStatsComponent.class).getHealth(); + + switch (state) { + case TRANSFORM -> { + if (animation.isFinished()) { + seekAndDestroy(); + } + } + case MOVE -> { + if (targetFound()) { + // do aoe damage based on how much health slime has left + applyAoeDamage(ServiceLocator.getEntityService().getEntitiesInLayer( + slimey, MAX_RADIUS, PhysicsLayer.HUMANS), health); + changeState(SlimeState.TAKE_HIT); + } + } + case TAKE_HIT -> { + slimey.setFlagForDelete(true); + } + } + } + + /** + * Changes the state of the demon + * @param state state to be changed to + */ + private void changeState(SlimeState state) { + prevState = this.state; + this.state = state; + } + + /** + * Changes the animation of the demon if a state change occurs + */ + private void animate() { + // Check if same animation is being called + if (prevState.equals(state)) { + return; // skip rest of function + } + + switch (state) { + case IDLE -> slimey.getEvents().trigger("idle"); + case MOVE -> slimey.getEvents().trigger("move"); + case PROJECTILE_EXPLOSION -> slimey.getEvents().trigger("projectile_explosion"); + case PROJECTILE_IDLE -> slimey.getEvents().trigger("projectile_idle"); + case TAKE_HIT -> slimey.getEvents().trigger("take_hit"); + case TRANSFORM -> slimey.getEvents().trigger("transform"); + default -> logger.debug("Slimey boy animation {state} not found"); + } + prevState = state; + } + + /** + * Find the closest human entity and start moving towards them + */ + private void seekAndDestroy() { + changeState(SlimeState.MOVE); + targetEntity = ServiceLocator.getEntityService().getClosestEntityOfLayer( + slimey, PhysicsLayer.HUMANS); + Vector2 targetPos; + if (targetEntity == null) { + targetPos = DEFAULT_POS; + } else { + targetPos = targetEntity.getPosition(); + } + MovementTask slimeyMovementTask = new MovementTask(targetPos); + slimeyMovementTask.create(owner); + slimeyMovementTask.start(); + slimey.getComponent(PhysicsMovementComponent.class).setSpeed(SLIMEY_SPEED); + } + + /** + * @return if target has been reached or not + */ + private boolean targetFound() { + if (targetEntity == null) { + return false; + } + return currentPos.dst(targetEntity.getPosition()) < 1; + } + + /** + * Applies aoe damage to nearby human entities + * @param targets array of human entities to deal damage to + */ + private void applyAoeDamage(Array targets, int damage) { + for (int i = 0; i < targets.size; i++) { + Entity targetEntity = targets.get(i); + + CombatStatsComponent targetCombatStats = targetEntity. + getComponent(CombatStatsComponent.class); + if (targetCombatStats != null) { + targetCombatStats.hit(damage); + } + } + } + + @Override + public int getPriority() { + return PRIORITY; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/human/EngineerCombatTask.java b/source/core/src/main/com/csse3200/game/components/tasks/human/EngineerCombatTask.java index 337218153..a6894551f 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/human/EngineerCombatTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/human/EngineerCombatTask.java @@ -3,7 +3,6 @@ import com.badlogic.gdx.math.Vector2; import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; -import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; diff --git a/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java index 8d9f9c03c..3fcd566f5 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java @@ -1,9 +1,7 @@ package com.csse3200.game.components.tower; -import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; -import com.csse3200.game.services.ServiceLocator; /** * Listens for events relevant to a weapon tower state. diff --git a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java index 6753b6ba1..0bfe1fe11 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java @@ -39,21 +39,21 @@ public void create() { } /** - * Starts the idle animation + * Starts the idle animation. */ void animateIdle() { animator.startAnimation(IDLE_ANIM); } /** - * starts the prep_attack animation + * Starts the prep_attack animation. */ void animatePrepAttack() { animator.startAnimation(PREP_ATTACK_ANIM); } /** - * starts the attack animation + * Starts the attack animation. */ void animateAttack() { animator.startAnimation(ATTACK_ANIM); diff --git a/source/core/src/main/com/csse3200/game/components/tower/TNTDamageComponent.java b/source/core/src/main/com/csse3200/game/components/tower/TNTDamageComponent.java index ece920971..775653651 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/TNTDamageComponent.java +++ b/source/core/src/main/com/csse3200/game/components/tower/TNTDamageComponent.java @@ -4,11 +4,8 @@ import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.Fixture; import com.badlogic.gdx.utils.Array; -import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.Component; -import com.csse3200.game.components.maingame.MainGameActions; -import com.csse3200.game.components.tasks.WaitTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.physics.BodyUserData; import com.csse3200.game.physics.PhysicsLayer; @@ -16,8 +13,6 @@ import com.csse3200.game.physics.components.PhysicsComponent; import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.services.ServiceLocator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Class responsible for applying damage and knock-back to nearby entities when triggered. diff --git a/source/core/src/main/com/csse3200/game/components/tower/TowerUpgraderComponent.java b/source/core/src/main/com/csse3200/game/components/tower/TowerUpgraderComponent.java index 07ead7edc..bc04c1d1d 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/TowerUpgraderComponent.java +++ b/source/core/src/main/com/csse3200/game/components/tower/TowerUpgraderComponent.java @@ -2,7 +2,6 @@ import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.Component; -import static java.lang.Math.round; /** * Listens for an event from the popup menu to upgrade diff --git a/source/core/src/main/com/csse3200/game/currency/Currency.java b/source/core/src/main/com/csse3200/game/currency/Currency.java index e1d5b3438..81820ad5f 100644 --- a/source/core/src/main/com/csse3200/game/currency/Currency.java +++ b/source/core/src/main/com/csse3200/game/currency/Currency.java @@ -1,6 +1,5 @@ package com.csse3200.game.currency; -import com.csse3200.game.entities.Entity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/source/core/src/main/com/csse3200/game/entities/EntityService.java b/source/core/src/main/com/csse3200/game/entities/EntityService.java index bafc5bfde..7adb4fc8e 100644 --- a/source/core/src/main/com/csse3200/game/entities/EntityService.java +++ b/source/core/src/main/com/csse3200/game/entities/EntityService.java @@ -2,17 +2,16 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Array; import com.csse3200.game.components.npc.DropComponent; import com.csse3200.game.input.DropInputComponent; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.services.ServiceLocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import java.security.Provider; import java.util.Comparator; /** @@ -26,6 +25,7 @@ public class EntityService { private static final Logger logger = LoggerFactory.getLogger(EntityService.class); private static final int INITIAL_CAPACITY = 16; private final Array entities = new Array<>(false, INITIAL_CAPACITY); + private static final float MAX_RADIUS = 50f; public static void removeEntity(Entity clickedEntity) { clickedEntity.dispose(); @@ -100,6 +100,60 @@ public Array getNearbyEntities(Entity source, float radius) { } return nearbyEntities; } + + /** + * Get entities within a certain radius of a given entity. + * + * @param source The reference entity to check distance from. + * @param radius The radius within which to fetch entities. + * @param layer Desired layer for entities to be in + * @return An array containing entities within the given radius. + */ + public Array getEntitiesInLayer(Entity source, float radius, short layer) { + Array entities = new Array(); + Array allEntities = getNearbyEntities(source, radius); + + for (int i = 0; i < allEntities.size; i++) { + Entity targetEntity = allEntities.get(i); + + // check targets layer + HitboxComponent targetHitbox = targetEntity.getComponent(HitboxComponent.class); + if (targetHitbox == null) { + continue; + } + if (!PhysicsLayer.contains(layer, targetHitbox.getLayer())) { + continue; + } + entities.add(targetEntity); + } + return entities; + } + + /** + * Returns the closest entity to the source of provided layer + * @param source source entity + * @param layer layer for desired entity to be returned + * @return closest entity of correct layer + */ + public Entity getClosestEntityOfLayer(Entity source, short layer) { + Entity closestHuman = null; + Vector2 sourcePos = source.getPosition(); + float closestDistance = MAX_RADIUS; + Array entitiesInLayer = getEntitiesInLayer(source, MAX_RADIUS, layer); + + for (int i = 0; i < entitiesInLayer.size; i++) { + Entity targetEntity = entitiesInLayer.get(i); + + // check how close target is to source + Vector2 targetPosition = targetEntity.getPosition(); + float distance = sourcePos.dst(targetPosition); + if (distance < closestDistance) { + closestHuman = targetEntity; + closestDistance = distance; + } + } + return closestHuman; + } public Entity getEntityAtPosition(float x, float y) { entities.sort(Comparator.comparingInt(Entity::getLayer)); diff --git a/source/core/src/main/com/csse3200/game/entities/Melee.java b/source/core/src/main/com/csse3200/game/entities/Melee.java index cae030e08..520aebf09 100644 --- a/source/core/src/main/com/csse3200/game/entities/Melee.java +++ b/source/core/src/main/com/csse3200/game/entities/Melee.java @@ -1,7 +1,5 @@ package com.csse3200.game.entities; -import java.util.ArrayList; - /** * Melee is a Weapon which has a minimum range to be used at * diff --git a/source/core/src/main/com/csse3200/game/entities/PredefinedWeapons.java b/source/core/src/main/com/csse3200/game/entities/PredefinedWeapons.java index 5955f34f6..78dfffdd2 100644 --- a/source/core/src/main/com/csse3200/game/entities/PredefinedWeapons.java +++ b/source/core/src/main/com/csse3200/game/entities/PredefinedWeapons.java @@ -1,6 +1,5 @@ package com.csse3200.game.entities; -import com.csse3200.game.entities.configs.NPCConfigs; import com.csse3200.game.entities.configs.ProjectileConfig; public class PredefinedWeapons { diff --git a/source/core/src/main/com/csse3200/game/entities/configs/BossKingConfigs.java b/source/core/src/main/com/csse3200/game/entities/configs/MobBossConfigs.java similarity index 80% rename from source/core/src/main/com/csse3200/game/entities/configs/BossKingConfigs.java rename to source/core/src/main/com/csse3200/game/entities/configs/MobBossConfigs.java index 2cc53542c..c17389da6 100644 --- a/source/core/src/main/com/csse3200/game/entities/configs/BossKingConfigs.java +++ b/source/core/src/main/com/csse3200/game/entities/configs/MobBossConfigs.java @@ -3,7 +3,7 @@ /** * Defines the properties stored in ghost king config files to be loaded by the NPC Factory. */ -public class BossKingConfigs extends BaseEntityConfig { +public class MobBossConfigs extends BaseEntityConfig { public int spookyFactor = 0; public int health = 1; public int baseAttack = 0; diff --git a/source/core/src/main/com/csse3200/game/entities/configs/NPCConfigs.java b/source/core/src/main/com/csse3200/game/entities/configs/NPCConfigs.java index 3bc7d9eb2..8faed4421 100644 --- a/source/core/src/main/com/csse3200/game/entities/configs/NPCConfigs.java +++ b/source/core/src/main/com/csse3200/game/entities/configs/NPCConfigs.java @@ -23,6 +23,6 @@ public class NPCConfigs { new ArrayList(), 10); - public BossKingConfigs BossKing = new BossKingConfigs(); + public MobBossConfigs mobBoss = new MobBossConfigs(); } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java deleted file mode 100644 index f293b665c..000000000 --- a/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.csse3200.game.entities.factories; - -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.components.*; -import com.csse3200.game.components.npc.Boss1AnimationController; -import com.csse3200.game.components.npc.Boss2AnimationController; -import com.csse3200.game.components.tasks.FinalBossMovementTask; -import com.csse3200.game.components.tasks.RangeBossTask; -import com.csse3200.game.components.tasks.bossDeathTask; -import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.configs.BossKingConfigs; -import com.csse3200.game.entities.configs.NPCConfigs; -import com.csse3200.game.files.FileLoader; -import com.csse3200.game.physics.PhysicsLayer; -import com.csse3200.game.physics.PhysicsUtils; -import com.csse3200.game.physics.components.*; -import com.csse3200.game.rendering.AnimationRenderComponent; -import com.csse3200.game.services.ServiceLocator; - -public class BossKingFactory { - - private static final NPCConfigs configs = FileLoader.readClass(NPCConfigs.class, "configs/Boss.json"); - private static final int PRIORITY = 1; - private static final int BOSS_MOB_AGRO_RANGE = 10; - - // Create Boss King 1 - public static Entity createBossKing1(Entity target, int numLane) { - BossKingConfigs config = configs.BossKing; - Entity bossKing1 = createBaseBoss(target); - - AITaskComponent aiTaskComponent1 = new AITaskComponent() - .addTask(new FinalBossMovementTask(1f, numLane)) - .addTask(new bossDeathTask(1));; - - // Animation section - AnimationRenderComponent animator1 = new AnimationRenderComponent( - ServiceLocator.getResourceService().getAsset("images/mobs/robot.atlas", TextureAtlas.class)); - animator1.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP_REVERSED); - - bossKing1.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) - .addComponent(animator1) - .addComponent(aiTaskComponent1) - .addComponent(new Boss1AnimationController()); - - bossKing1.getComponent(AnimationRenderComponent.class).scaleEntity(); - bossKing1.setScale(1f, 1f); - - return bossKing1; - } - - // Create Boss King 2 - public static Entity createBossKing2(Entity target) { - BossKingConfigs config = configs.BossKing; - Entity bossKing2 = createBaseBoss(target); - - AITaskComponent aiTaskComponent2 = new AITaskComponent() - .addTask(new RangeBossTask(2f)); - - // Animation section - AnimationRenderComponent animator2 = new AnimationRenderComponent( - ServiceLocator.getResourceService().getAsset("images/mobs/boss2.atlas", TextureAtlas.class)); - animator2.addAnimation("boss_death", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Idle", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Charging", 0.3f, Animation.PlayMode.LOOP_REVERSED); - animator2.addAnimation("A1", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("A2", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Hurt", 0.3f, Animation.PlayMode.LOOP); - - bossKing2.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) - .addComponent(animator2) - .addComponent(aiTaskComponent2) - .addComponent(new Boss2AnimationController()) - .addComponent(new PhysicsComponent()); - - bossKing2.getComponent(AnimationRenderComponent.class).scaleEntity(); - bossKing2.scaleHeight(3f); - bossKing2.scaleWidth(3f); - - return bossKing2; - } - - // Create the base boss entity - private static Entity createBaseBoss(Entity target) { - Entity boss = new Entity() - .addComponent(new PhysicsComponent()) - .addComponent(new ColliderComponent()) - .addComponent(new PhysicsMovementComponent()) - .addComponent(new HitboxComponent().setLayer(PhysicsLayer.NPC)) - .addComponent(new TouchAttackComponent(PhysicsLayer.HUMANS, 1.5f)); - - PhysicsUtils.setScaledCollider(boss, 0.9f, 0.4f); - - return boss; - } - - private BossKingFactory() { - throw new IllegalStateException("Instantiating static util class"); - } -} diff --git a/source/core/src/main/com/csse3200/game/entities/factories/DropFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/DropFactory.java index b8144b52e..d18942372 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/DropFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/DropFactory.java @@ -2,10 +2,8 @@ import com.csse3200.game.components.npc.DropComponent; import com.csse3200.game.currency.Crystal; -import com.csse3200.game.currency.Currency; import com.csse3200.game.currency.Scrap; import com.csse3200.game.entities.Entity; -import com.csse3200.game.input.DropInputComponent; import com.csse3200.game.rendering.TextureRenderComponent; public class DropFactory { diff --git a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java new file mode 100644 index 000000000..06bbd6fcf --- /dev/null +++ b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java @@ -0,0 +1,205 @@ +package com.csse3200.game.entities.factories; + +import com.badlogic.gdx.graphics.g2d.Animation; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.csse3200.game.ai.tasks.AITaskComponent; +import com.csse3200.game.components.*; +import com.csse3200.game.components.bosses.DemonAnimationController; +import com.csse3200.game.components.bosses.PatrickAnimationController; +import com.csse3200.game.components.npc.Boss1AnimationController; +import com.csse3200.game.components.npc.Boss2AnimationController; +import com.csse3200.game.components.tasks.bosstask.*; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.configs.MobBossConfigs; +import com.csse3200.game.entities.configs.NPCConfigs; +import com.csse3200.game.files.FileLoader; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.PhysicsUtils; +import com.csse3200.game.physics.components.*; +import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; + +public class MobBossFactory { + + private static final NPCConfigs configs = FileLoader.readClass(NPCConfigs.class, "configs/Boss.json"); + private static final int PRIORITY = 1; + private static final int BOSS_MOB_AGRO_RANGE = 10; + private static final int DEMON_HEALTH = 5000; + private static final int DEMON_ATTACK = 0; + private static final int PATRICK_ATTACK = 0; + + // Create Demon Boss + public static Entity createDemonBoss() { + Entity demon = createBaseBoss(); + + // Animation addition + AnimationRenderComponent animator = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobboss/demon.atlas", + TextureAtlas.class)); + animator.addAnimation("demon_cast_spell", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("demon_cleave", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("demon_death", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("demon_fire_breath", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("demon_idle", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("demon_smash", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("demon_take_hit", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("demon_walk", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("transform", 0.2f, Animation.PlayMode.NORMAL); + + // AI task addition + AITaskComponent aiTaskComponent = new AITaskComponent() + .addTask(new DemonBossTask()); + + // Component addition + demon + .addComponent(animator) + .addComponent(new DemonAnimationController()) + .addComponent(aiTaskComponent) + .addComponent(new CombatStatsComponent(DEMON_HEALTH, DEMON_ATTACK)); + + // Scale demon + demon.getComponent(AnimationRenderComponent.class).scaleEntity(); + demon.scaleHeight(5f); + demon.scaleWidth(5f); + return demon; + } + + public static Entity createSlimeyBoy() { + Entity slimeyBoy = createBaseBoss(); + + // Animation + AnimationRenderComponent animator = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobboss/demon.atlas", + TextureAtlas.class)); + animator.addAnimation("idle", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("move", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("projectile_explosion", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("projectile_idle", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("take_hit", 0.2f, Animation.PlayMode.LOOP); + animator.addAnimation("transform", 0.2f, Animation.PlayMode.REVERSED); + + // AI task addition + AITaskComponent aiTaskComponent = new AITaskComponent() + .addTask(new SlimeyBoyTask()); + + // Component addition + slimeyBoy + .addComponent(animator) + .addComponent(new DemonAnimationController()) + .addComponent(aiTaskComponent) + .addComponent(new CombatStatsComponent(500, 0)); + + // Scale demon + slimeyBoy.getComponent(AnimationRenderComponent.class).scaleEntity(); + slimeyBoy.scaleHeight(5f); + slimeyBoy.scaleWidth(5f); + return slimeyBoy; + } + + public static Entity createPatrickBoss(int health) { + Entity demon = createBaseBoss(); + + // Animation addition + AnimationRenderComponent animator = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobboss/patrick.atlas", TextureAtlas.class)); + animator.addAnimation("patrick_attack", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("patrick_cast", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("patrick_death", 0.2f, Animation.PlayMode.REVERSED); + animator.addAnimation("patrick_hurt", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("patrick_idle", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("patrick_spell", 0.2f, Animation.PlayMode.NORMAL); + animator.addAnimation("patrick_walk", 0.2f, Animation.PlayMode.LOOP); + + // AI task addition + AITaskComponent aiTaskComponent = new AITaskComponent() + .addTask(new PatrickTask()); + + // Component addition + demon + .addComponent(animator) + .addComponent(new PatrickAnimationController()) + .addComponent(aiTaskComponent) + .addComponent(new CombatStatsComponent(health, PATRICK_ATTACK)); + + // Scale demon + demon.getComponent(AnimationRenderComponent.class).scaleEntity(); + demon.scaleHeight(4f); + demon.scaleWidth(4f); + return demon; + } + + // Create Boss King 1 + public static Entity createMobBoss1(int numLane) { + MobBossConfigs config = configs.mobBoss; + Entity mobBoss1 = createBaseBoss(); + + AITaskComponent aiTaskComponent1 = new AITaskComponent() + .addTask(new FinalBossMovementTask(1f, numLane)) + .addTask(new MobBossDeathTask(1));; + + // Animation section + AnimationRenderComponent animator1 = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/robot.atlas", TextureAtlas.class)); + animator1.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP_REVERSED); + + mobBoss1.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) + .addComponent(animator1) + .addComponent(aiTaskComponent1) + .addComponent(new Boss1AnimationController()); + + mobBoss1.getComponent(AnimationRenderComponent.class).scaleEntity(); + mobBoss1.setScale(1f, 1f); + + return mobBoss1; + } + + // Create Boss King 2 + public static Entity createMobBoss2() { + MobBossConfigs config = configs.mobBoss; + Entity mobBoss2 = createBaseBoss(); + + AITaskComponent aiTaskComponent2 = new AITaskComponent() + .addTask(new RangeBossTask(2f)); + + // Animation section + AnimationRenderComponent animator2 = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/boss2.atlas", TextureAtlas.class)); + animator2.addAnimation("boss_death", 0.3f, Animation.PlayMode.LOOP); + animator2.addAnimation("Idle", 0.3f, Animation.PlayMode.LOOP); + animator2.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP); + animator2.addAnimation("Charging", 0.3f, Animation.PlayMode.LOOP_REVERSED); + animator2.addAnimation("A1", 0.3f, Animation.PlayMode.LOOP); + animator2.addAnimation("A2", 0.3f, Animation.PlayMode.LOOP); + animator2.addAnimation("Hurt", 0.3f, Animation.PlayMode.LOOP); + + mobBoss2.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) + .addComponent(animator2) + .addComponent(aiTaskComponent2) + .addComponent(new Boss2AnimationController()) + .addComponent(new PhysicsComponent()); + + mobBoss2.getComponent(AnimationRenderComponent.class).scaleEntity(); + mobBoss2.scaleHeight(3f); + mobBoss2.scaleWidth(3f); + + return mobBoss2; + } + + // Create the base boss entity + private static Entity createBaseBoss() { + Entity boss = new Entity() + .addComponent(new PhysicsComponent()) + .addComponent(new ColliderComponent()) + .addComponent(new PhysicsMovementComponent()) + .addComponent(new HitboxComponent().setLayer(PhysicsLayer.NPC)) + .addComponent(new TouchAttackComponent(PhysicsLayer.HUMANS, 1.5f)); + + PhysicsUtils.setScaledCollider(boss, 0.9f, 0.4f); + + return boss; + } + + private MobBossFactory() { + throw new IllegalStateException("Instantiating static util class"); + } +} diff --git a/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java index 331ffd8f8..ec1ed1136 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java @@ -6,10 +6,22 @@ import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.TouchAttackComponent; +import com.csse3200.game.components.npc.DeflectingComponent; +import com.csse3200.game.components.npc.DodgingComponent; +import com.csse3200.game.components.npc.DragonKnightAnimationController; +import com.csse3200.game.components.npc.FireWormAnimationController; import com.csse3200.game.components.npc.GhostAnimationController; +import com.csse3200.game.components.npc.SkeletonAnimationController; +import com.csse3200.game.components.npc.SplitMoblings; +import com.csse3200.game.components.npc.WaterQueenAnimationController; +import com.csse3200.game.components.npc.WaterSlimeAnimationController; +import com.csse3200.game.components.npc.WizardAnimationController; import com.csse3200.game.components.npc.XenoAnimationController; import com.csse3200.game.components.tasks.MobAttackTask; +import com.csse3200.game.components.tasks.MobDodgeTask; +import com.csse3200.game.components.tasks.MobShootTask; import com.csse3200.game.components.tasks.MobWanderTask; +import com.csse3200.game.components.tasks.NewMobWanderTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.Melee; import com.csse3200.game.entities.PredefinedWeapons; @@ -46,11 +58,10 @@ public class NPCFactory { /** * Creates a ghost entity. * - * @param target entity to chase * @return entity */ - public static Entity createGhost(Entity target) { - Entity ghost = createBaseNPC(target); + public static Entity createGhost() { + Entity ghost = createBaseNPC(); BaseEntityConfig config = configs.ghost; /** AnimationRenderComponent animator = @@ -71,13 +82,12 @@ public static Entity createGhost(Entity target) { } /** - - Creates a ghost king entity.* - @param target entity to chase - @return entity + * Creates a ghost king entity. + * + * @return entity */ - public static Entity createGhostKing(Entity target) { - Entity ghostKing = createBaseNPC(target); + public static Entity createGhostKing() { + Entity ghostKing = createBaseNPC(); GhostKingConfig config = configs.ghostKing; AnimationRenderComponent animator = @@ -96,14 +106,196 @@ public static Entity createGhostKing(Entity target) { return ghostKing; } + /** + * Creates a fire worm entity. + * + * @return entity + */ + public static Entity createSkeleton() { + Entity skeleton = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/skeleton.atlas", TextureAtlas.class)); + animator.addAnimation("skeleton_walk", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("skeleton_attack", 0.1f); + animator.addAnimation("skeleton_death", 0.1f); + animator.addAnimation("default", 0.1f); + skeleton + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new SkeletonAnimationController()); + + skeleton.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.CENTER); + skeleton.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return skeleton; + } + + /** + * Creates a wizard entity. + * + * @return entity + */ + public static Entity createWizard() { + Entity wizard = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/wizard.atlas", TextureAtlas.class)); + animator.addAnimation("wizard_run", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("wizard_attack", 0.1f); + animator.addAnimation("wizard_death", 0.1f); + animator.addAnimation("default", 0.1f); + wizard + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new WizardAnimationController()); + + wizard.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.CENTER); + wizard.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return wizard; + } + /** + * Creates a wizard entity. + * + * @return entity + */ + public static Entity createWaterQueen() { + Entity wizard = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/water_queen.atlas", TextureAtlas.class)); + animator.addAnimation("water_queen_walk", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("water_queen_attack", 0.1f); + animator.addAnimation("water_queen_death", 0.1f); + animator.addAnimation("default", 0.1f); + wizard + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new WaterQueenAnimationController()); + + wizard.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.CENTER); + wizard.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return wizard; + } + /** + * Creates a wizard entity. + * + * @return entity + */ + public static Entity createWaterSlime() { + Entity waterSlime = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/water_slime.atlas", TextureAtlas.class)); + animator.addAnimation("water_slime_walk", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("water_slime_attack", 0.1f); + animator.addAnimation("water_slime_death", 0.1f); + animator.addAnimation("default", 0.1f); + waterSlime + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new WaterSlimeAnimationController()); + + waterSlime.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.CENTER); + waterSlime.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return waterSlime; + } + /** + * Creates a fire worm entity. + * + * @return entity + */ + public static Entity createFireWorm() { + Entity fireWorm = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/fire_worm.atlas", TextureAtlas.class)); + animator.addAnimation("fire_worm_walk", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("fire_worm_attack", 0.1f); + animator.addAnimation("fire_worm_death", 0.1f); + animator.addAnimation("default", 0.1f); + fireWorm + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new FireWormAnimationController()); + + fireWorm.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.CENTER); + fireWorm.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return fireWorm; + } + /** + * Creates a dragon Knight entity + * + * @return entity + */ + public static Entity createDragonKnight() { + Entity dragonKnight = createBaseNPC(); + BaseEnemyConfig config = configs.xenoGrunt; + ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); + // tester projectiles + ArrayList projectiles = new ArrayList<>(Arrays.asList(PredefinedWeapons.fireBall, PredefinedWeapons.frostBall)); + ArrayList drops = new ArrayList<>(); + + AnimationRenderComponent animator = + new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobs/dragon_knight.atlas", TextureAtlas.class)); + animator.addAnimation("dragon_knight_run", 0.1f, Animation.PlayMode.LOOP); + animator.addAnimation("dragon_knight_attack", 0.1f); + animator.addAnimation("dragon_knight_death", 0.1f); + animator.addAnimation("default", 0.1f); + dragonKnight + .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) + .addComponent(animator) + .addComponent(new DragonKnightAnimationController()); + + dragonKnight.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.BOTTOM); + dragonKnight.getComponent(AnimationRenderComponent.class).scaleEntity(); + + return dragonKnight; + } + + /** * Creates a xeno grunt entity. * - * @param target entity to chase * @return entity */ - public static Entity createXenoGrunt(Entity target) { - Entity xenoGrunt = createBaseNPC(target); + public static Entity createXenoGrunt() { + Entity xenoGrunt = createBaseNPC(); BaseEnemyConfig config = configs.xenoGrunt; ArrayList melee = new ArrayList<>(Arrays.asList(PredefinedWeapons.sword, PredefinedWeapons.kick)); // tester projectiles @@ -119,6 +311,7 @@ public static Entity createXenoGrunt(Entity target) { animator.addAnimation("xeno_melee_1", 0.1f); animator.addAnimation("xeno_melee_2", 0.1f); animator.addAnimation("xeno_die", 0.1f); + animator.addAnimation("default", 0.1f); xenoGrunt .addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles)) .addComponent(animator) @@ -130,16 +323,20 @@ public static Entity createXenoGrunt(Entity target) { return xenoGrunt; } + + /** * Creates a generic NPC to be used as a base entity by more specific NPC creation methods. * * @return entity */ - public static Entity createBaseNPC(Entity target) { + public static Entity createBaseNPC() { AITaskComponent aiComponent = new AITaskComponent() .addTask(new MobWanderTask(new Vector2(2f, 2f), 2f)) .addTask(new MobAttackTask(2, 40)); + + // .addTask(new MobAttackTask(2, 40)); Entity npc = new Entity() .addComponent(new PhysicsComponent()) @@ -148,7 +345,6 @@ public static Entity createBaseNPC(Entity target) { .addComponent(new HitboxComponent().setLayer(PhysicsLayer.XENO)) .addComponent(new TouchAttackComponent(PhysicsLayer.HUMANS)) .addComponent(aiComponent); - PhysicsUtils.setScaledCollider(npc, 0.3f, 0.5f); return npc; } @@ -156,6 +352,38 @@ public static Entity createBaseNPC(Entity target) { private NPCFactory() { throw new IllegalStateException("Instantiating static util class"); } + + // * COW'S TESTING ARENA DONT TOUCH + public static Entity createSplittingXenoGrunt() { + Entity splitXenoGrunt = createXenoGrunt() + // add the scaling yourself. can also scale the X and Y component, + // leading to some very interesting mob designs. + .addComponent(new SplitMoblings(7, 0.5f)) + .addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f)); + + // * TEMPORARY TESTING FOR PROJECTILE DODGING + splitXenoGrunt.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + return splitXenoGrunt; + } + + public static Entity createDodgingDragonKnight() { + Entity fireWorm = createDragonKnight(); + + fireWorm.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f)); + + fireWorm.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + + return fireWorm; + } + + public static Entity createDeflectXenoGrunt() { + Entity deflectXenoGrunt = createXenoGrunt(); + deflectXenoGrunt.addComponent(new DeflectingComponent( + PhysicsLayer.PROJECTILE, PhysicsLayer.TOWER, 10)); + + return deflectXenoGrunt; + } + } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java index 80bbc26b8..d77ff1d1d 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java @@ -2,6 +2,7 @@ import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.components.CombatStatsComponent; +import com.csse3200.game.components.TouchAttackComponent; import com.csse3200.game.components.player.InventoryComponent; import com.csse3200.game.components.player.PlayerActions; import com.csse3200.game.components.player.PlayerStatsDisplay; @@ -43,9 +44,10 @@ public static Entity createPlayer() { .addComponent(new TextureRenderComponent("images/box_boy_leaf.png")) .addComponent(new PhysicsComponent()) .addComponent(new ColliderComponent()) - .addComponent(new HitboxComponent().setLayer(PhysicsLayer.ENGINEER)) + .addComponent(new TouchAttackComponent(PhysicsLayer.NPC)) + .addComponent(new HitboxComponent().setLayer(PhysicsLayer.HUMANS)) .addComponent(new PlayerActions()) - .addComponent(new CombatStatsComponent(stats.health, stats.baseAttack)) + .addComponent(new CombatStatsComponent(1000, 5000)) .addComponent(new InventoryComponent(stats.gold)) .addComponent(inputComponent) .addComponent(aiComponent) diff --git a/source/core/src/main/com/csse3200/game/entities/factories/ProjectileFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/ProjectileFactory.java index a63532e89..ce160b65b 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/ProjectileFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/ProjectileFactory.java @@ -3,18 +3,10 @@ import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.csse3200.game.components.*; +import com.csse3200.game.components.MobProjectileAnimationController; import com.csse3200.game.components.tasks.TrajectTask; import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.components.EffectsComponent; -import com.csse3200.game.components.ProjectileEffects; -import com.csse3200.game.components.TouchAttackComponent; -import com.csse3200.game.components.RicochetComponent; -import com.csse3200.game.components.SplitFireworksComponent; import com.csse3200.game.components.projectile.*; -import com.csse3200.game.components.tasks.TrajectTask; -import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.components.CombatStatsComponent; -import com.csse3200.game.components.DeleteOnMapEdgeComponent; import com.csse3200.game.entities.configs.BaseEntityConfig; import com.csse3200.game.entities.configs.NPCConfigs; import com.csse3200.game.files.FileLoader; @@ -298,27 +290,27 @@ public static Entity createBossBall(short targetLayer, Vector2 destination, Vect } /** - * Creates a projectile to be used by the MobKing + * Creates a projectile to be used by the MobBoss * * @param targetLayer The enemy layer that the projectile collides with. * @param destination The destination the projectile heads towards. * @param speed The speed of the projectile. * @return Returns a new fireball projectile entity. */ - public static Entity createMobKingBall(short targetLayer, Vector2 destination, Vector2 speed) { + public static Entity createMobBossBall(short targetLayer, Vector2 destination, Vector2 speed) { Entity projectile = createBaseProjectile(targetLayer, destination, speed); AnimationRenderComponent animator = new AnimationRenderComponent( ServiceLocator.getResourceService() - .getAsset("images/projectiles/mobKing_projectile.atlas", TextureAtlas.class)); + .getAsset("images/projectiles/mobBoss_projectile.atlas", TextureAtlas.class)); animator.addAnimation("mob_boss", 0.17f, Animation.PlayMode.NORMAL); animator.addAnimation("mob_bossFinal", 0.17f, Animation.PlayMode.NORMAL); projectile .addComponent(animator) - .addComponent(new MobKingProjectAnimController()); + .addComponent(new MobBossProjectAnimController()); projectile .getComponent(AnimationRenderComponent.class).scaleEntity(); diff --git a/source/core/src/main/com/csse3200/game/input/DropInputComponent.java b/source/core/src/main/com/csse3200/game/input/DropInputComponent.java index b923585e3..df9ed2146 100644 --- a/source/core/src/main/com/csse3200/game/input/DropInputComponent.java +++ b/source/core/src/main/com/csse3200/game/input/DropInputComponent.java @@ -1,26 +1,15 @@ package com.csse3200.game.input; - -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.csse3200.game.areas.ForestGameArea; -import com.csse3200.game.areas.terrain.TerrainComponent; -import com.csse3200.game.components.CameraComponent; import com.csse3200.game.components.npc.DropComponent; -import com.csse3200.game.currency.Scrap; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; -import com.badlogic.gdx.graphics.OrthographicCamera; -import com.csse3200.game.entities.factories.DropFactory; -import com.csse3200.game.entities.factories.RenderFactory; -import com.csse3200.game.rendering.Renderer; import com.csse3200.game.services.ServiceLocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import java.security.Provider; import java.util.Objects; public class DropInputComponent extends InputComponent { diff --git a/source/core/src/main/com/csse3200/game/physics/PhysicsEngine.java b/source/core/src/main/com/csse3200/game/physics/PhysicsEngine.java index 017b18278..b3d19f499 100644 --- a/source/core/src/main/com/csse3200/game/physics/PhysicsEngine.java +++ b/source/core/src/main/com/csse3200/game/physics/PhysicsEngine.java @@ -10,7 +10,6 @@ import com.csse3200.game.physics.raycast.SingleHitCallback; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import com.csse3200.game.entities.destructors.ProjectileDestructors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/source/core/src/main/com/csse3200/game/physics/PhysicsLayer.java b/source/core/src/main/com/csse3200/game/physics/PhysicsLayer.java index 437e46b79..37d4b64c5 100644 --- a/source/core/src/main/com/csse3200/game/physics/PhysicsLayer.java +++ b/source/core/src/main/com/csse3200/game/physics/PhysicsLayer.java @@ -14,6 +14,7 @@ public class PhysicsLayer { public static final short WALL = (1 << 6); public static final short XENO = (1 << 3); + public static final short BOSS = (1 << 3); public static final short HUMANS = (1 << 1) | (1 << 5); public static final short ALL = ~0; diff --git a/source/core/src/main/com/csse3200/game/rendering/RenderService.java b/source/core/src/main/com/csse3200/game/rendering/RenderService.java index 2ab46b453..fd2f65097 100644 --- a/source/core/src/main/com/csse3200/game/rendering/RenderService.java +++ b/source/core/src/main/com/csse3200/game/rendering/RenderService.java @@ -1,6 +1,5 @@ package com.csse3200.game.rendering; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.Array; diff --git a/source/core/src/main/com/csse3200/game/rendering/Renderer.java b/source/core/src/main/com/csse3200/game/rendering/Renderer.java index 1f877d45f..5497f955a 100644 --- a/source/core/src/main/com/csse3200/game/rendering/Renderer.java +++ b/source/core/src/main/com/csse3200/game/rendering/Renderer.java @@ -95,7 +95,6 @@ public void render() { Matrix4 projMatrix = camera.getProjectionMatrix(); camera.update(); batch.setProjectionMatrix(projMatrix); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); renderService.render(batch); diff --git a/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java b/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java index 003cd6529..649190860 100644 --- a/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java @@ -1,19 +1,12 @@ package com.csse3200.game.screens; -import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; -import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.csse3200.game.GdxGame; @@ -21,26 +14,21 @@ import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.components.gamearea.PerformanceDisplay; import com.csse3200.game.components.maingame.MainGameActions; -import com.csse3200.game.components.maingame.MainGameLoseDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; -import com.csse3200.game.entities.factories.PlayerFactory; import com.csse3200.game.entities.factories.RenderFactory; import com.csse3200.game.input.DropInputComponent; import com.csse3200.game.input.InputComponent; import com.csse3200.game.input.InputDecorator; import com.csse3200.game.input.InputService; -import com.csse3200.game.input.InputService; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsService; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.rendering.Renderer; import com.csse3200.game.services.*; -import com.csse3200.game.ui.UIComponent; import com.csse3200.game.ui.terminal.Terminal; import com.csse3200.game.ui.terminal.TerminalDisplay; import com.csse3200.game.components.maingame.MainGameExitDisplay; -import com.csse3200.game.components.gamearea.PerformanceDisplay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +62,7 @@ public DesertGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); + camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java b/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java index 1c74fff70..e35c88b85 100644 --- a/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java @@ -1,19 +1,12 @@ package com.csse3200.game.screens; -import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; -import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.csse3200.game.GdxGame; @@ -21,10 +14,8 @@ import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.components.gamearea.PerformanceDisplay; import com.csse3200.game.components.maingame.MainGameActions; -import com.csse3200.game.components.maingame.MainGameLoseDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; -import com.csse3200.game.entities.factories.PlayerFactory; import com.csse3200.game.entities.factories.RenderFactory; import com.csse3200.game.input.DropInputComponent; import com.csse3200.game.input.InputComponent; @@ -35,11 +26,9 @@ import com.csse3200.game.rendering.RenderService; import com.csse3200.game.rendering.Renderer; import com.csse3200.game.services.*; -import com.csse3200.game.ui.UIComponent; import com.csse3200.game.ui.terminal.Terminal; import com.csse3200.game.ui.terminal.TerminalDisplay; import com.csse3200.game.components.maingame.MainGameExitDisplay; -import com.csse3200.game.components.gamearea.PerformanceDisplay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,7 +62,7 @@ public IceGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); + camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java b/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java index 71aab443b..a0ec8d06f 100644 --- a/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java @@ -1,19 +1,12 @@ package com.csse3200.game.screens; -import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; -import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.csse3200.game.GdxGame; @@ -21,26 +14,21 @@ import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.components.gamearea.PerformanceDisplay; import com.csse3200.game.components.maingame.MainGameActions; -import com.csse3200.game.components.maingame.MainGameLoseDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; -import com.csse3200.game.entities.factories.PlayerFactory; import com.csse3200.game.entities.factories.RenderFactory; import com.csse3200.game.input.DropInputComponent; import com.csse3200.game.input.InputComponent; import com.csse3200.game.input.InputDecorator; import com.csse3200.game.input.InputService; -import com.csse3200.game.input.InputService; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsService; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.rendering.Renderer; import com.csse3200.game.services.*; -import com.csse3200.game.ui.UIComponent; import com.csse3200.game.ui.terminal.Terminal; import com.csse3200.game.ui.terminal.TerminalDisplay; import com.csse3200.game.components.maingame.MainGameExitDisplay; -import com.csse3200.game.components.gamearea.PerformanceDisplay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +62,7 @@ public LavaGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); + camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java b/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java index 00e7cf234..93a78401c 100644 --- a/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/LevelSelectScreen.java @@ -9,17 +9,12 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector3; -import com.badlogic.gdx.utils.TimeUtils; import com.csse3200.game.GdxGame; -import com.csse3200.game.entities.factories.RenderFactory; -import com.csse3200.game.rendering.Renderer; import com.csse3200.game.screens.text.AnimatedText; -import com.csse3200.game.screens.Planets; import com.csse3200.game.services.GameEndService; import com.csse3200.game.services.ServiceLocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.w3c.dom.Text; /** * The game screen where you can choose a planet to play on. @@ -108,16 +103,17 @@ private void spawnPlanetBorders() { dispose(); logger.info("Loading level {}", planet[4]); GameLevelData.setSelectedLevel(planet[4]); - if (planet[4] == 0) { - handleDesertPlanetClick(); - game.setScreen(new TurretSelectionScreen(game)); - } else if (planet[4] == 1) { - handleIcePlanetClick(); - game.setScreen(new TurretSelectionScreen(game)); - } else if (planet[4] == 2) { - handleLavaPlanetClick(); - game.setScreen(new TurretSelectionScreen(game)); - } + game.setScreen(new TurretSelectionScreen(game)); +// if (planet[4] == 0) { +// handleDesertPlanetClick(); +// game.setScreen(new TurretSelectionScreen(game)); +// } else if (planet[4] == 1) { +// handleIcePlanetClick(); +// game.setScreen(new TurretSelectionScreen(game)); +// } else if (planet[4] == 2) { +// handleLavaPlanetClick(); +// game.setScreen(new TurretSelectionScreen(game)); +// } } } } diff --git a/source/core/src/main/com/csse3200/game/screens/LosingScreen.java b/source/core/src/main/com/csse3200/game/screens/LosingScreen.java index 354046edc..b52e4642b 100644 --- a/source/core/src/main/com/csse3200/game/screens/LosingScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/LosingScreen.java @@ -16,9 +16,6 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.csse3200.game.GdxGame; import com.csse3200.game.screens.text.AnimatedText; -import com.csse3200.game.services.ServiceLocator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class LosingScreen extends ScreenAdapter { private final GdxGame game; diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index 49e1510a5..58e055c96 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -1,19 +1,13 @@ package com.csse3200.game.screens; -import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; -import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.csse3200.game.GdxGame; @@ -25,7 +19,6 @@ import com.csse3200.game.components.maingame.UIElementsDisplay; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; -import com.csse3200.game.entities.factories.PlayerFactory; import com.csse3200.game.entities.factories.RenderFactory; import com.csse3200.game.input.DropInputComponent; import com.csse3200.game.input.InputComponent; @@ -36,11 +29,9 @@ import com.csse3200.game.rendering.RenderService; import com.csse3200.game.rendering.Renderer; import com.csse3200.game.services.*; -import com.csse3200.game.ui.UIComponent; import com.csse3200.game.ui.terminal.Terminal; import com.csse3200.game.ui.terminal.TerminalDisplay; import com.csse3200.game.components.maingame.MainGameExitDisplay; -import com.csse3200.game.components.gamearea.PerformanceDisplay; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +42,7 @@ */ public class MainGameScreen extends ScreenAdapter { private static final Logger logger = LoggerFactory.getLogger(MainGameScreen.class); - private static final String[] mainGameTextures = {"images/heart.png"}; + private static final String[] mainGameTextures = {"images/heart.png","images/ice_bg.png","images/lava_bg.png","images/desert_bg.png"}; private static final Vector2 CAMERA_POSITION = new Vector2(10f, 5.64f); private final GdxGame game; @@ -67,7 +58,7 @@ public class MainGameScreen extends ScreenAdapter { public static int viewportWidth = screenWidth; public static int viewportHeight= screenHeight; - + int selectedLevel = GameLevelData.getSelectedLevel(); private OrthographicCamera camera; private SpriteBatch batch; @@ -78,13 +69,11 @@ public MainGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); + camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); batch = new SpriteBatch(); - Viewport viewport = new ScreenViewport(camera); - stage = new Stage(viewport, new SpriteBatch()); - + stage = new Stage(new ScreenViewport()); logger.debug("Initialising main game screen services"); @@ -119,8 +108,57 @@ public MainGameScreen(GdxGame game) { ForestGameArea forestGameArea = new ForestGameArea(terrainFactory); forestGameArea.create(); } + + /** + * Retrieves the background texture based on the currently selected game level. + * + *

The method returns different textures for each game level: + *

    + *
  • Ice Level: "images/ice_bg.png"
  • + *
  • Lava Level: "images/lava_bg.png"
  • + *
  • Any other level: Default to "images/desert_bg.png"
  • + *
+ * + * @return The background {@link Texture} corresponding to the selected level. + */ + public Texture getBackgroundTexture() { + Texture background; + switch (selectedLevel) { + // Desert + case 1: // Ice + background = ServiceLocator.getResourceService().getAsset("images/ice_bg.png", Texture.class); + break; + case 2: // Lava + background = ServiceLocator.getResourceService().getAsset("images/lava_bg.png", Texture.class); + break; + default: + // Use a default background for other levels or planets + background = ServiceLocator.getResourceService().getAsset("images/desert_bg.png", Texture.class); + break; + } + return background; + } + @Override public void render(float delta) { + // Clear the screen + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + + // Update the camera and set the batch's projection matrix + camera.update(); + batch.setProjectionMatrix(camera.combined); + + // Begin the batch + batch.begin(); + + // Draw the background texture. + batch.draw(backgroundTexture, 0, 0, viewportWidth, viewportHeight); + + // End the batch + batch.end(); + + // Continue with other rendering logic physicsEngine.update(); ServiceLocator.getEntityService().update(); @@ -129,19 +167,9 @@ public void render(float delta) { ui.getEvents().trigger("lose"); } - batch.setProjectionMatrix(camera.combined); - batch.begin(); - batch.draw(backgroundTexture, 0, 0, viewportWidth, viewportHeight); - batch.end(); - renderer.render(); - stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f)); - stage.draw(); } - - - @Override public void resize(int width, int height) { renderer.resize(width, height); @@ -176,8 +204,8 @@ private void loadAssets() { logger.debug("Loading assets"); ResourceService resourceService = ServiceLocator.getResourceService(); resourceService.loadTextures(mainGameTextures); - backgroundTexture = new Texture("images/Dusty_MoonBG.png"); // Load the background image ServiceLocator.getResourceService().loadAll(); + backgroundTexture = getBackgroundTexture(); // Load the background image } private void unloadAssets() { diff --git a/source/core/src/main/com/csse3200/game/screens/StoryScreen.java b/source/core/src/main/com/csse3200/game/screens/StoryScreen.java index 7f81669f9..838401cdd 100644 --- a/source/core/src/main/com/csse3200/game/screens/StoryScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/StoryScreen.java @@ -8,7 +8,6 @@ import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.InputEvent; -import com.badlogic.gdx.utils.TimeUtils; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.csse3200.game.GdxGame; import com.csse3200.game.screens.text.AnimatedText; diff --git a/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java b/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java index bb2a8a88a..d120d8854 100644 --- a/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/TurretSelectionScreen.java @@ -13,14 +13,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.csse3200.game.GdxGame; -import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.factories.TowerFactory; -import com.csse3200.game.physics.PhysicsService; -import com.csse3200.game.services.ResourceService; -import com.csse3200.game.services.ServiceLocator; import com.badlogic.gdx.scenes.scene2d.ui.Image; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/source/core/src/test/com/csse3200/game/areas/GameAreaTest.java b/source/core/src/test/com/csse3200/game/areas/GameAreaTest.java index 1f3f47b60..3be7a409b 100644 --- a/source/core/src/test/com/csse3200/game/areas/GameAreaTest.java +++ b/source/core/src/test/com/csse3200/game/areas/GameAreaTest.java @@ -3,7 +3,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import com.csse3200.game.areas.terrain.TerrainComponent; import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; diff --git a/source/core/src/test/com/csse3200/game/components/ComponentTest.java b/source/core/src/test/com/csse3200/game/components/ComponentTest.java index 71e9510ad..f92d49c53 100644 --- a/source/core/src/test/com/csse3200/game/components/ComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/ComponentTest.java @@ -4,7 +4,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import com.csse3200.game.components.Component; import com.csse3200.game.extensions.GameExtension; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/components/ComponentTypeTest.java b/source/core/src/test/com/csse3200/game/components/ComponentTypeTest.java index 5e5e35eec..6ed914b71 100644 --- a/source/core/src/test/com/csse3200/game/components/ComponentTypeTest.java +++ b/source/core/src/test/com/csse3200/game/components/ComponentTypeTest.java @@ -2,8 +2,6 @@ import static org.junit.jupiter.api.Assertions.*; -import com.csse3200.game.components.Component; -import com.csse3200.game.components.ComponentType; import com.csse3200.game.extensions.GameExtension; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/components/RicochetComponentTest.java b/source/core/src/test/com/csse3200/game/components/RicochetComponentTest.java index c92371344..00a16daa3 100644 --- a/source/core/src/test/com/csse3200/game/components/RicochetComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/RicochetComponentTest.java @@ -19,7 +19,6 @@ import com.csse3200.game.physics.PhysicsService; import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.physics.components.PhysicsComponent; -import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.services.GameTime; @@ -34,7 +33,7 @@ public class RicochetComponentTest { private final String[] atlas = { "images/projectiles/mobProjectile.atlas", "images/projectiles/basic_projectile.atlas", - "images/projectiles/mobKing_projectile.atlas", + "images/projectiles/mobBoss_projectile.atlas", "images/projectiles/engineer_projectile.atlas" }; diff --git a/source/core/src/test/com/csse3200/game/components/SplitFireworksComponentTest.java b/source/core/src/test/com/csse3200/game/components/SplitFireworksComponentTest.java index 3a25dbd68..55e5decc2 100644 --- a/source/core/src/test/com/csse3200/game/components/SplitFireworksComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/SplitFireworksComponentTest.java @@ -35,7 +35,7 @@ public class SplitFireworksComponentTest { private final String[] atlas = { "images/projectiles/mobProjectile.atlas", "images/projectiles/basic_projectile.atlas", - "images/projectiles/mobKing_projectile.atlas", + "images/projectiles/mobBoss_projectile.atlas", "images/projectiles/engineer_projectile.atlas", "images/projectiles/firework_anim.atlas" }; diff --git a/source/core/src/test/com/csse3200/game/components/TouchAttackComponentTest.java b/source/core/src/test/com/csse3200/game/components/TouchAttackComponentTest.java index 789fd2434..a584fa211 100644 --- a/source/core/src/test/com/csse3200/game/components/TouchAttackComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/TouchAttackComponentTest.java @@ -2,21 +2,15 @@ import com.badlogic.gdx.physics.box2d.Fixture; import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.EntityService; import com.csse3200.game.extensions.GameExtension; import com.csse3200.game.physics.PhysicsService; import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.physics.components.PhysicsComponent; -import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import static org.junit.jupiter.api.Assertions.assertNull; - -import org.junit.Ignore; - import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/source/core/src/test/com/csse3200/game/components/popupmenu/PopupMenuInputComponentTest.java b/source/core/src/test/com/csse3200/game/components/popupmenu/PopupMenuInputComponentTest.java index 9acd1bf7f..556690092 100644 --- a/source/core/src/test/com/csse3200/game/components/popupmenu/PopupMenuInputComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/popupmenu/PopupMenuInputComponentTest.java @@ -3,7 +3,6 @@ import com.csse3200.game.input.InputService; import com.csse3200.game.services.ServiceLocator; import com.csse3200.game.entities.Entity; -import com.csse3200.game.events.EventHandler; import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; import org.junit.jupiter.api.Test; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/DroidCombatTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/DroidCombatTaskTest.java index f03282584..5878ea061 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/DroidCombatTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/DroidCombatTaskTest.java @@ -15,7 +15,6 @@ import com.csse3200.game.physics.components.PhysicsComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import com.csse3200.game.entities.factories.ProjectileFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/EngineerCombatTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/EngineerCombatTaskTest.java index 8a5954efd..bf638a663 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/EngineerCombatTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/EngineerCombatTaskTest.java @@ -1,41 +1,26 @@ -package com.csse3200.game.entities.factories; +package com.csse3200.game.components.tasks; -import com.badlogic.gdx.audio.Sound; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.TouchAttackComponent; -import com.csse3200.game.components.player.HumanAnimationController; -import com.csse3200.game.components.tasks.FinalBossMovementTask; import com.csse3200.game.components.tasks.human.EngineerCombatTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.EntityService; +import com.csse3200.game.entities.factories.EngineerFactory; import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.physics.PhysicsService; -import com.csse3200.game.physics.components.ColliderComponent; import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.physics.components.PhysicsComponent; -import com.csse3200.game.physics.components.PhysicsMovementComponent; -import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - - -import java.util.ArrayList; -import java.util.Objects; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/FinalBossMovementTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/FinalBossMovementTaskTest.java index 4b723db6c..e0033e73f 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/FinalBossMovementTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/FinalBossMovementTaskTest.java @@ -1,6 +1,7 @@ package com.csse3200.game.components.tasks; import com.csse3200.game.ai.tasks.AITaskComponent; +import com.csse3200.game.components.tasks.bosstask.FinalBossMovementTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/FireTowerCombatTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/FireTowerCombatTaskTest.java index dc7394399..a2b92d857 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/FireTowerCombatTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/FireTowerCombatTaskTest.java @@ -15,9 +15,7 @@ import com.csse3200.game.physics.components.PhysicsComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import com.csse3200.game.entities.factories.ProjectileFactory; -import jdk.jfr.Event; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/MobAttackTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/MobAttackTaskTest.java index 1e45d2c0a..e30c0e30d 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/MobAttackTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/MobAttackTaskTest.java @@ -1,18 +1,7 @@ package com.csse3200.game.components.tasks; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.entities.Entity; -import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; -import com.csse3200.game.utils.math.Vector2Utils; -import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.services.GameTime; -import com.csse3200.game.services.ServiceLocator; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/MobWanderTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/MobWanderTaskTest.java index 46b2a2ab9..56a4d8bed 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/MobWanderTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/MobWanderTaskTest.java @@ -1,18 +1,9 @@ package com.csse3200.game.components.tasks; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.entities.Entity; -import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; -import com.csse3200.game.utils.math.Vector2Utils; -import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/RangeBossTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/RangeBossTaskTest.java index 0c12e49fe..cb6aab8fa 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/RangeBossTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/RangeBossTaskTest.java @@ -4,6 +4,7 @@ import static org.mockito.Mockito.verify; import com.csse3200.game.ai.tasks.AITaskComponent; +import com.csse3200.game.components.tasks.bosstask.RangeBossTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/SpawnWaveTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/SpawnWaveTaskTest.java index 55a00537d..58fb2ae9b 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/SpawnWaveTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/SpawnWaveTaskTest.java @@ -4,14 +4,11 @@ import com.csse3200.game.entities.Entity; import com.csse3200.game.events.listeners.EventListener0; import com.csse3200.game.extensions.GameExtension; -import com.csse3200.game.utils.math.Vector2Utils; import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.mockito.Mockito.*; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/StunTowerCombatTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/StunTowerCombatTaskTest.java index 37c87158c..dcd668fc0 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/StunTowerCombatTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/StunTowerCombatTaskTest.java @@ -15,9 +15,7 @@ import com.csse3200.game.physics.components.PhysicsComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import com.csse3200.game.entities.factories.ProjectileFactory; -import jdk.jfr.Event; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/WaitTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/WaitTaskTest.java index 59e7ea7c8..e758f96ab 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/WaitTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/WaitTaskTest.java @@ -8,7 +8,6 @@ import com.csse3200.game.extensions.GameExtension; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/human/HumanWanderTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/human/HumanWanderTaskTest.java index 6e7c9eaeb..a44eb69e1 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/human/HumanWanderTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/human/HumanWanderTaskTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; @ExtendWith(GameExtension.class) diff --git a/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java index 666c9767a..bbae63278 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java @@ -10,7 +10,6 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; -import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; diff --git a/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java index 6f62eb3be..f6d91ddd3 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java @@ -10,7 +10,6 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; -import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; diff --git a/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java index dbb7df351..478fd7314 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java @@ -10,7 +10,6 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; -import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; diff --git a/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java index bdaa14041..d72dd437e 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java @@ -3,8 +3,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.TowerFactory; import com.csse3200.game.extensions.GameExtension; @@ -12,7 +10,6 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.rendering.DebugRenderer; import com.csse3200.game.rendering.RenderService; -import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.BeforeEach; diff --git a/source/core/src/test/com/csse3200/game/components/xenos/XenoAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/xenos/XenoAnimationControllerTest.java index b8317ff2f..1a5d50a20 100644 --- a/source/core/src/test/com/csse3200/game/components/xenos/XenoAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/xenos/XenoAnimationControllerTest.java @@ -24,7 +24,6 @@ public class XenoAnimationControllerTest { private Entity xenoGrunt; - private Entity target; private final String[] atlas = {"images/mobs/xenoGrunt.atlas"}; @BeforeEach @@ -38,7 +37,7 @@ public void setUp() { resourceService.loadTextureAtlases(atlas); resourceService.loadAll(); - xenoGrunt = NPCFactory.createXenoGrunt(target); // Replace with actual Droid Tower creation logic + xenoGrunt = NPCFactory.createXenoGrunt(); // Replace with actual Droid Tower creation logic xenoGrunt.create(); } diff --git a/source/core/src/test/com/csse3200/game/currency/CurrencyTest.java b/source/core/src/test/com/csse3200/game/currency/CurrencyTest.java index 7ed8a22de..5cb196ff2 100644 --- a/source/core/src/test/com/csse3200/game/currency/CurrencyTest.java +++ b/source/core/src/test/com/csse3200/game/currency/CurrencyTest.java @@ -10,7 +10,6 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import org.junit.Before; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/source/core/src/test/com/csse3200/game/entities/EntityTest.java b/source/core/src/test/com/csse3200/game/entities/EntityTest.java index 7d4f3bfa9..17b4abcf7 100644 --- a/source/core/src/test/com/csse3200/game/entities/EntityTest.java +++ b/source/core/src/test/com/csse3200/game/entities/EntityTest.java @@ -3,8 +3,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; diff --git a/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java index d130ae5c7..1a54a0685 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java @@ -1,8 +1,5 @@ package com.csse3200.game.entities.factories; -import com.badlogic.gdx.audio.Sound; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.TouchAttackComponent; @@ -20,16 +17,9 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - - -import java.util.ArrayList; import java.util.Objects; import static org.junit.jupiter.api.Assertions.*; diff --git a/source/core/src/test/com/csse3200/game/entities/factories/NPCFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/NPCFactoryTest.java index 9673617c1..906a1a640 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/NPCFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/NPCFactoryTest.java @@ -65,7 +65,7 @@ public void setUp() { //playerTarget = PlayerFactory.createPlayer(); //towerTarget = TowerFactory.createBaseTower(); //engineerTarget = EngineerFactory.createEngineer(); - xenoGrunt = NPCFactory.createXenoGrunt(playerTarget); + xenoGrunt = NPCFactory.createXenoGrunt(); } @Test diff --git a/source/core/src/test/com/csse3200/game/entities/factories/ProjectileFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/ProjectileFactoryTest.java index 9c4129a40..74d0c4836 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/ProjectileFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/ProjectileFactoryTest.java @@ -4,12 +4,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.badlogic.gdx.assets.AssetManager; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; import com.csse3200.game.components.*; import com.csse3200.game.components.projectile.*; import com.csse3200.game.entities.Entity; @@ -26,14 +21,9 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import org.junit.Ignore; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; - -import java.security.Provider; -import java.util.Arrays; @ExtendWith(GameExtension.class) class ProjectileFactoryTest { @@ -41,7 +31,7 @@ class ProjectileFactoryTest { private final String[] atlas = { "images/projectiles/mobProjectile.atlas", "images/projectiles/basic_projectile.atlas", - "images/projectiles/mobKing_projectile.atlas", + "images/projectiles/mobBoss_projectile.atlas", "images/projectiles/engineer_projectile.atlas", "images/projectiles/stun_effect.atlas", "images/projectiles/burn_effect.atlas", @@ -160,30 +150,30 @@ public void testMobBallProjectileAnimationRenderComponent() { "Mob Ball Projectile does not have an AnimationRenderComponent"); } - @Test - public void testMobBallProjectileAnimationController() { - Entity mobBallProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); - assertNotNull(mobBallProjectile.getComponent(MobProjectileAnimationController.class), - "Mob Ball Projectile does not have an AnimationController"); - } +// @Test +// public void testMobBallProjectileAnimationController() { +// Entity mobBallProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); +// assertNotNull(mobBallProjectile.getComponent(MobProjectileAnimationController.class), +// "Mob Ball Projectile does not have an AnimationController"); +// } @Test - public void testMobKingBallCreation() { - Entity mobKingBall = ProjectileFactory.createMobKingBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); - assertNotNull(mobKingBall, "Mob King Ball is null"); + public void testMobBossBallCreation() { + Entity mobBossBall = ProjectileFactory.createMobBossBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); + assertNotNull(mobBossBall, "Mob King Ball is null"); } @Test - public void testMobKingBallAnimationRenderComponent() { - Entity mobKingBall = ProjectileFactory.createMobKingBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); - assertNotNull(mobKingBall.getComponent(AnimationRenderComponent.class), + public void testMobBossBallAnimationRenderComponent() { + Entity mobBossBall = ProjectileFactory.createMobBossBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); + assertNotNull(mobBossBall.getComponent(AnimationRenderComponent.class), "Mob King Ball does not have AnimationRenderComponent"); } @Test - public void testMobKingBallAnimationController() { - Entity mobKingBall = ProjectileFactory.createMobKingBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); - assertNotNull(mobKingBall.getComponent(MobKingProjectAnimController.class), + public void testMobBossBallAnimationController() { + Entity mobBossBall = ProjectileFactory.createMobBossBall(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f), new Vector2(1f, 1f)); + assertNotNull(mobBossBall.getComponent(MobBossProjectAnimController.class), "Mob King Ball does not have Animation Controller"); } diff --git a/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java index 1ab5d51cc..4d6188c88 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java @@ -4,9 +4,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.badlogic.gdx.assets.AssetManager; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; import com.csse3200.game.components.CombatStatsComponent; @@ -24,14 +21,9 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; -import org.junit.Ignore; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; - -import java.security.Provider; -import java.util.Arrays; @ExtendWith(GameExtension.class) public class TowerFactoryTest { diff --git a/source/core/src/test/com/csse3200/game/extensions/GameExtension.java b/source/core/src/test/com/csse3200/game/extensions/GameExtension.java index d80e081d9..c544e301e 100644 --- a/source/core/src/test/com/csse3200/game/extensions/GameExtension.java +++ b/source/core/src/test/com/csse3200/game/extensions/GameExtension.java @@ -5,7 +5,6 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.headless.HeadlessApplication; import com.badlogic.gdx.graphics.GL20; -import com.badlogic.gdx.graphics.GL30; import com.csse3200.game.services.ServiceLocator; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; diff --git a/source/core/src/test/com/csse3200/game/input/InputComponentTest.java b/source/core/src/test/com/csse3200/game/input/InputComponentTest.java index 1bb048f4b..00be977e1 100644 --- a/source/core/src/test/com/csse3200/game/input/InputComponentTest.java +++ b/source/core/src/test/com/csse3200/game/input/InputComponentTest.java @@ -6,9 +6,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; diff --git a/source/core/src/test/com/csse3200/game/physics/PhysicsUtilsTest.java b/source/core/src/test/com/csse3200/game/physics/PhysicsUtilsTest.java index 145960134..2d212d674 100644 --- a/source/core/src/test/com/csse3200/game/physics/PhysicsUtilsTest.java +++ b/source/core/src/test/com/csse3200/game/physics/PhysicsUtilsTest.java @@ -12,8 +12,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import static org.junit.jupiter.api.Assertions.assertTrue; - @ExtendWith(GameExtension.class) class PhysicsUtilsTest { Entity entity; diff --git a/source/core/src/test/com/csse3200/game/rendering/RenderServiceTest.java b/source/core/src/test/com/csse3200/game/rendering/RenderServiceTest.java index e40c279f3..af10de683 100644 --- a/source/core/src/test/com/csse3200/game/rendering/RenderServiceTest.java +++ b/source/core/src/test/com/csse3200/game/rendering/RenderServiceTest.java @@ -2,7 +2,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/source/core/src/test/com/csse3200/game/services/ResourceServiceTest.java b/source/core/src/test/com/csse3200/game/services/ResourceServiceTest.java index f2ad009f6..9ad90cbb5 100644 --- a/source/core/src/test/com/csse3200/game/services/ResourceServiceTest.java +++ b/source/core/src/test/com/csse3200/game/services/ResourceServiceTest.java @@ -9,9 +9,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify;