diff --git a/core/assets/data/particles/ball_and_chain.particle b/core/assets/data/particles/ball_and_chain.particle new file mode 100644 index 0000000..bf9d80d --- /dev/null +++ b/core/assets/data/particles/ball_and_chain.particle @@ -0,0 +1,149 @@ +slugs +- Delay - +active: false +- Duration - +lowMin: 10000.0 +lowMax: 10000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 2.0 +lowMax: 2.0 +highMin: 4.0 +highMax: 4.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 500.0 +highMax: 750.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.66 +timeline2: 1.0 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 359.0 +highMax: 359.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.999 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 9 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +colors3: 0.0 +colors4: 0.0 +colors5: 0.0 +colors6: 1.0 +colors7: 1.0 +colors8: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.050933786 +timeline2: 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.21232876 +timeline2: 0.65068495 +timeline3: 0.9794521 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +/home/emamaker/github/amazeing/gdx/core/assets/data/powerups/ball_and_chain.png + diff --git a/core/assets/data/particles/boom.particle b/core/assets/data/particles/boom.particle new file mode 100644 index 0000000..f057199 --- /dev/null +++ b/core/assets/data/particles/boom.particle @@ -0,0 +1,142 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 5000.0 +lowMax: 5000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 1.0 +lowMax: 1.0 +highMin: 10.0 +highMax: 10.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 150.0 +highMax: 350.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.9183673 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.66 +timeline2: 1.0 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 200.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 200.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 300.0 +lowMax: 300.0 +highMin: 400.0 +highMax: 400.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 1.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.25342464 +timeline2: 0.60761464 +timeline3: 0.98057497 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: random +- Image Paths - +explosion.png +boom.png + diff --git a/core/assets/data/particles/boom.png b/core/assets/data/particles/boom.png new file mode 100644 index 0000000..03a853b Binary files /dev/null and b/core/assets/data/particles/boom.png differ diff --git a/core/assets/data/particles/explosion.particle b/core/assets/data/particles/explosion.particle new file mode 100644 index 0000000..68dff53 --- /dev/null +++ b/core/assets/data/particles/explosion.particle @@ -0,0 +1,313 @@ +explosion +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 2.0 +lowMax: 2.0 +highMin: 5.0 +highMax: 5.0 +relative: false +scalingCount: 5 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 1.0 +scaling4: 0.59183675 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.1509288 +timeline2: 0.39041096 +timeline3: 0.72602737 +timeline4: 0.86986303 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 1000.0 +relative: false +scalingCount: 6 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 1.0 +scaling4: 1.0 +scaling5: 1.0 +timelineCount: 6 +timeline0: 0.0 +timeline1: 0.113777086 +timeline2: 0.47678018 +timeline3: 0.5944272 +timeline4: 0.7972136 +timeline5: 0.89860684 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 200.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.98630136 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 200.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.020408163 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- X Scale - +lowMin: 40.0 +lowMax: 40.0 +highMin: 80.0 +highMax: 100.0 +relative: true +scalingCount: 6 +scaling0: 0.039325844 +scaling1: 0.2977528 +scaling2: 0.6011236 +scaling3: 0.71910113 +scaling4: 0.8707865 +scaling5: 1.0 +timelineCount: 6 +timeline0: 0.0 +timeline1: 0.16331269 +timeline2: 0.29256967 +timeline3: 0.46826625 +timeline4: 0.65634674 +timeline5: 0.996904 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 0.6666667 +scaling2: 0.84210527 +scaling3: 0.24561404 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.26027396 +timeline2: 0.60273975 +timeline3: 0.9109589 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +explosion.png + + +boom +- Delay - +active: false +- Duration - +lowMin: 1500.0 +lowMax: 1500.0 +- Count - +min: 0 +max: 25 +- Emission - +lowMin: 1.0 +lowMax: 1.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 5 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 0.67346936 +scaling3: 0.0 +scaling4: 0.0 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.15413533 +timeline2: 0.42465752 +timeline3: 0.5068493 +timeline4: 0.99303406 +- 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: ellipse +edges: false +side: both +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 10.0 +lowMax: 10.0 +highMin: 30.0 +highMax: 80.0 +relative: false +scalingCount: 3 +scaling0: 0.37078652 +scaling1: 0.75842696 +scaling2: 0.96067417 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.38467494 +timeline2: 0.996904 +- Y Scale - +active: false +- Velocity - +active: false +- Angle - +active: false +- Rotation - +active: true +lowMin: -15.0 +lowMax: -15.0 +highMin: 5.0 +highMax: 5.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Options - +attached: false +continuous: false +aligned: false +additive: true +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +boom.png + diff --git a/core/assets/data/particles/explosion.png b/core/assets/data/particles/explosion.png new file mode 100644 index 0000000..cac6d5b Binary files /dev/null and b/core/assets/data/particles/explosion.png differ diff --git a/core/assets/data/particles/explosion_small.particle b/core/assets/data/particles/explosion_small.particle new file mode 100644 index 0000000..7d83b8f --- /dev/null +++ b/core/assets/data/particles/explosion_small.particle @@ -0,0 +1,313 @@ +explosion +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 2.0 +lowMax: 2.0 +highMin: 5.0 +highMax: 5.0 +relative: false +scalingCount: 5 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 1.0 +scaling4: 0.59183675 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.1509288 +timeline2: 0.39041096 +timeline3: 0.72602737 +timeline4: 0.86986303 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 1000.0 +relative: false +scalingCount: 6 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 1.0 +scaling4: 1.0 +scaling5: 1.0 +timelineCount: 6 +timeline0: 0.0 +timeline1: 0.113777086 +timeline2: 0.47678018 +timeline3: 0.5944272 +timeline4: 0.7972136 +timeline5: 0.89860684 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.98630136 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.020408163 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- X Scale - +lowMin: 40.0 +lowMax: 40.0 +highMin: 50.0 +highMax: 70.0 +relative: true +scalingCount: 6 +scaling0: 0.039325844 +scaling1: 0.2977528 +scaling2: 0.6011236 +scaling3: 0.71910113 +scaling4: 0.8707865 +scaling5: 1.0 +timelineCount: 6 +timeline0: 0.0 +timeline1: 0.16331269 +timeline2: 0.29256967 +timeline3: 0.46826625 +timeline4: 0.65634674 +timeline5: 0.996904 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 0.0 +scaling1: 0.71929824 +scaling2: 0.8596491 +scaling3: 0.36842105 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.33561644 +timeline2: 0.65753424 +timeline3: 0.96575344 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +explosion.png + + +boom +- Delay - +active: false +- Duration - +lowMin: 1500.0 +lowMax: 1500.0 +- Count - +min: 0 +max: 25 +- Emission - +lowMin: 1.0 +lowMax: 1.0 +highMin: 2.0 +highMax: 2.0 +relative: false +scalingCount: 5 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 0.67346936 +scaling3: 0.0 +scaling4: 0.0 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.15413533 +timeline2: 0.42465752 +timeline3: 0.5068493 +timeline4: 0.99303406 +- 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: ellipse +edges: false +side: both +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 10.0 +lowMax: 10.0 +highMin: 30.0 +highMax: 80.0 +relative: false +scalingCount: 3 +scaling0: 0.37078652 +scaling1: 0.75842696 +scaling2: 0.96067417 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.38467494 +timeline2: 0.996904 +- Y Scale - +active: false +- Velocity - +active: false +- Angle - +active: false +- Rotation - +active: true +lowMin: -15.0 +lowMax: -15.0 +highMin: 5.0 +highMax: 5.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Options - +attached: false +continuous: false +aligned: false +additive: true +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +boom.png + diff --git a/core/assets/data/particles/feather.particle b/core/assets/data/particles/feather.particle new file mode 100644 index 0000000..3312ed9 --- /dev/null +++ b/core/assets/data/particles/feather.particle @@ -0,0 +1,149 @@ +slugs +- Delay - +active: false +- Duration - +lowMin: 10000.0 +lowMax: 10000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 2.0 +lowMax: 2.0 +highMin: 4.0 +highMax: 4.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 500.0 +highMax: 750.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.66 +timeline2: 1.0 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 359.0 +highMax: 359.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.999 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 9 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +colors3: 1.0 +colors4: 1.0 +colors5: 1.0 +colors6: 1.0 +colors7: 1.0 +colors8: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.01 +timeline2: 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.21232876 +timeline2: 0.65068495 +timeline3: 0.9794521 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +/home/emamaker/github/amazeing/gdx/core/assets/data/powerups/feather.png + diff --git a/core/assets/data/particles/slugs.particle b/core/assets/data/particles/slugs.particle new file mode 100644 index 0000000..bf3e43b --- /dev/null +++ b/core/assets/data/particles/slugs.particle @@ -0,0 +1,149 @@ +slugs +- Delay - +active: false +- Duration - +lowMin: 15000.0 +lowMax: 15000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 2.0 +lowMax: 2.0 +highMin: 4.0 +highMax: 4.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 500.0 +highMax: 750.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.66 +timeline2: 1.0 +independent: false +- Life Offset - +active: false +independent: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 60.0 +highMax: 60.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Y Scale - +active: false +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 359.0 +highMax: 359.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.999 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 9 +colors0: 0.58431375 +colors1: 0.8784314 +colors2: 0.43529412 +colors3: 0.0 +colors4: 0.0 +colors5: 0.0 +colors6: 1.0 +colors7: 1.0 +colors8: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.050933786 +timeline2: 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.21232876 +timeline2: 0.65068495 +timeline3: 0.9794521 +- Options - +attached: false +continuous: false +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +/home/emamaker/github/amazeing/gdx/core/assets/data/powerups/slug.png + diff --git a/core/src/com/emamaker/amazeing/AMazeIng.java b/core/src/com/emamaker/amazeing/AMazeIng.java index 0f5fa32..3552980 100755 --- a/core/src/com/emamaker/amazeing/AMazeIng.java +++ b/core/src/com/emamaker/amazeing/AMazeIng.java @@ -6,7 +6,10 @@ import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputMultiplexer; import com.badlogic.gdx.graphics.FPSLogger; +import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.physics.bullet.Bullet; +import com.badlogic.gdx.utils.Array; import com.emamaker.amazeing.manager.GameManager; import com.emamaker.amazeing.manager.managers.GameManagerLocal; import com.emamaker.amazeing.manager.network.GameClient; @@ -39,6 +42,12 @@ public class AMazeIng extends Game { public static Platform PLATFORM; + public float delta = 0; + + public SpriteBatch spriteBatch; + public Array effects = new Array(); + + public AMazeIng(Platform p) { PLATFORM = p; } @@ -68,6 +77,8 @@ public class AMazeIng extends Game { setupGUI(); setupGameManager(); setupPowerUps(); + + spriteBatch = new SpriteBatch(); } public void setupGUI() { @@ -94,19 +105,45 @@ public class AMazeIng extends Game { @Override public void render() { super.render(); + delta = Math.min(1f / 30f, Gdx.graphics.getDeltaTime()); + server.update(); client.update(); gameManager.update(); + + spriteBatch.begin(); + // Update and draw effects: + for (int i = effects.size - 1; i >= 0; i--) { + PooledEffect effect = effects.get(i); + effect.draw(spriteBatch, delta); + if (effect.isComplete()) { + effect.free(); + effects.removeIndex(i); + } + } + spriteBatch.end(); + } @Override public void dispose() { gameManager.dispose(); - client.stop(); + if (server.isRunning()) + client.stop(true); + else + client.stop(); server.stop(); world.dispose(); + clearEffects(); } + public void clearEffects() { + // Reset all effects: + for (int i = effects.size - 1; i >= 0; i--) + effects.get(i).free(); //free all the effects back to the pool + effects.clear(); //clear the current effects array + } + @Override public void resize(int width, int height) { world.resize(width, height); diff --git a/core/src/com/emamaker/amazeing/manager/GameManager.java b/core/src/com/emamaker/amazeing/manager/GameManager.java index 9b15831..50497f9 100755 --- a/core/src/com/emamaker/amazeing/manager/GameManager.java +++ b/core/src/com/emamaker/amazeing/manager/GameManager.java @@ -173,8 +173,10 @@ public class GameManager { public void checkWin() { for (MazePlayer p : players) - if (checkWin(p)) + if (checkWin(p)) { setFinished(); + return; + } } public void setFinished() { @@ -183,7 +185,7 @@ public class GameManager { for (MazePlayer p : players) p.disablePowerUp(); - + main.clearEffects(); } public boolean getFinished() { @@ -321,7 +323,7 @@ public class GameManager { } public void requestChangeToMap(int[][] todraw) { - mazeGen.requestChangeToMap(todraw); + mazeGen.show(todraw); } public void resetCamera() { diff --git a/core/src/com/emamaker/amazeing/manager/network/GameClient.java b/core/src/com/emamaker/amazeing/manager/network/GameClient.java index e77d762..344f952 100755 --- a/core/src/com/emamaker/amazeing/manager/network/GameClient.java +++ b/core/src/com/emamaker/amazeing/manager/network/GameClient.java @@ -10,7 +10,6 @@ import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.manager.managers.GameManagerClient; import com.emamaker.amazeing.manager.network.action.NetworkAction; import com.emamaker.amazeing.manager.network.action.actions.client.game.NACGameStatusUpdate; -import com.emamaker.amazeing.manager.network.action.actions.client.game.NACServerClosed; import com.emamaker.amazeing.manager.network.action.actions.client.game.NACUpdateMap; import com.emamaker.amazeing.manager.network.action.actions.client.login.NACLoginAO; import com.emamaker.amazeing.manager.network.action.actions.client.login.NACLoginAO2; @@ -22,6 +21,7 @@ import com.emamaker.amazeing.maze.settings.MazeSettings; import com.emamaker.amazeing.player.MazePlayer; import com.emamaker.amazeing.player.MazePlayerLocal; import com.emamaker.amazeing.player.PlayerUtils; +import com.emamaker.amazeing.utils.MathUtils.Constants; import com.esotericsoftware.kryonet.Client; public class GameClient extends NetworkHandler { @@ -29,7 +29,7 @@ public class GameClient extends NetworkHandler { public Client client; String addr; - boolean updateMobilePlayers = false; + boolean updateMobilePlayers = true; public CopyOnWriteArrayList localPlayers = new CopyOnWriteArrayList(); @@ -72,7 +72,6 @@ public class GameClient extends NetworkHandler { actions.add(new NACUpdatePlayerPosForced(this)); actions.add(new NACUpdatePlayersPos(this)); actions.add(new NACUpdateOtherPlayerPos(this)); - actions.add(new NACServerClosed(this)); } @Override @@ -83,8 +82,14 @@ public class GameClient extends NetworkHandler { @Override public void update() { super.update(); - + if (isRunning()) { + //Check if the server disconnected or it's timing out + if(!client.isConnected() || ((NACGameStatusUpdate.gotMessage && System.currentTimeMillis() - NACGameStatusUpdate.lastMsgTime > Constants.COMMUNICATION_TIMEOUT_MILLIS))) { + stop(true); + main.uiManager.srvJoinScreen.showErrorDlg(1); + } + //Normal client update if (gameManager != null) { if (gameManager.gameStarted) { } else { @@ -106,26 +111,39 @@ public class GameClient extends NetworkHandler { @Override public void stop() { + stop(false); + } + + public void stop(boolean fromserver) { if (isRunning()) { - for (String s : localPlayers) { - ((NACRemovePlayer) getActionByClass(NACRemovePlayer.class)).startAction(null, null, s); + if (!fromserver) { + for (String s : localPlayers) { + ((NACRemovePlayer) getActionByClass(NACRemovePlayer.class)).startAction(null, null, s); + } } for (MazePlayer p : players.values()) p.dispose(); players.clear(); - for (NetworkAction n : pendingActions) - n.onParentClosing(); - while (!pendingActions.isEmpty()) - update(); + if (!fromserver) { + for (NetworkAction n : pendingActions) + n.onParentClosing(); + + while (!pendingActions.isEmpty()) + update(); + } + + pendingActions.clear(); + todoActions.clear(); + actions.clear(); client.stop(); running = false; -// } } + } /* CHECKING FOR NEW PLAYERS */ diff --git a/core/src/com/emamaker/amazeing/manager/network/GameServer.java b/core/src/com/emamaker/amazeing/manager/network/GameServer.java index 3d988e6..78e944e 100755 --- a/core/src/com/emamaker/amazeing/manager/network/GameServer.java +++ b/core/src/com/emamaker/amazeing/manager/network/GameServer.java @@ -7,7 +7,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.emamaker.amazeing.manager.managers.GameManagerServer; import com.emamaker.amazeing.manager.network.action.actions.server.game.NASGameStatusUpdate; -import com.emamaker.amazeing.manager.network.action.actions.server.game.NASServerClosed; import com.emamaker.amazeing.manager.network.action.actions.server.game.NASUpdateMap; import com.emamaker.amazeing.manager.network.action.actions.server.login.NASLoginAO2; import com.emamaker.amazeing.manager.network.action.actions.server.login.NASLoginUUID; @@ -15,6 +14,7 @@ import com.emamaker.amazeing.manager.network.action.actions.server.login.NASRemo import com.emamaker.amazeing.manager.network.action.actions.server.player.NASUpdatePlayerPos; import com.emamaker.amazeing.manager.network.action.actions.server.player.NASUpdatePlayerPosForced; import com.emamaker.amazeing.player.MazePlayer; +import com.emamaker.amazeing.utils.MathUtils.Constants; import com.esotericsoftware.kryonet.Server; public class GameServer extends NetworkHandler { @@ -26,7 +26,6 @@ public class GameServer extends NetworkHandler { // Returns true if the server started successfully public boolean start(int port_) { port = port_; - running = true; try { server = new Server(); // For consistency, the classes to be sent over the network are @@ -41,6 +40,8 @@ public class GameServer extends NetworkHandler { startDefaultActions(); System.out.println("Server registered and running on port " + port); + + running = true; return true; } catch (IOException e) { @@ -59,7 +60,6 @@ public class GameServer extends NetworkHandler { actions.add(new NASUpdateMap(this)); actions.add(new NASUpdatePlayerPosForced(this)); actions.add(new NASUpdatePlayerPos(this)); - actions.add(new NASServerClosed(this)); } @Override @@ -68,6 +68,22 @@ public class GameServer extends NetworkHandler { // getActionByClass(NAServerUpdatePlayers.class).startAction(null, null); } + @Override + public void update() { + super.update(); + + if(isRunning()) { + //Check if there's some player not responding that needs to be removed + for(String s: players.keySet()) { + if(System.currentTimeMillis() - players.get(s).LAST_NETWORK_TIME > Constants.COMMUNICATION_TIMEOUT_MILLIS) { + players.get(s).dispose(); + players.remove(s); + } + System.out.println(Arrays.toString(players.values().toArray())); + } + } + } + @Override public void periodicNonGameUpdate() { } @@ -99,9 +115,12 @@ public class GameServer extends NetworkHandler { for (MazePlayer p : players.values()) { p.dispose(); players.clear(); - getActionByClass(NASServerClosed.class).startAction(null, null); server.stop(); running = false; + + pendingActions.clear(); + todoActions.clear(); + actions.clear(); } } } diff --git a/core/src/com/emamaker/amazeing/manager/network/NetworkHandler.java b/core/src/com/emamaker/amazeing/manager/network/NetworkHandler.java index 42f211b..ecab8d7 100644 --- a/core/src/com/emamaker/amazeing/manager/network/NetworkHandler.java +++ b/core/src/com/emamaker/amazeing/manager/network/NetworkHandler.java @@ -1,9 +1,5 @@ package com.emamaker.amazeing.manager.network; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.CopyOnWriteArrayList; - import com.badlogic.gdx.math.Vector3; import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.manager.GameManager; @@ -12,6 +8,10 @@ import com.emamaker.amazeing.manager.network.NetworkCommon.UpdatePlayerPosition; import com.emamaker.amazeing.manager.network.action.NetworkAction; import com.emamaker.amazeing.player.MazePlayer; +import java.util.Arrays; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; + public abstract class NetworkHandler { public ConcurrentHashMap players = new ConcurrentHashMap(); @@ -26,7 +26,7 @@ public abstract class NetworkHandler { // Some actions (such as the first step of login) cannot be done in multiple // instances at the same time // Actions of this type have to be stored here - public ConcurrentLinkedQueue todoActions = new ConcurrentLinkedQueue<>(); + public CopyOnWriteArrayList todoActions = new CopyOnWriteArrayList<>(); CopyOnWriteArrayList deletePending = new CopyOnWriteArrayList<>(); int port; @@ -61,11 +61,23 @@ public abstract class NetworkHandler { } public void updatePending() { - if (!todoActions.isEmpty()) { - if (!alreadyPending(todoActions.peek())) - todoActions.peek().startAction(null, null); - addToPending(todoActions.remove()); + //System.out.println(Arrays.toString(todoActions.toArray())); + for(NetworkAction a : todoActions) { + if(!alreadyPending(a)) { + System.out.println(a); + addToPending(a); + todoActions.remove(a); + } } + + // if (!todoActions.isEmpty()) { +// System.out.println("Actions queue: " + Arrays.toString(todoActions.toArray())); +// if (!alreadyPending(todoActions.peek())) { +// todoActions.peek().startAction(null, null); +// System.out.println("Getting action from queue: " + todoActions.peek()); +// addToPending(todoActions.remove()); +// } +// } for (NetworkAction n : pendingActions) n.update(); @@ -75,7 +87,7 @@ public abstract class NetworkHandler { * Unluckily, we can't check if a specific action is already pending. But we can * check if there's another type of the same action running. NetworkActions can * override the startAction method to be started even if there's another one - * already running (e.g. PositionUpdates) + * already running (e.g. Player Removal) */ public boolean alreadyPending(NetworkAction act) { for (NetworkAction a : pendingActions) { @@ -83,6 +95,10 @@ public abstract class NetworkHandler { // System.out.println("Already pending " + act); return true; } + /*for(int i = 0; i < act.maskActions.length; i++){ + if(a.getClass().isAssignableFrom(a.maskActions[i].getClass())) return true; + }*/ + } return false; } @@ -94,6 +110,7 @@ public abstract class NetworkHandler { } public void addToPending(NetworkAction a) { + a.registerEndListener(); pendingActions.add(a); } diff --git a/core/src/com/emamaker/amazeing/manager/network/action/NetworkAction.java b/core/src/com/emamaker/amazeing/manager/network/action/NetworkAction.java index f2aafe6..cd933de 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/NetworkAction.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/NetworkAction.java @@ -4,6 +4,7 @@ import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.manager.network.GameClient; import com.emamaker.amazeing.manager.network.GameServer; import com.emamaker.amazeing.manager.network.NetworkHandler; +import com.emamaker.amazeing.utils.MathUtils.Constants; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.Listener; @@ -36,12 +37,14 @@ public abstract class NetworkAction { protected NetworkHandler parent; protected boolean oneTime; - protected long TIMEOUT_TIME = 5000; protected long startTime; boolean tookTimeout = false; boolean usingTimeout = true; boolean oneAtTheTime = true; - + + //A list of actions that prevent the action to be started inside alreadyPending method + //(e.g NACLoginAO cannot be started if there's still a NACLoginAO2 running) + public AMazeIng main = AMazeIng.getMain(); Listener startListener = new Listener() { @@ -74,13 +77,9 @@ public abstract class NetworkAction { this.parent = parent_; this.oneTime = oneTime; - if (client() != null) - client().client.addListener(endListener); - if (server() != null) - server().server.addListener(endListener); - tookTimeout = false; usingTimeout = true; +// setMaskActions(maskActions); // update(); } @@ -96,6 +95,8 @@ public abstract class NetworkAction { client().client.addListener(startListener); if (server() != null) server().server.addListener(startListener); + +// setMaskActions(maskActions_); } public void startAction() { @@ -110,6 +111,8 @@ public abstract class NetworkAction { if (oneAtTheTime) { if (!parent.alreadyPending(this)) parent.addToPending(newInstance()); +// else +// addToQueue(); } else { parent.addToPending(newInstance()); } @@ -123,7 +126,7 @@ public abstract class NetworkAction { resolveAction(); if (oneTime) responseReceived(null, null); - if (System.currentTimeMillis() - startTime > TIMEOUT_TIME && usingTimeout) + if (System.currentTimeMillis() - startTime > Constants.NETWORK_ACTION_TIMEOUT_MILLIS && usingTimeout) detachFromParent(); } @@ -182,5 +185,13 @@ public abstract class NetworkAction { public void addToQueue() { parent.todoActions.add(newInstance()); } + + public void registerEndListener() { + if (client() != null) + client().client.addListener(endListener); + if (server() != null) + server().server.addListener(endListener); + } + } \ No newline at end of file diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACGameStatusUpdate.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACGameStatusUpdate.java index 779dd4c..4785cb3 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACGameStatusUpdate.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACGameStatusUpdate.java @@ -12,6 +12,9 @@ import com.esotericsoftware.kryonet.Connection; public class NACGameStatusUpdate extends NetworkAction { + public static boolean gotMessage = false; + public static long lastMsgTime = 0; + protected NACGameStatusUpdate(NetworkHandler parent, Connection c, Object incomingMsg_, Object responsePacket_, Object endPacket_, boolean oneTime) { super(parent, c, incomingMsg_, responsePacket_, endPacket_, oneTime); @@ -51,6 +54,9 @@ public class NACGameStatusUpdate extends NetworkAction { client().gameManager.gameStarted = ((GameStatusUpdate) incomingMsg).gameStarted; client().gameManager.anyoneWon = ((GameStatusUpdate) incomingMsg).anyoneWon; + gotMessage = true; + lastMsgTime = System.currentTimeMillis(); + } @Override diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACServerClosed.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACServerClosed.java deleted file mode 100644 index 7b0a5e4..0000000 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/game/NACServerClosed.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.emamaker.amazeing.manager.network.action.actions.client.game; - -import com.emamaker.amazeing.manager.network.NetworkCommon; -import com.emamaker.amazeing.manager.network.NetworkHandler; -import com.emamaker.amazeing.manager.network.action.NetworkAction; -import com.esotericsoftware.kryonet.Connection; - -public class NACServerClosed extends NetworkAction { - - protected NACServerClosed(NetworkHandler parent, Connection c, Object incomingMsg_, Object responsePacket_, - Object endPacket_, boolean oneTime) { - super(parent, c, incomingMsg_, responsePacket_, endPacket_, oneTime); - } - - public NACServerClosed(NetworkHandler parent_) { - super(parent_, new NetworkCommon.ServerClosed(), null, null, true); - } - - @Override - public void resolveAction() { - super.resolveAction(); - - System.out.println("Server stopped!"); - parent.stop(); - main.uiManager.srvJoinScreen.showErrorDlg(0); - } - - @Override - public void responseReceived(Connection conn, Object msg) { - super.responseReceived(conn, msg); - } - - @Override - public NetworkAction newInstance() { - return new NACServerClosed(client(), incomingConnection, incomingMsg, responsePacket, endPacket, oneTime); - } - -} diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACLoginAO.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACLoginAO.java index 54c52e9..6febc94 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACLoginAO.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACLoginAO.java @@ -11,7 +11,7 @@ public class NACLoginAO extends NetworkAction { boolean oneTime) { super(parent, c, incomingMsg_, responsePacket_, endPacket_, oneTime); } - + public NACLoginAO(NetworkHandler parent_) { super(parent_, null, new NetworkCommon.ClientLoginAO(), new NetworkCommon.ServerLoginUUID(), false); } diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACRemovePlayer.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACRemovePlayer.java index 77f84c8..9b4028e 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACRemovePlayer.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/login/NACRemovePlayer.java @@ -43,7 +43,7 @@ public class NACRemovePlayer extends NetworkAction { @Override public void resolveAction() { super.resolveAction(); - System.out.println("Asking the server to remove player " + uuid); +// System.out.println("Asking the server to remove player " + uuid); ((RemovePlayer) responsePacket).uuid = uuid; client().client.sendUDP(responsePacket); } @@ -63,7 +63,7 @@ public class NACRemovePlayer extends NetworkAction { } detachFromParent(); } -// System.out.println("Response received for " + this); + System.out.println("Response received for " + this); } @Override diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/player/NACUpdatePlayersPos.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/player/NACUpdatePlayersPos.java index e3a6a1a..452cc83 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/client/player/NACUpdatePlayersPos.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/client/player/NACUpdatePlayersPos.java @@ -4,10 +4,13 @@ import com.emamaker.amazeing.manager.network.NetworkCommon; import com.emamaker.amazeing.manager.network.NetworkHandler; import com.emamaker.amazeing.manager.network.action.NetworkAction; import com.emamaker.amazeing.player.MazePlayerLocal; +import com.emamaker.amazeing.utils.MathUtils.Constants; import com.esotericsoftware.kryonet.Connection; public class NACUpdatePlayersPos extends NetworkAction { + long lastTime = 0; + protected NACUpdatePlayersPos(NetworkHandler parent, Connection c, Object incomingMsg_, Object responsePacket_, Object endPacket_, boolean oneTime) { super(parent, c, incomingMsg_, responsePacket_, endPacket_, oneTime); @@ -24,9 +27,13 @@ public class NACUpdatePlayersPos extends NetworkAction { if (parent.gameManager.gameStarted) for (String s : client().localPlayers) { - if (parent.players.containsKey(s) && ((MazePlayerLocal) parent.players.get(s)).getPressed()) { + // Update pos if the player moved or every sec + if (parent.players.containsKey(s) && (((MazePlayerLocal) parent.players.get(s)).getPressed() + || System.currentTimeMillis() - lastTime > Constants.CLIENT_POS_PERIODIC_UPDATE)) { responsePacket = parent.updatePlayer(s, parent.players.get(s), false); client().client.sendUDP(responsePacket); + if (System.currentTimeMillis() - lastTime > Constants.CLIENT_POS_PERIODIC_UPDATE) + lastTime = System.currentTimeMillis(); } } } @@ -40,5 +47,5 @@ public class NACUpdatePlayersPos extends NetworkAction { public NetworkAction newInstance() { return new NACUpdatePlayersPos(client(), incomingConnection, incomingMsg, responsePacket, endPacket, oneTime); } - + } diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/game/NASServerClosed.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/game/NASServerClosed.java deleted file mode 100644 index f42b74a..0000000 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/game/NASServerClosed.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.emamaker.amazeing.manager.network.action.actions.server.game; - -import com.emamaker.amazeing.manager.network.NetworkCommon; -import com.emamaker.amazeing.manager.network.NetworkHandler; -import com.emamaker.amazeing.manager.network.action.NetworkAction; -import com.esotericsoftware.kryonet.Connection; - -public class NASServerClosed extends NetworkAction { - - protected NASServerClosed(NetworkHandler parent, Connection c, Object incomingMsg_, Object responsePacket_, - Object endPacket_, boolean oneTime) { - super(parent, c, incomingMsg_, responsePacket_, endPacket_, oneTime); - } - - public NASServerClosed(NetworkHandler parent_) { - super(parent_, null, new NetworkCommon.ServerClosed(), null, true); - } - - @Override - public void resolveAction() { - super.resolveAction(); - System.out.println("Server stopped?"); - server().server.sendToAllUDP(responsePacket); - } - - @Override - public void responseReceived(Connection conn, Object msg) { - super.responseReceived(conn, msg); - } - - @Override - public NetworkAction newInstance() { - return new NASServerClosed(server(), incomingConnection, incomingMsg, responsePacket, endPacket, oneTime); - } - -} diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginAO2.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginAO2.java index 8053104..6e703e1 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginAO2.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginAO2.java @@ -30,6 +30,8 @@ public class NASLoginAO2 extends NetworkAction { System.out.println("Client accepted uuid " + uuid); MazePlayerRemote player = new MazePlayerRemote(uuid); server().players.put(uuid, player); + server().players.get(uuid).LAST_NETWORK_TIME = System.currentTimeMillis(); + server().setUpdatePos(uuid, false); } ((ServerLoginAO2)responsePacket).uuid = uuid; diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginUUID.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginUUID.java index 6039649..cc53ec7 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginUUID.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/login/NASLoginUUID.java @@ -3,6 +3,7 @@ package com.emamaker.amazeing.manager.network.action.actions.server.login; import java.util.UUID; import com.emamaker.amazeing.manager.network.NetworkCommon; +import com.emamaker.amazeing.manager.network.NetworkCommon.ClientLoginAO2; import com.emamaker.amazeing.manager.network.NetworkCommon.ServerLoginUUID; import com.emamaker.amazeing.manager.network.NetworkHandler; import com.emamaker.amazeing.manager.network.action.NetworkAction; diff --git a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/player/NASUpdatePlayerPos.java b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/player/NASUpdatePlayerPos.java index 97172ac..54700ac 100644 --- a/core/src/com/emamaker/amazeing/manager/network/action/actions/server/player/NASUpdatePlayerPos.java +++ b/core/src/com/emamaker/amazeing/manager/network/action/actions/server/player/NASUpdatePlayerPos.java @@ -27,6 +27,7 @@ public class NASUpdatePlayerPos extends NetworkAction { float pz = ((UpdatePlayerPosition) incomingMsg).pz; if (parent.players.containsKey(uuid) && server().canUpdatePos(uuid) && parent.gameManager.gameStarted) { parent.players.get(uuid).setPos(px, py, pz); + parent.players.get(uuid).LAST_NETWORK_TIME = System.currentTimeMillis(); server().server.sendToAllUDP(incomingMsg); } } diff --git a/core/src/com/emamaker/amazeing/maze/MazeGenerator.java b/core/src/com/emamaker/amazeing/maze/MazeGenerator.java index 672ec3f..83c38c0 100755 --- a/core/src/com/emamaker/amazeing/maze/MazeGenerator.java +++ b/core/src/com/emamaker/amazeing/maze/MazeGenerator.java @@ -242,9 +242,12 @@ public class MazeGenerator { OLDMAZEX = MazeSettings.MAZEX; OLDMAZEZ = MazeSettings.MAZEZ; + todraw = new int[w][h]; + for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { todraw[i][j] = todraw_[i][j]; + main.world.worldManager.setCell(i, 0, j, CellId.ID_GRASS); if (todraw[i][j] == 1) @@ -258,18 +261,16 @@ public class MazeGenerator { } } } - + public int[][] changeMap(int[][] tmp, int x, int z, int type) { - if(x > 0 && x < w - 1 && z > 0 && z < h - 1 && todraw[x][z] != 2) tmp[x][z] = type; + if (x > 0 && x < w - 1 && z > 0 && z < h - 1 && todraw[x][z] != 2) { + tmp[x][z] = type; + } return tmp; } public void requestChangeToMap(int[][] todraw_) { - if(AMazeIng.getMain().client.isRunning()) { -// AMazeIng.getMain().client.requestUpdateMap(todraw_); - }else { - show(todraw_); - } + show(todraw_); } boolean allCellsVisited() { diff --git a/core/src/com/emamaker/amazeing/maze/settings/MazeSetting.java b/core/src/com/emamaker/amazeing/maze/settings/MazeSetting.java index a51c162..ff60eb4 100755 --- a/core/src/com/emamaker/amazeing/maze/settings/MazeSetting.java +++ b/core/src/com/emamaker/amazeing/maze/settings/MazeSetting.java @@ -141,5 +141,18 @@ public class MazeSetting { public String getOptionString() { return options[currentOption]; } + + public String getValueAt(int i) { + if(i < options.length) return options[i]; + return ""; + } + + public String getFirstValue() { + return getValueAt(0); + } + + public String getLastValue() { + return getValueAt(options.length-1); + } } diff --git a/core/src/com/emamaker/amazeing/maze/settings/MazeSettings.java b/core/src/com/emamaker/amazeing/maze/settings/MazeSettings.java index de3db0c..22ceb56 100755 --- a/core/src/com/emamaker/amazeing/maze/settings/MazeSettings.java +++ b/core/src/com/emamaker/amazeing/maze/settings/MazeSettings.java @@ -36,7 +36,7 @@ public class MazeSettings { AMazeIng.getMain().uiManager); setStartPowerups = new MazeSettingStartPowerUps("POWERUPS AT START : ", - new String[] { "1", "2", "3", "4", "5", "8", "10", "15" }, 2, AMazeIng.getMain().uiManager); + new String[] { "1", "2", "3", "4", "5", "8", "10", "15" }, 6, AMazeIng.getMain().uiManager); setEpDist = new MazeSettingEPDIST("END POINT DISTANCE:", new String[] { "1", "2", "5", "10", "20" }, 2, AMazeIng.getMain().uiManager); diff --git a/core/src/com/emamaker/amazeing/player/MazePlayer.java b/core/src/com/emamaker/amazeing/player/MazePlayer.java index f4a0e51..154a11b 100755 --- a/core/src/com/emamaker/amazeing/player/MazePlayer.java +++ b/core/src/com/emamaker/amazeing/player/MazePlayer.java @@ -48,6 +48,8 @@ public abstract class MazePlayer implements Disposable { public float speed; public float turnSpeed; + public long LAST_NETWORK_TIME = 0; + Vector3 pos = new Vector3(); Quaternion rot = new Quaternion(); @@ -146,7 +148,7 @@ public abstract class MazePlayer implements Disposable { } public void usePowerUp() { - if (currentPowerUp != null && !currentPowerUp.beingUsed) + if (currentPowerUp != null) if (currentPowerUp.usePowerUp(this)) disablePowerUp(); } diff --git a/core/src/com/emamaker/amazeing/player/MazePlayerLocal.java b/core/src/com/emamaker/amazeing/player/MazePlayerLocal.java index b397760..049b884 100755 --- a/core/src/com/emamaker/amazeing/player/MazePlayerLocal.java +++ b/core/src/com/emamaker/amazeing/player/MazePlayerLocal.java @@ -304,7 +304,6 @@ public class MazePlayerLocal extends MazePlayer { if (!isDisposed() && initedPhysics) { characterTransform.set(x, y, z, i, j, k, l); ghostObject.setWorldTransform(characterTransform); - System.out.println(characterTransform.getTranslation(new Vector3()).toString()); } } diff --git a/core/src/com/emamaker/amazeing/player/powerups/PowerUp.java b/core/src/com/emamaker/amazeing/player/powerups/PowerUp.java index b9d6267..7e98ab5 100755 --- a/core/src/com/emamaker/amazeing/player/powerups/PowerUp.java +++ b/core/src/com/emamaker/amazeing/player/powerups/PowerUp.java @@ -1,8 +1,12 @@ package com.emamaker.amazeing.player.powerups; +import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.VertexAttributes; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.graphics.g2d.ParticleEffectPool; +import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect; import com.badlogic.gdx.graphics.g3d.Environment; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; @@ -16,6 +20,7 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Disposable; import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.player.MazePlayer; +import com.emamaker.amazeing.utils.MathUtils; public class PowerUp implements Disposable { @@ -36,11 +41,15 @@ public class PowerUp implements Disposable { Vector3 pos = new Vector3(); - public PowerUp(String name_, Texture texture_, boolean cont) { - this(name_, texture_, cont, 1, 1); + ParticleEffect effect; + ParticleEffectPool effectPool; + + public PowerUp(String name_, Texture texture_, boolean cont, FileHandle effectFile, FileHandle imageSrc) { + this(name_, texture_, cont, 1, 1, effectFile, imageSrc); } - public PowerUp(String name_, Texture texture_, boolean cont, float scaleX, float scaleZ) { + public PowerUp(String name_, Texture texture_, boolean cont, float scaleX, float scaleZ, FileHandle effectFile, + FileHandle imageSrc) { this.name = name_; this.texture = texture_; this.scaleX = scaleX; @@ -54,6 +63,12 @@ public class PowerUp implements Disposable { beingUsed = false; built = false; toUpdatePos = false; + + if (effectFile != null && imageSrc != null) { + effect = new ParticleEffect(); + effect.load(effectFile, imageSrc); + effectPool = new ParticleEffectPool(effect, 1, 2); + } } @SuppressWarnings("deprecation") @@ -106,7 +121,15 @@ public class PowerUp implements Disposable { // Return true if the effect has been resolved public boolean usePowerUp(MazePlayer player) { -// System.out.println(this.name + "!"); + System.out.println(this.name + " ! "); + + if (effect != null) { + PooledEffect e = effectPool.obtain(); + Vector3 pos = MathUtils.toScreenCoords(player.getPos()); + e.setPosition(pos.x, pos.y); + + AMazeIng.getMain().effects.add(e); + } return true; } @@ -122,36 +145,47 @@ class PowerUpTemporized extends PowerUp { long time = 0, startTime = 0; boolean used = false; - public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_) { - this(name_, texture_, cont, secs_, 1, 1); + public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_, FileHandle effectFile, + FileHandle imageSrc) { + this(name_, texture_, cont, secs_, 1, 1, effectFile, imageSrc); } - public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_, float scaleX, float scaleZ) { - super(name_, texture_, cont, scaleX, scaleZ); + public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_, float scaleX, float scaleZ, + FileHandle effectFile, FileHandle imageSrc) { + super(name_, texture_, cont, scaleX, scaleZ, effectFile, imageSrc); this.time = (long) (secs_ * 1000); startTime = 0; } + PooledEffect e; + @Override public boolean usePowerUp(MazePlayer player) { - super.usePowerUp(player); - if (!used) { startTime = System.currentTimeMillis(); used = true; + + e = effectPool.obtain(); + AMazeIng.getMain().effects.add(e); } - if (System.currentTimeMillis() - startTime < time) { + if (System.currentTimeMillis() - startTime <= time) { temporizedEffect(player); + System.out.println("starting " + name); return false; } else { used = false; + System.out.println("finishing " + name); + e = null; temporizedEffectExpired(player); return true; } } public void temporizedEffect(MazePlayer player) { + Vector3 p = MathUtils.toScreenCoords(player.getPos()); + e.setPosition(p.x, p.y); + beingUsed = true; } @@ -166,24 +200,26 @@ class PowerUpGiver extends PowerUp { PowerUp powerup; MazePlayer p; - public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos) { - this(p, name, texture, continuos, 1f, 1f); + public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos, FileHandle effectFile, + FileHandle imageSrc) { + this(p, name, texture, continuos, 1f, 1f, effectFile, imageSrc); } - public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos, float scaleX, float scaleZ) { - super(name, texture, continuos, scaleX, scaleZ); + public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos, float scaleX, float scaleZ, + FileHandle effectFile, FileHandle imageSrc) { + super(name, texture, continuos, scaleX, scaleZ, effectFile, imageSrc); this.powerup = p; } @Override public boolean usePowerUp(MazePlayer player) { - super.usePowerUp(player); +// super.usePowerUp(player); p = null; if (AMazeIng.getMain().currentGameManager.players.size() > 1) { while (p == player || p == null) p = AMazeIng.getMain().currentGameManager.getRandomPlayer(); - p.currentPowerUp = new PowerUpBallAndChain(); + p.currentPowerUp = powerup; p.usePowerUp(); } diff --git a/core/src/com/emamaker/amazeing/player/powerups/PowerUpBallAndChain.java b/core/src/com/emamaker/amazeing/player/powerups/PowerUpBallAndChain.java index dc28fd5..df6cfb7 100755 --- a/core/src/com/emamaker/amazeing/player/powerups/PowerUpBallAndChain.java +++ b/core/src/com/emamaker/amazeing/player/powerups/PowerUpBallAndChain.java @@ -1,21 +1,25 @@ package com.emamaker.amazeing.player.powerups; +import com.badlogic.gdx.Gdx; import com.emamaker.amazeing.player.MazePlayer; import com.emamaker.amazeing.utils.TextureLoader; public class PowerUpBallAndChain extends PowerUpTemporized { public PowerUpBallAndChain() { - super("BALL AND CHAIN", TextureLoader.textureBallAndChain, true, 10, 1f, 1f); + super("BALL AND CHAIN", TextureLoader.textureBallAndChain, true, 10, 1f, 1f, + Gdx.files.internal("data/particles/ball_and_chain.particle"), Gdx.files.internal("data/powerups")); } @Override public void temporizedEffect(MazePlayer player) { + super.temporizedEffect(player); player.speedMult = 0.5f; } @Override public void temporizedEffectExpired(MazePlayer player) { + super.temporizedEffectExpired(player); player.speedMult = 1f; } } @@ -23,9 +27,7 @@ public class PowerUpBallAndChain extends PowerUpTemporized { class PowerUpGiveBallAndChain extends PowerUpGiver { public PowerUpGiveBallAndChain() { - super(new PowerUpBallAndChain(), "BALL AND CHAIN GIVER", - TextureLoader.textureBallAndChain, false, - 1f, 1f); + super(new PowerUpBallAndChain(), "BALL AND CHAIN GIVER", TextureLoader.textureBallAndChain, false, null, null); } } diff --git a/core/src/com/emamaker/amazeing/player/powerups/PowerUpBomb.java b/core/src/com/emamaker/amazeing/player/powerups/PowerUpBomb.java index 49db19e..138929d 100755 --- a/core/src/com/emamaker/amazeing/player/powerups/PowerUpBomb.java +++ b/core/src/com/emamaker/amazeing/player/powerups/PowerUpBomb.java @@ -1,5 +1,7 @@ package com.emamaker.amazeing.player.powerups; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Texture; import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.player.MazePlayer; @@ -12,11 +14,11 @@ public class PowerUpBomb extends PowerUp { AMazeIng main = AMazeIng.getMain(); public PowerUpBomb() { - this("BOMB", TextureLoader.textureBomb, false, 1f, 1f); + this("BOMB", TextureLoader.textureBomb, false, 1f, 1f, Gdx.files.internal("data/particles/explosion_small.particle"), Gdx.files.internal("data/particles")); } - public PowerUpBomb(String name, Texture texture, boolean cont, float sx, float sz) { - super(name, texture, cont, sx, sz); + public PowerUpBomb(String name, Texture texture, boolean cont, float sx, float sz, FileHandle effectFile, FileHandle imageSrc) { + super(name, texture, cont, sx, sz, effectFile, imageSrc); } @Override @@ -25,6 +27,8 @@ public class PowerUpBomb extends PowerUp { int px = (int) player.getPos().x; int pz = (int) player.getPos().z; + + System.out.println("Player in " + player.getPos()); int tmptodraw[][] = new int[main.currentGameManager.mazeGen.w][main.currentGameManager.mazeGen.h]; @@ -47,7 +51,7 @@ public class PowerUpBomb extends PowerUp { class PowerUpBigBomb extends PowerUpBomb{ public PowerUpBigBomb() { - super("BIG BOMB", TextureLoader.textureBomb, false, 1.5f, 1.5f); + super("BIG BOMB", TextureLoader.textureBomb, false, 1.5f, 1.5f, Gdx.files.internal("data/particles/explosion.particle"), Gdx.files.internal("data/particles")); radius = 2; } diff --git a/core/src/com/emamaker/amazeing/player/powerups/PowerUpFeather.java b/core/src/com/emamaker/amazeing/player/powerups/PowerUpFeather.java index 1b39a06..2a95c7f 100755 --- a/core/src/com/emamaker/amazeing/player/powerups/PowerUpFeather.java +++ b/core/src/com/emamaker/amazeing/player/powerups/PowerUpFeather.java @@ -1,5 +1,6 @@ package com.emamaker.amazeing.player.powerups; +import com.badlogic.gdx.Gdx; import com.emamaker.amazeing.player.MazePlayer; import com.emamaker.amazeing.utils.TextureLoader; @@ -7,16 +8,18 @@ public class PowerUpFeather extends PowerUpTemporized { public PowerUpFeather() { super("FEATHER", TextureLoader.textureFeather, true, 10, - 1f, 1f); + 1f, 1f, Gdx.files.internal("data/particles/feather.particle"), Gdx.files.internal("data/powerups")); } @Override public void temporizedEffect(MazePlayer player) { + super.temporizedEffect(player); player.speedMult = 2f; } @Override public void temporizedEffectExpired(MazePlayer player) { + super.temporizedEffectExpired(player); player.speedMult = 1f; } diff --git a/core/src/com/emamaker/amazeing/player/powerups/PowerUpSlug.java b/core/src/com/emamaker/amazeing/player/powerups/PowerUpSlug.java index 8daa911..fbd50a0 100755 --- a/core/src/com/emamaker/amazeing/player/powerups/PowerUpSlug.java +++ b/core/src/com/emamaker/amazeing/player/powerups/PowerUpSlug.java @@ -1,22 +1,25 @@ package com.emamaker.amazeing.player.powerups; +import com.badlogic.gdx.Gdx; import com.emamaker.amazeing.player.MazePlayer; import com.emamaker.amazeing.utils.TextureLoader; public class PowerUpSlug extends PowerUpTemporized { public PowerUpSlug() { - super("SLUG", TextureLoader.textureSlug, true, 20, - 1.3f, 1.3f); + super("SLUG", TextureLoader.textureSlug, true, 15, + 1.3f, 1.3f, Gdx.files.internal("data/particles/slugs.particle"), Gdx.files.internal("data/powerups")); } @Override public void temporizedEffect(MazePlayer player) { + super.temporizedEffect(player); player.speedMult = 0.25f; } @Override public void temporizedEffectExpired(MazePlayer player) { + super.temporizedEffectExpired(player); player.speedMult = 1f; } @@ -25,7 +28,7 @@ public class PowerUpSlug extends PowerUpTemporized { class PowerUpGiveSlug extends PowerUpGiver { public PowerUpGiveSlug() { - super(new PowerUpSlug(), "SLUG GIVER", TextureLoader.textureSlug, false, 1f, 1f); + super(new PowerUpSlug(), "SLUG GIVER", TextureLoader.textureSlug, false, 1f, 1f, null, null); } } diff --git a/core/src/com/emamaker/amazeing/ui/screens/PreGameScreen.java b/core/src/com/emamaker/amazeing/ui/screens/PreGameScreen.java index 5fe94c6..3e448f9 100755 --- a/core/src/com/emamaker/amazeing/ui/screens/PreGameScreen.java +++ b/core/src/com/emamaker/amazeing/ui/screens/PreGameScreen.java @@ -84,7 +84,7 @@ public class PreGameScreen extends MyScreen { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { hide(); if (uiManager.main.client.isRunning()) { - uiManager.main.client.stop(); + uiManager.main.client.stop(true); uiManager.main.setScreen(uiManager.srvJoinScreen); } if (uiManager.main.server.isRunning()) { diff --git a/core/src/com/emamaker/amazeing/ui/screens/ServerJoinScreen.java b/core/src/com/emamaker/amazeing/ui/screens/ServerJoinScreen.java index 8810f37..3b64b35 100755 --- a/core/src/com/emamaker/amazeing/ui/screens/ServerJoinScreen.java +++ b/core/src/com/emamaker/amazeing/ui/screens/ServerJoinScreen.java @@ -78,9 +78,9 @@ public class ServerJoinScreen extends MyScreen { /* ERROR DIALOG */ errorDlg = new Dialog("Error in communicating with server", uiManager.skin); errorDlgText = new Label("", uiManager.skin); - errorDlg.text(helpDlgText); + errorDlg.text(errorDlgText); errorDlgOkBtn = new TextButton("OK", uiManager.skin); - errorDlg.button(helpDlgOkBtn); + errorDlg.button(errorDlgOkBtn); errorDlg.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { @@ -160,6 +160,11 @@ public class ServerJoinScreen extends MyScreen { failDlgText.setFontScale(labScale*0.9f); failDlgOkBtn.getLabel().setFontScale(labScale*0.9f); + errorDlg.setSize(cw*0.7f, ch*0.2f); + errorDlg.setPosition((sw-failDlg.getWidth())/2, (sh-failDlg.getHeight())/2); + errorDlgText.setFontScale(labScale*0.9f); + errorDlgOkBtn.getLabel().setFontScale(labScale*0.9f); + instLab.setFontScale(labScale); srvIpL.setFontScale(labScale); backBtn.getLabel().setFontScale(labScale); diff --git a/core/src/com/emamaker/amazeing/utils/MathUtils.java b/core/src/com/emamaker/amazeing/utils/MathUtils.java index 1aee5b8..aebd40b 100644 --- a/core/src/com/emamaker/amazeing/utils/MathUtils.java +++ b/core/src/com/emamaker/amazeing/utils/MathUtils.java @@ -1,10 +1,35 @@ package com.emamaker.amazeing.utils; import com.badlogic.gdx.math.Vector3; +import com.emamaker.amazeing.AMazeIng; public class MathUtils extends net.dermetfan.gdx.math.MathUtils { public static float vectorDistance(Vector3 v1, Vector3 v2) { - return (float) Math.sqrt((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + (v1.z - v2.z)*(v1.z - v2.z)); + return (float) Math + .sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)); + } + + + public static Vector3 toScreenCoords(Vector3 vec) { + //This exta variable is needed otherwise the cam.project will convert the vector in argument from world coordinates to screen coordinates + Vector3 v1 = new Vector3(vec); + return AMazeIng.getMain().world.cam.project(v1); + } + + public static long map(long x, long in_min, long in_max, long out_min, long out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + public static int map(int x, int in_min, int in_max, int out_min, int out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + public static class Constants { + + public static int NETWORK_ACTION_TIMEOUT_MILLIS = 7000; + public static int COMMUNICATION_TIMEOUT_MILLIS = 100000; + public static int CLIENT_POS_PERIODIC_UPDATE = 1000; + } } diff --git a/desktop/assets/data/textures/texture_atlas.png b/desktop/assets/data/textures/texture_atlas.png new file mode 100755 index 0000000..0c22621 Binary files /dev/null and b/desktop/assets/data/textures/texture_atlas.png differ diff --git a/desktop/build.gradle b/desktop/build.gradle index 089359f..3cd1bd1 100755 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -2,10 +2,10 @@ apply plugin: "java" sourceCompatibility = 1.7 sourceSets.main.java.srcDirs = [ "src/" ] -sourceSets.main.resources.srcDirs = ["../android/assets"] +sourceSets.main.resources.srcDirs = ["../core/assets/"] project.ext.mainClassName = "com.emamaker.amazeing.desktop.DesktopLauncher" -project.ext.assetsDir = new File("../android/assets") +project.ext.assetsDir = new File("../core/assets") task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName