diff --git a/assets/EA.fnt b/assets/EA.fnt new file mode 100644 index 0000000..5e8e646 --- /dev/null +++ b/assets/EA.fnt @@ -0,0 +1,244 @@ +info face="EA Sports Covers SC" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0 +common lineHeight=32 base=26 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0 +page id=0 file="EA_0.png" +chars count=95 +char id=32 x=22 y=25 width=3 height=1 xoffset=-1 yoffset=31 xadvance=7 page=0 chnl=15 +char id=33 x=248 y=21 width=6 height=20 xoffset=0 yoffset=6 xadvance=7 page=0 chnl=15 +char id=34 x=50 y=103 width=13 height=7 xoffset=0 yoffset=6 xadvance=13 page=0 chnl=15 +char id=35 x=192 y=80 width=16 height=14 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 +char id=36 x=0 y=0 width=14 height=26 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=15 +char id=37 x=157 y=0 width=20 height=20 xoffset=0 yoffset=6 xadvance=20 page=0 chnl=15 +char id=38 x=178 y=0 width=18 height=20 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=15 +char id=39 x=64 y=101 width=7 height=7 xoffset=0 yoffset=6 xadvance=7 page=0 chnl=15 +char id=40 x=78 y=0 width=9 height=24 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 +char id=41 x=48 y=0 width=9 height=24 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 +char id=42 x=37 y=103 width=12 height=10 xoffset=0 yoffset=6 xadvance=11 page=0 chnl=15 +char id=43 x=209 y=80 width=15 height=14 xoffset=0 yoffset=9 xadvance=15 page=0 chnl=15 +char id=44 x=72 y=101 width=7 height=7 xoffset=-1 yoffset=22 xadvance=7 page=0 chnl=15 +char id=45 x=118 y=101 width=15 height=4 xoffset=0 yoffset=14 xadvance=15 page=0 chnl=15 +char id=46 x=134 y=97 width=6 height=4 xoffset=0 yoffset=22 xadvance=7 page=0 chnl=15 +char id=47 x=210 y=42 width=12 height=20 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 +char id=48 x=152 y=21 width=15 height=20 xoffset=1 yoffset=6 xadvance=16 page=0 chnl=15 +char id=49 x=0 y=69 width=9 height=20 xoffset=7 yoffset=6 xadvance=16 page=0 chnl=15 +char id=50 x=123 y=42 width=14 height=20 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 +char id=51 x=196 y=42 width=13 height=20 xoffset=3 yoffset=6 xadvance=16 page=0 chnl=15 +char id=52 x=17 y=27 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=53 x=182 y=42 width=13 height=20 xoffset=3 yoffset=6 xadvance=16 page=0 chnl=15 +char id=54 x=108 y=42 width=14 height=20 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 +char id=55 x=168 y=42 width=13 height=20 xoffset=3 yoffset=6 xadvance=16 page=0 chnl=15 +char id=56 x=138 y=42 width=14 height=20 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 +char id=57 x=153 y=42 width=14 height=20 xoffset=2 yoffset=6 xadvance=16 page=0 chnl=15 +char id=58 x=14 y=107 width=6 height=12 xoffset=0 yoffset=14 xadvance=7 page=0 chnl=15 +char id=59 x=184 y=80 width=7 height=15 xoffset=-1 yoffset=14 xadvance=7 page=0 chnl=15 +char id=60 x=0 y=107 width=13 height=12 xoffset=0 yoffset=10 xadvance=13 page=0 chnl=15 +char id=61 x=21 y=103 width=15 height=11 xoffset=0 yoffset=11 xadvance=15 page=0 chnl=15 +char id=62 x=240 y=80 width=13 height=12 xoffset=0 yoffset=10 xadvance=13 page=0 chnl=15 +char id=63 x=16 y=48 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=64 x=135 y=0 width=21 height=20 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=15 +char id=65 x=51 y=25 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=66 x=232 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=67 x=93 y=46 width=14 height=20 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=68 x=168 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=69 x=78 y=46 width=14 height=20 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=70 x=200 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=71 x=184 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=72 x=119 y=21 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=73 x=248 y=42 width=6 height=20 xoffset=0 yoffset=6 xadvance=7 page=0 chnl=15 +char id=74 x=236 y=42 width=11 height=20 xoffset=0 yoffset=6 xadvance=11 page=0 chnl=15 +char id=75 x=68 y=25 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=76 x=102 y=21 width=16 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=77 x=112 y=0 width=22 height=20 xoffset=0 yoffset=6 xadvance=22 page=0 chnl=15 +char id=78 x=235 y=0 width=17 height=20 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=15 +char id=79 x=136 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=80 x=32 y=48 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=81 x=85 y=25 width=16 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=82 x=0 y=48 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=83 x=63 y=46 width=14 height=20 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=84 x=48 y=46 width=14 height=20 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=85 x=216 y=21 width=15 height=20 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15 +char id=86 x=0 y=27 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=87 x=88 y=0 width=23 height=20 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=15 +char id=88 x=216 y=0 width=18 height=20 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=15 +char id=89 x=197 y=0 width=18 height=20 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=15 +char id=90 x=34 y=25 width=16 height=20 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 +char id=91 x=68 y=0 width=9 height=24 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 +char id=92 x=223 y=42 width=12 height=20 xoffset=0 yoffset=6 xadvance=12 page=0 chnl=15 +char id=93 x=58 y=0 width=9 height=24 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15 +char id=94 x=225 y=80 width=14 height=12 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15 +char id=95 x=102 y=101 width=15 height=4 xoffset=-1 yoffset=26 xadvance=13 page=0 chnl=15 +char id=96 x=94 y=101 width=7 height=6 xoffset=0 yoffset=4 xadvance=7 page=0 chnl=15 +char id=97 x=113 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=16 page=0 chnl=15 +char id=98 x=232 y=63 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=99 x=112 y=84 width=14 height=16 xoffset=0 yoffset=10 xadvance=14 page=0 chnl=15 +char id=100 x=0 y=90 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=101 x=157 y=80 width=14 height=16 xoffset=0 yoffset=10 xadvance=14 page=0 chnl=15 +char id=102 x=16 y=86 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=103 x=32 y=86 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=104 x=130 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=16 page=0 chnl=15 +char id=105 x=248 y=63 width=6 height=16 xoffset=0 yoffset=10 xadvance=7 page=0 chnl=15 +char id=106 x=172 y=80 width=11 height=16 xoffset=0 yoffset=10 xadvance=11 page=0 chnl=15 +char id=107 x=181 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=16 page=0 chnl=15 +char id=108 x=147 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=109 x=34 y=69 width=22 height=16 xoffset=0 yoffset=10 xadvance=22 page=0 chnl=15 +char id=110 x=95 y=67 width=17 height=16 xoffset=0 yoffset=10 xadvance=17 page=0 chnl=15 +char id=111 x=48 y=86 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=112 x=64 y=84 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=113 x=164 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=114 x=80 y=84 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=115 x=127 y=80 width=14 height=16 xoffset=0 yoffset=10 xadvance=14 page=0 chnl=15 +char id=116 x=142 y=80 width=14 height=16 xoffset=0 yoffset=10 xadvance=14 page=0 chnl=15 +char id=117 x=96 y=84 width=15 height=16 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15 +char id=118 x=198 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=16 page=0 chnl=15 +char id=119 x=10 y=69 width=23 height=16 xoffset=0 yoffset=10 xadvance=23 page=0 chnl=15 +char id=120 x=57 y=67 width=18 height=16 xoffset=0 yoffset=10 xadvance=17 page=0 chnl=15 +char id=121 x=76 y=67 width=18 height=16 xoffset=0 yoffset=10 xadvance=18 page=0 chnl=15 +char id=122 x=215 y=63 width=16 height=16 xoffset=0 yoffset=10 xadvance=16 page=0 chnl=15 +char id=123 x=22 y=0 width=12 height=24 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15 +char id=124 x=15 y=0 width=6 height=26 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=15 +char id=125 x=35 y=0 width=12 height=24 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15 +char id=126 x=80 y=101 width=13 height=6 xoffset=0 yoffset=15 xadvance=13 page=0 chnl=15 +kernings count=144 +kerning first=65 second=84 amount=-2 +kerning first=65 second=86 amount=-3 +kerning first=65 second=87 amount=-2 +kerning first=65 second=89 amount=-3 +kerning first=65 second=116 amount=-1 +kerning first=65 second=118 amount=-2 +kerning first=65 second=119 amount=-2 +kerning first=65 second=121 amount=-2 +kerning first=66 second=88 amount=-1 +kerning first=66 second=89 amount=-1 +kerning first=70 second=65 amount=-2 +kerning first=70 second=74 amount=-4 +kerning first=70 second=97 amount=-3 +kerning first=70 second=99 amount=-2 +kerning first=70 second=103 amount=-2 +kerning first=70 second=106 amount=-4 +kerning first=70 second=111 amount=-2 +kerning first=70 second=113 amount=-2 +kerning first=70 second=115 amount=-2 +kerning first=121 second=115 amount=-1 +kerning first=121 second=113 amount=-1 +kerning first=121 second=111 amount=-1 +kerning first=121 second=106 amount=-4 +kerning first=121 second=103 amount=-1 +kerning first=76 second=84 amount=-3 +kerning first=76 second=86 amount=-2 +kerning first=76 second=87 amount=-2 +kerning first=76 second=89 amount=-5 +kerning first=76 second=116 amount=-3 +kerning first=76 second=118 amount=-2 +kerning first=76 second=119 amount=-1 +kerning first=76 second=121 amount=-5 +kerning first=79 second=88 amount=-1 +kerning first=79 second=89 amount=-1 +kerning first=80 second=65 amount=-1 +kerning first=80 second=74 amount=-4 +kerning first=80 second=88 amount=-1 +kerning first=80 second=89 amount=-1 +kerning first=80 second=97 amount=-2 +kerning first=80 second=106 amount=-4 +kerning first=121 second=99 amount=-1 +kerning first=121 second=97 amount=-3 +kerning first=81 second=89 amount=-2 +kerning first=82 second=89 amount=-1 +kerning first=84 second=65 amount=-2 +kerning first=84 second=74 amount=-3 +kerning first=84 second=97 amount=-3 +kerning first=84 second=99 amount=-2 +kerning first=84 second=103 amount=-2 +kerning first=84 second=106 amount=-3 +kerning first=84 second=111 amount=-2 +kerning first=84 second=113 amount=-2 +kerning first=84 second=115 amount=-2 +kerning first=120 second=113 amount=-1 +kerning first=120 second=111 amount=-1 +kerning first=120 second=103 amount=-1 +kerning first=120 second=99 amount=-1 +kerning first=119 second=106 amount=-1 +kerning first=86 second=65 amount=-3 +kerning first=86 second=74 amount=-2 +kerning first=86 second=97 amount=-3 +kerning first=86 second=99 amount=-1 +kerning first=86 second=103 amount=-1 +kerning first=86 second=106 amount=-3 +kerning first=86 second=111 amount=-1 +kerning first=86 second=113 amount=-1 +kerning first=86 second=115 amount=-1 +kerning first=119 second=97 amount=-2 +kerning first=118 second=106 amount=-2 +kerning first=118 second=97 amount=-3 +kerning first=116 second=106 amount=-3 +kerning first=116 second=97 amount=-2 +kerning first=87 second=65 amount=-2 +kerning first=87 second=74 amount=-1 +kerning first=87 second=97 amount=-2 +kerning first=87 second=106 amount=-1 +kerning first=114 second=121 amount=-1 +kerning first=113 second=121 amount=-2 +kerning first=88 second=67 amount=-1 +kerning first=88 second=71 amount=-1 +kerning first=88 second=79 amount=-1 +kerning first=88 second=81 amount=-1 +kerning first=88 second=99 amount=-1 +kerning first=88 second=101 amount=-1 +kerning first=88 second=103 amount=-1 +kerning first=88 second=108 amount=-1 +kerning first=88 second=111 amount=-1 +kerning first=88 second=113 amount=-1 +kerning first=88 second=116 amount=-1 +kerning first=88 second=117 amount=-1 +kerning first=88 second=118 amount=-1 +kerning first=88 second=119 amount=-1 +kerning first=88 second=121 amount=-1 +kerning first=112 second=121 amount=-1 +kerning first=112 second=120 amount=-1 +kerning first=112 second=106 amount=-4 +kerning first=112 second=97 amount=-1 +kerning first=89 second=65 amount=-3 +kerning first=89 second=67 amount=-1 +kerning first=89 second=71 amount=-1 +kerning first=89 second=74 amount=-4 +kerning first=89 second=79 amount=-1 +kerning first=89 second=81 amount=-1 +kerning first=89 second=83 amount=-1 +kerning first=89 second=97 amount=-5 +kerning first=89 second=98 amount=-2 +kerning first=89 second=99 amount=-3 +kerning first=89 second=100 amount=-2 +kerning first=89 second=101 amount=-2 +kerning first=89 second=102 amount=-2 +kerning first=89 second=103 amount=-3 +kerning first=89 second=104 amount=-2 +kerning first=89 second=105 amount=-2 +kerning first=89 second=106 amount=-5 +kerning first=89 second=107 amount=-2 +kerning first=89 second=108 amount=-2 +kerning first=89 second=109 amount=-2 +kerning first=89 second=110 amount=-2 +kerning first=89 second=111 amount=-3 +kerning first=89 second=112 amount=-2 +kerning first=89 second=113 amount=-3 +kerning first=89 second=114 amount=-2 +kerning first=89 second=115 amount=-3 +kerning first=89 second=116 amount=-1 +kerning first=89 second=117 amount=-2 +kerning first=89 second=118 amount=-1 +kerning first=89 second=119 amount=-1 +kerning first=89 second=120 amount=-1 +kerning first=89 second=121 amount=-1 +kerning first=89 second=122 amount=-2 +kerning first=111 second=121 amount=-1 +kerning first=111 second=120 amount=-1 +kerning first=108 second=121 amount=-5 +kerning first=108 second=119 amount=-2 +kerning first=108 second=118 amount=-2 +kerning first=108 second=116 amount=-3 +kerning first=102 second=106 amount=-4 +kerning first=102 second=97 amount=-2 +kerning first=98 second=121 amount=-1 +kerning first=98 second=120 amount=-1 +kerning first=97 second=116 amount=-2 +kerning first=97 second=118 amount=-3 +kerning first=97 second=119 amount=-2 +kerning first=97 second=121 amount=-3 diff --git a/assets/EA.png b/assets/EA.png new file mode 100644 index 0000000..3b2de08 Binary files /dev/null and b/assets/EA.png differ diff --git a/assets/images/arrow.png b/assets/images/arrow.png new file mode 100644 index 0000000..9d59077 Binary files /dev/null and b/assets/images/arrow.png differ diff --git a/assets/images/stalker.png b/assets/images/stalker.png new file mode 100644 index 0000000..123443c Binary files /dev/null and b/assets/images/stalker.png differ diff --git a/assets/particles/thrust.p b/assets/particles/thrust.p new file mode 100644 index 0000000..4c7b2d0 --- /dev/null +++ b/assets/particles/thrust.p @@ -0,0 +1,156 @@ +Thruster +- Delay - +active: false +- Duration - +lowMin: 200.0 +lowMax: 200.0 +- Count - +min: 0 +max: 2000 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 75.0 +highMax: 75.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 500.0 +highMax: 500.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: point +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 30.0 +highMax: 30.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 110.0 +highMax: 110.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 265.0 +highMax: 275.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 360.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 12 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +colors3: 0.96862745 +colors4: 0.9137255 +colors5: 0.0 +colors6: 0.96862745 +colors7: 0.4627451 +colors8: 0.0 +colors9: 0.96862745 +colors10: 0.0 +colors11: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.13018873 +timeline2: 0.34528303 +timeline3: 1.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.11111132 +timeline2: 0.7986111 +timeline3: 1.0 +- Options - +attached: true +continuous: true +aligned: false +additive: true +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +particle-fire.png + diff --git a/core/src/main/java/org/lumijiez/bugger/Bugger.java b/core/src/main/java/org/lumijiez/bugger/Bugger.java index 9c10651..372c1d6 100644 --- a/core/src/main/java/org/lumijiez/bugger/Bugger.java +++ b/core/src/main/java/org/lumijiez/bugger/Bugger.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; @@ -13,8 +14,10 @@ import com.badlogic.gdx.utils.Array; import org.lumijiez.bugger.entities.Entity; import org.lumijiez.bugger.entities.Player; import org.lumijiez.bugger.entities.enemies.EnemyEntity; +import org.lumijiez.bugger.entities.enemies.Stalker; import org.lumijiez.bugger.entities.enemies.Wasp; import org.lumijiez.bugger.entities.weapons.Arrow; +import org.lumijiez.bugger.entities.weapons.Projectile; import org.lumijiez.bugger.handlers.GameContactListener; import org.lumijiez.bugger.vfx.ParticleManager; import org.lumijiez.bugger.vfx.SpaceBackground; @@ -26,7 +29,7 @@ public class Bugger { private static Bugger instance; private final World world; private final SpaceBackground spaceBackground; - private final Array projectiles; + private final Array projectiles; private final List enemies; private final Array entitiesToDestroy; private final Player player; @@ -34,9 +37,13 @@ public class Bugger { private static final float ENEMY_SPAWN_INTERVAL = 0.5f; private final Box2DDebugRenderer debugRenderer; public static OrthographicCamera cam; + public static OrthographicCamera uiCam; public static SpriteBatch spriteBatch; + public static SpriteBatch uiBatch; + private final BitmapFont bitmapFont; private Bugger() { + bitmapFont = new BitmapFont(Gdx.files.internal("EA.fnt"), Gdx.files.internal("EA.png"), false); world = new World(new Vector2(0, 0), true); this.projectiles = new Array<>(); this.entitiesToDestroy = new Array<>(); @@ -47,9 +54,14 @@ public class Bugger { this.world.setContactListener(new GameContactListener()); this.debugRenderer = new Box2DDebugRenderer(); spriteBatch = new SpriteBatch(); + uiBatch = new SpriteBatch(); cam = new OrthographicCamera(160, 90); cam.position.set(Player.getInstance().getPosition().x / 2f, Player.getInstance().getPosition().y / 2f, 0); cam.update(); + + uiCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + uiCam.position.set(uiCam.viewportWidth / 2, uiCam.viewportHeight / 2, 0); // Center the camera + uiCam.update(); } public static Bugger getInstance() { @@ -60,19 +72,10 @@ public class Bugger { } public void cycle(float delta) { - cam.update(); - renderClear(); renderBackground(); - renderPlayer(); - step(); - spriteBatch.setProjectionMatrix(cam.combined); - cam.position.set(player.getPosition().x, player.getPosition().y, 0); - - handleInput(); - cycleProjectiles(delta); cycleEnemies(); @@ -80,9 +83,22 @@ public class Bugger { clearEntities(); + cam.position.set(player.getBody().getPosition().x, player.getBody().getPosition().y, 0); + cam.update(); + renderPlayer(); renderEnemies(delta); renderDebug(); + + spriteBatch.setProjectionMatrix(cam.combined); + + uiBatch.begin(); + bitmapFont.draw(uiBatch, "Speed: " + Player.getInstance().getBody().getLinearVelocity().len(), 100, 150); + uiBatch.end(); + + uiBatch.setProjectionMatrix(uiCam.combined); + uiCam.update(); + handleInput(); } public void renderBackground() { @@ -92,6 +108,7 @@ public class Bugger { public void renderEnemies(float delta) { enemySpawnTimer += delta; if (enemySpawnTimer >= ENEMY_SPAWN_INTERVAL) { + enemies.add(new Stalker(world, Player.getInstance().getPosition())); enemies.add(new Wasp(world, Player.getInstance().getPosition())); enemySpawnTimer = 0; } @@ -116,7 +133,7 @@ public class Bugger { } public void cycleProjectiles(float delta) { - for (Arrow arrow : projectiles) { + for (Projectile arrow : projectiles) { if (!arrow.isMarkedToDestroy()) { arrow.update(delta); arrow.render(); @@ -152,7 +169,7 @@ public class Bugger { } public void step() { - world.step(1 / 20f, 6, 2); + world.step(1 / 60f, 6, 2); } public void playParticle(float x, float y) { diff --git a/core/src/main/java/org/lumijiez/bugger/entities/Player.java b/core/src/main/java/org/lumijiez/bugger/entities/Player.java index 679afb0..c6c94a1 100644 --- a/core/src/main/java/org/lumijiez/bugger/entities/Player.java +++ b/core/src/main/java/org/lumijiez/bugger/entities/Player.java @@ -3,10 +3,11 @@ package org.lumijiez.bugger.entities; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Vector3; -import com.badlogic.gdx.physics.box2d.World; +import com.badlogic.gdx.physics.box2d.*; import com.badlogic.gdx.math.Vector2; import org.lumijiez.bugger.Bugger; import org.lumijiez.bugger.entities.weapons.Arrow; +import org.lumijiez.bugger.vfx.ParticleManager; public class Player extends Entity { private static Player instance; @@ -22,6 +23,29 @@ public class Player extends Entity { return instance; } + @Override + protected Body createBody(float x, float y) { + BodyDef bodyDef = new BodyDef(); + bodyDef.position.set(x, y); + bodyDef.type = BodyDef.BodyType.DynamicBody; + + Body body = world.createBody(bodyDef); + PolygonShape shape = new PolygonShape(); + shape.setAsBox(size / 2, size / 2); + + FixtureDef fixtureDef = new FixtureDef(); + fixtureDef.shape = shape; + fixtureDef.density = 1f; + fixtureDef.friction = 0.5f; + fixtureDef.restitution = 0.3f; + + body.createFixture(fixtureDef); + + shape.dispose(); + return body; + } + + public void setPlayer(World world, float x, float y) { this.world = world; this.body = createBody(x, y); @@ -29,9 +53,10 @@ public class Player extends Entity { public void move(float deltaX, float deltaY) { float speed = 500f; - body.setLinearVelocity(deltaX * speed, deltaY * speed); - } + Vector2 force = new Vector2(deltaX * speed, deltaY * speed); + body.applyForceToCenter(force, true); + } public void render() { handleInput(); updateSpriteRotation(); diff --git a/core/src/main/java/org/lumijiez/bugger/entities/enemies/Stalker.java b/core/src/main/java/org/lumijiez/bugger/entities/enemies/Stalker.java new file mode 100644 index 0000000..ea7923e --- /dev/null +++ b/core/src/main/java/org/lumijiez/bugger/entities/enemies/Stalker.java @@ -0,0 +1,20 @@ +package org.lumijiez.bugger.entities.enemies; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.physics.box2d.World; + +import java.util.Random; + +public class Stalker extends EnemyEntity { + private static final Random random = new Random(); + + public Stalker(World world, Vector2 playerPosition) { + super(world, "images/stalker.png", 10f); + float spawnRadius = 50; + float angle = random.nextFloat() * 2 * (float) Math.PI; + float spawnX = playerPosition.x + (float) Math.cos(angle) * (spawnRadius + size); + float spawnY = playerPosition.y + (float) Math.sin(angle) * (spawnRadius + size); + this.body = createBody(spawnX, spawnY); + this.body.setUserData(this); + } +} diff --git a/core/src/main/java/org/lumijiez/bugger/entities/weapons/Arrow.java b/core/src/main/java/org/lumijiez/bugger/entities/weapons/Arrow.java index 93dd4da..18fa3ec 100644 --- a/core/src/main/java/org/lumijiez/bugger/entities/weapons/Arrow.java +++ b/core/src/main/java/org/lumijiez/bugger/entities/weapons/Arrow.java @@ -2,49 +2,33 @@ package org.lumijiez.bugger.entities.weapons; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.*; -import org.lumijiez.bugger.entities.Entity; +import org.lumijiez.bugger.Bugger; -public class Arrow extends Entity { - private float timeAlive = 0f; +public class Arrow extends Projectile { public Arrow(World world, Vector2 position, Vector2 direction) { - super(world, "images/wasp.png", 1f); + super(world, "images/arrow.png", 5f); + Vector2 offsetPosition = position.cpy().add(direction.nor().scl(size + 1f)); this.body = createBody(offsetPosition.x, offsetPosition.y); + + this.body.setTransform(offsetPosition, (float) (direction.angleRad() + Math.toRadians(270f))); + float speed = 5000f; + this.body.setLinearVelocity(direction.nor().scl(speed)); - this.body.setAngularVelocity(speed); - } - - protected Body createBody(float x, float y) { - BodyDef bodyDef = new BodyDef(); - bodyDef.position.set(x, y); - bodyDef.type = BodyDef.BodyType.DynamicBody; - bodyDef.gravityScale = 0; - - Body body = world.createBody(bodyDef); - PolygonShape shape = new PolygonShape(); - shape.setAsBox(size / 2, size / 2); - - FixtureDef fixtureDef = new FixtureDef(); - fixtureDef.shape = shape; - fixtureDef.isSensor = true; - body.createFixture(fixtureDef); - - shape.dispose(); - return body; - } - - public void update(float delta) { - timeAlive += delta; - float lifetime = 3f; - if (timeAlive >= lifetime || isMarkedToDestroy()) { - destroy(); - } } + @Override public void render() { - super.render(); + sprite.setOrigin(size / 2, size / 2); + sprite.setSize(size, size + 5); + sprite.setPosition(body.getPosition().x - size / 2, body.getPosition().y - size / 2); + sprite.setRotation(body.getAngle() * (180f / (float) Math.PI)); + Bugger.spriteBatch.begin(); + sprite.draw(Bugger.spriteBatch); + Bugger.spriteBatch.end(); } + } diff --git a/core/src/main/java/org/lumijiez/bugger/entities/weapons/Projectile.java b/core/src/main/java/org/lumijiez/bugger/entities/weapons/Projectile.java new file mode 100644 index 0000000..be969b2 --- /dev/null +++ b/core/src/main/java/org/lumijiez/bugger/entities/weapons/Projectile.java @@ -0,0 +1,50 @@ +package org.lumijiez.bugger.entities.weapons; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.physics.box2d.*; +import org.lumijiez.bugger.Bugger; +import org.lumijiez.bugger.entities.Entity; + +public abstract class Projectile extends Entity { + + private float timeAlive = 0f; + + public Projectile(World world, String texturePath, float size) { + super(world, texturePath, size); + } + + @Override + protected Body createBody(float x, float y) { + BodyDef bodyDef = new BodyDef(); + bodyDef.position.set(x, y); + bodyDef.type = BodyDef.BodyType.DynamicBody; + bodyDef.gravityScale = 0; + + Body body = world.createBody(bodyDef); + PolygonShape shape = new PolygonShape(); + shape.setAsBox(size / 2, size + 5); + + FixtureDef fixtureDef = new FixtureDef(); + fixtureDef.shape = shape; + fixtureDef.isSensor = true; + body.createFixture(fixtureDef); + + shape.dispose(); + return body; + } + + public void update(float delta) { + timeAlive += delta; + float lifetime = 3f; + if (timeAlive >= lifetime || isMarkedToDestroy()) { + destroy(); + } + } + + public void render() { + super.render(); + } +} diff --git a/core/src/main/java/org/lumijiez/bugger/handlers/FontRenderer.java b/core/src/main/java/org/lumijiez/bugger/handlers/FontRenderer.java new file mode 100644 index 0000000..28b3d3c --- /dev/null +++ b/core/src/main/java/org/lumijiez/bugger/handlers/FontRenderer.java @@ -0,0 +1,4 @@ +package org.lumijiez.bugger.handlers; + +public class FontRenderer { +} diff --git a/core/src/main/java/org/lumijiez/bugger/vfx/ParticleManager.java b/core/src/main/java/org/lumijiez/bugger/vfx/ParticleManager.java index 0a0abab..f8fa183 100644 --- a/core/src/main/java/org/lumijiez/bugger/vfx/ParticleManager.java +++ b/core/src/main/java/org/lumijiez/bugger/vfx/ParticleManager.java @@ -15,7 +15,7 @@ public class ParticleManager { private ParticleManager() { ParticleEffect effect = new ParticleEffect(); effect.load(Gdx.files.internal("particles/boom.p"), Gdx.files.internal("particles")); - effect.scaleEffect(0.6f); + effect.scaleEffect(0.5f); particleEffectPool = new ParticleEffectPool(effect, 1, 20); activeEffects = new Array<>(); } diff --git a/core/src/main/java/org/lumijiez/bugger/vfx/SpaceBackground.java b/core/src/main/java/org/lumijiez/bugger/vfx/SpaceBackground.java index bb26baf..18ffe1e 100644 --- a/core/src/main/java/org/lumijiez/bugger/vfx/SpaceBackground.java +++ b/core/src/main/java/org/lumijiez/bugger/vfx/SpaceBackground.java @@ -13,6 +13,9 @@ public class SpaceBackground { private final float[] starPositionsY; private final int numStars = 10000; + // Scale factor for all textures + private final float scaleFactor = 0.1f; // Scaling down by 0.1 + public SpaceBackground() { starTexture = new Texture(Gdx.files.internal("images/star.png")); galaxyTexture = new Texture(Gdx.files.internal("images/galaxy.png")); @@ -41,7 +44,6 @@ public class SpaceBackground { } private void drawStars(float cameraX, float cameraY) { - for (int i = 0; i < numStars; i++) { float starScrollSpeedX = 0.5f; float starX = starPositionsX[i] - cameraX * starScrollSpeedX; @@ -51,10 +53,9 @@ public class SpaceBackground { float offsetX = MathUtils.random(-2f, 2f); float offsetY = MathUtils.random(-2f, 2f); - float starScale = 0.1f; - - float scaledWidth = starTexture.getWidth() * starScale; - float scaledHeight = starTexture.getHeight() * starScale; + // Scale the star size + float scaledWidth = starTexture.getWidth() * scaleFactor; + float scaledHeight = starTexture.getHeight() * scaleFactor; Bugger.spriteBatch.draw(starTexture, starX + offsetX, @@ -72,27 +73,31 @@ public class SpaceBackground { private void drawGalaxies(float cameraX, float cameraY) { float galaxyScrollSpeedY = 0.2f; float galaxyY1 = (cameraY * galaxyScrollSpeedY) % galaxyTexture.getHeight() - galaxyTexture.getHeight(); - // float galaxyY2 = galaxyY1 + galaxyTexture.getHeight(); - float galaxyScrollSpeedX = 0.2f; float galaxyX1 = -cameraX * galaxyScrollSpeedX; float galaxyX2 = galaxyX1 + galaxyTexture.getWidth(); - Bugger.spriteBatch.draw(galaxyTexture, galaxyX1, galaxyY1); - Bugger.spriteBatch.draw(galaxyTexture, galaxyX2, galaxyY1); + // Scale the galaxy size + float scaledGalaxyWidth = galaxyTexture.getWidth() * scaleFactor; + float scaledGalaxyHeight = galaxyTexture.getHeight() * scaleFactor; + + Bugger.spriteBatch.draw(galaxyTexture, galaxyX1, galaxyY1, scaledGalaxyWidth, scaledGalaxyHeight); + Bugger.spriteBatch.draw(galaxyTexture, galaxyX2, galaxyY1, scaledGalaxyWidth, scaledGalaxyHeight); } private void drawNebulae(float cameraX, float cameraY) { float nebulaScrollSpeedY = 0.025f; float nebulaY1 = (cameraY * nebulaScrollSpeedY) % nebulaTexture.getHeight() - nebulaTexture.getHeight(); - // float nebulaY2 = nebulaY1 + nebulaTexture.getHeight(); - float nebulaScrollSpeedX = 0.025f; float nebulaX1 = -cameraX * nebulaScrollSpeedX; float nebulaX2 = nebulaX1 + nebulaTexture.getWidth(); - Bugger.spriteBatch.draw(nebulaTexture, nebulaX1, nebulaY1); - Bugger.spriteBatch.draw(nebulaTexture, nebulaX2, nebulaY1); + // Scale the nebula size + float scaledNebulaWidth = nebulaTexture.getWidth() * scaleFactor; + float scaledNebulaHeight = nebulaTexture.getHeight() * scaleFactor; + + Bugger.spriteBatch.draw(nebulaTexture, nebulaX1, nebulaY1, scaledNebulaWidth, scaledNebulaHeight); + Bugger.spriteBatch.draw(nebulaTexture, nebulaX2, nebulaY1, scaledNebulaWidth, scaledNebulaHeight); } public void dispose() {