diff --git a/android/build.gradle b/android/build.gradle index b405625..4837f3f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,12 @@ android { + signingConfigs { + debug { + storeFile file('D:\\other\\IntelliJ IDEA Community Edition 2022.3.2\\jbr\\release') + storePassword '2055146' + keyAlias 'key0' + keyPassword '51235123' + } + } buildToolsVersion "33.0.2" compileSdkVersion 33 sourceSets { diff --git a/android/src/com/vovangames/bricks/AndroidLauncher.java b/android/src/com/vovangames/bricks/AndroidLauncher.java index 3f96148..74b9fa6 100644 --- a/android/src/com/vovangames/bricks/AndroidLauncher.java +++ b/android/src/com/vovangames/bricks/AndroidLauncher.java @@ -4,13 +4,16 @@ import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; -import com.vovangames.bricks.Bricks; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); - initialize(new Bricks(), config); + config.useCompass = false; + config.useGyroscope = false; + config.maxSimultaneousSounds = 4; + config.useAccelerometer = true; + initialize(new Main(), config); } } diff --git a/assets/background.png b/assets/background.png new file mode 100644 index 0000000..8aa1e46 Binary files /dev/null and b/assets/background.png differ diff --git a/assets/badlogic.jpg b/assets/badlogic.jpg deleted file mode 100644 index 4390da6..0000000 Binary files a/assets/badlogic.jpg and /dev/null differ diff --git a/assets/brick.png b/assets/brick.png new file mode 100644 index 0000000..9f76161 Binary files /dev/null and b/assets/brick.png differ diff --git a/assets/button.png b/assets/button.png new file mode 100644 index 0000000..8b3e4f2 Binary files /dev/null and b/assets/button.png differ diff --git a/assets/explosion.wav b/assets/explosion.wav new file mode 100644 index 0000000..e6a9230 Binary files /dev/null and b/assets/explosion.wav differ diff --git a/assets/game_font.ttf b/assets/game_font.ttf new file mode 100644 index 0000000..00b1aad Binary files /dev/null and b/assets/game_font.ttf differ diff --git a/assets/hit.wav b/assets/hit.wav new file mode 100644 index 0000000..1ba55ce Binary files /dev/null and b/assets/hit.wav differ diff --git a/assets/locales/locale_en_US.properties b/assets/locales/locale_en_US.properties new file mode 100644 index 0000000..f958bd5 --- /dev/null +++ b/assets/locales/locale_en_US.properties @@ -0,0 +1,6 @@ +menu.start=start +menu.options=options +game.score=score +game.menu=menu +game.retry=retry +game.pause=pause diff --git a/assets/locales/locale_ru_RU.properties b/assets/locales/locale_ru_RU.properties new file mode 100644 index 0000000..4d395bb --- /dev/null +++ b/assets/locales/locale_ru_RU.properties @@ -0,0 +1,8 @@ +menu.start=начать +menu.options=настройки +menu.best=лучший результат +options.reset=сбросить счет +game.score=счет +game.menu=в меню +game.retry=еще раз +game.pause=пауза \ No newline at end of file diff --git a/assets/particles/blank_texture.png b/assets/particles/blank_texture.png new file mode 100644 index 0000000..9f34bbd Binary files /dev/null and b/assets/particles/blank_texture.png differ diff --git a/assets/particles/explosion b/assets/particles/explosion new file mode 100644 index 0000000..d174d05 --- /dev/null +++ b/assets/particles/explosion @@ -0,0 +1,341 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 300.0 +lowMax: 300.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1600.0 +highMax: 1600.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Life - +lowMin: 10.0 +lowMax: 10.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.5890411 +independent: false +- Life Offset - +active: true +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: true +- 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: 32.0 +highMax: 32.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: 100.0 +highMin: 0.0 +highMax: 1200.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Angle - +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 +- Rotation - +active: true +lowMin: 1.0 +lowMax: 360.0 +highMin: 180.0 +highMax: 180.0 +relative: true +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 12 +colors0: 1.0 +colors1: 0.89411765 +colors2: 0.047058824 +colors3: 1.0 +colors4: 0.89411765 +colors5: 0.047058824 +colors6: 1.0 +colors7: 0.0 +colors8: 0.0 +colors9: 0.3019608 +colors10: 0.3019608 +colors11: 0.3019608 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.22891566 +timeline2: 0.4698795 +timeline3: 1.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: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +blank_texture.png + + +Untitled +- Delay - +active: false +- Duration - +lowMin: 300.0 +lowMax: 300.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 500.0 +highMax: 500.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.20547946 +- Life - +lowMin: 10.0 +lowMax: 10.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 0.5890411 +independent: false +- Life Offset - +active: true +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: true +- 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: 4.0 +highMax: 4.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: 100.0 +highMin: 600.0 +highMax: 1200.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Angle - +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 +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 90.0 +highMax: 90.0 +relative: true +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 15 +colors0: 1.0 +colors1: 1.0 +colors2: 1.0 +colors3: 1.0 +colors4: 1.0 +colors5: 1.0 +colors6: 1.0 +colors7: 0.9137255 +colors8: 0.0 +colors9: 1.0 +colors10: 0.0 +colors11: 0.0 +colors12: 1.0 +colors13: 0.0 +colors14: 0.0 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.3773913 +timeline2: 0.61391306 +timeline3: 0.8869565 +timeline4: 1.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.67808217 +timeline2: 1.0 +- Options - +attached: false +continuous: false +aligned: true +additive: false +behind: true +premultipliedAlpha: false +spriteMode: single +- Image Paths - +shard.png + diff --git a/assets/particles/shard.png b/assets/particles/shard.png new file mode 100644 index 0000000..69b1d57 Binary files /dev/null and b/assets/particles/shard.png differ diff --git a/assets/particles/space b/assets/particles/space new file mode 100644 index 0000000..727d371 --- /dev/null +++ b/assets/particles/space @@ -0,0 +1,395 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 500 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 100.0 +highMax: 100.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 10000.0 +highMax: 10000.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: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.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: 0.0 +highMax: 5.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: false +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.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: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: animated +- Image Paths - +/C:/Users/jack/Desktop/game/assets/blank_texture.png + + +Untitled +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 100 +- Emission - +lowMin: 0.0 +lowMax: 0.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: 10000.0 +highMax: 10000.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: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.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: 0.0 +highMax: 5.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: false +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.3647059 +colors1: 0.5803922 +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: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: animated +- Image Paths - +/C:/Users/jack/Desktop/game/assets/blank_texture.png + + +Untitled +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 100 +- Emission - +lowMin: 0.0 +lowMax: 0.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: 10000.0 +highMax: 10000.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: square +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1000.0 +highMax: 1000.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- X Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 3.0 +highMax: 3.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: 0.0 +highMax: 5.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: false +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 90.0 +highMax: 90.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 0.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 1.0 +colors1: 0.2627451 +colors2: 0.2627451 +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: true +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: animated +- Image Paths - +/C:/Users/jack/Desktop/game/assets/blank_texture.png + diff --git a/assets/particles/trail b/assets/particles/trail new file mode 100644 index 0000000..b4cf2cf --- /dev/null +++ b/assets/particles/trail @@ -0,0 +1,259 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 80.0 +highMax: 80.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: 10.0 +highMax: 10.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: 0.0 +highMax: 50.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +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 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.73333335 +colors1: 1.0 +colors2: 0.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: true +aligned: true +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +blank_texture.png + + +Untitled +- Delay - +active: false +- Duration - +lowMin: 1000.0 +lowMax: 1000.0 +- Count - +min: 0 +max: 200 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 20.0 +highMax: 20.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: 8.0 +highMax: 8.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: 50.0 +highMax: 50.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +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 +- 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: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Options - +attached: false +continuous: true +aligned: false +additive: false +behind: false +premultipliedAlpha: false +spriteMode: single +- Image Paths - +blank_texture.png + diff --git a/core/src/com/vovangames/bricks/Bricks.java b/core/src/com/vovangames/bricks/Bricks.java index 5ca5dc2..634539c 100644 --- a/core/src/com/vovangames/bricks/Bricks.java +++ b/core/src/com/vovangames/bricks/Bricks.java @@ -1,31 +1,258 @@ package com.vovangames.bricks; -import com.badlogic.gdx.ApplicationAdapter; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.NinePatch; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.graphics.g2d.ParticleEmitter; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.math.*; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ScreenUtils; +import com.badlogic.gdx.utils.Timer; + +import java.util.Locale; + +import static com.vovangames.bricks.Main.*; + +public class Bricks extends ScreenAdapter { -public class Bricks extends ApplicationAdapter { SpriteBatch batch; - Texture img; - + OrthographicCamera camera; + Array bricks = new Array<>(); + + + final Vector2 brickDimensions = new Vector2(50, 20); + float ballSpeed = 400f; + final Vector2 ballDirection = new Vector2(Vector2.Y).scl(ballSpeed); + + int rows = 20; + int columns = 16; + int yOffset = 180; + float brickGap = 5f; + + int platformY = 120; + int platformWidth = 400; + float platformSpeed; + + int score = 0; + float countDown = 3; + boolean inGame = false, pause = false; + + Circle ball; + Rectangle platform; + + Stage stage; + Table endDialog; + ImageTextButton retryButton; + ImageTextButton menuButton; + Label pauseLabel, scoreLabel; + @Override - public void create () { + public void show() { + + Gdx.input.setCatchKey(Input.Keys.BACK, true); + batch = new SpriteBatch(); - img = new Texture("badlogic.jpg"); + camera = new OrthographicCamera(); + + addBricks(rows, columns); + + ball = new Circle(Gdx.graphics.getWidth() / 2f, platformY * 2, 20); + platform = new Rectangle(Gdx.graphics.getWidth() / 2f - platformWidth / 2f, platformY, platformWidth, 10); + + ballDirection.setToRandomDirection().nor().scl(ballSpeed); + + setupGUI(); + + new Timer().scheduleTask(new Timer.Task() { + @Override + public void run() { + countDown -= 0.1f; + if (countDown <= 0) inGame = true; + } + }, 0.1f, 0.1f, 30); + } + + private void setupGUI() { + stage = new Stage(); + + endDialog = new Table(); + endDialog.setSize(Gdx.graphics.getWidth() * 0.8f, Gdx.graphics.getHeight() * 0.8f); + endDialog.setBackground(new TextureRegionDrawable(new Texture("background.png"))); + + ImageTextButton.ImageTextButtonStyle s = new ImageTextButton.ImageTextButtonStyle(); + s.font = font; + s.up = s.down = buttonDrawable; + s.fontColor = Color.BLACK; + s.overFontColor = Color.CHARTREUSE; + + pauseLabel = new Label(locales.get("game.pause"), new Label.LabelStyle(font, Color.WHITE)); + + scoreLabel = new Label("", new Label.LabelStyle(font, Color.WHITE)); + scoreLabel.setAlignment(Align.center); + endDialog.add(scoreLabel).center().size(500, 80).align(Align.center).padBottom(120).row(); + + retryButton = new ImageTextButton(locales.get("game.retry"), s); + retryButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + instance.setScreen(new Bricks()); + } + }); + endDialog.add(retryButton).center().size(400, 240).fill().padBottom(60).row(); + + menuButton = new ImageTextButton(locales.get("game.menu"), s); + menuButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + instance.setScreen(new Menu()); + } + }); + endDialog.add(menuButton).center().size(300, 200).fill().row(); + endDialog.setPosition(Gdx.graphics.getWidth() / 2f, Gdx.graphics.getHeight() / 2f, Align.center); + Gdx.input.setInputProcessor(stage); + } + + + private void addBricks(int rows, int columns) { + float startX = Gdx.graphics.getWidth() / 2f - rows / 2f * brickDimensions.x; + float startY = Gdx.graphics.getHeight() / 2f + columns / 2f * brickDimensions.y + yOffset; + for (int i = 0; i < rows; i++) { + for (int j = 0; j < columns; j++) { + float x = startX + i * brickDimensions.x; + float y = startY - j * brickDimensions.y; + bricks.add(new Rectangle().set(x + brickGap * i, y - brickGap * j, brickDimensions.x, brickDimensions.y)); + } + } } @Override - public void render () { - ScreenUtils.clear(1, 0, 0, 1); + public void resize(int width, int height) { + stage.getViewport().update(width, height); + stage.getCamera().viewportWidth = width; + stage.getCamera().viewportHeight = height; + + platformSpeed = width * 2f / platformWidth; + + endDialog.setSize(width * 0.8f, height * 0.8f); + } + + @Override + public void render(float delta) { + ScreenUtils.clear(0, 0, 0, 1); + + if (Gdx.input.isKeyJustPressed(Input.Keys.BACK) || Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE) && inGame) + if (pause) { + stage.clear(); + pause = false; + } else { + stage.addActor(pauseLabel); + pause = true; + } + + if (inGame && !pause) { + handleInput(); + checkCollisions(); + } + batch.begin(); - batch.draw(img, 0, 0); + space.draw(batch, delta); + for (Rectangle r : bricks) { + batch.draw(brickTexture, r.x, r.y, r.width, r.height); + + } + trail.draw(batch, delta); + burst.draw(batch, delta); + brickDrawable.draw(batch, platform.x, platform.y, platform.width, platform.height); + batch.draw(brickTexture, ball.x - ball.radius / 2f, ball.y - ball.radius / 2f, ball.radius, ball.radius); + font.draw(batch, countDown > 0 ? String.format(Locale.ENGLISH, "%.1f", countDown): locales.get("game.score") + ": " + score, Gdx.graphics.getWidth() / 2f, Gdx.graphics.getHeight() - 80); batch.end(); + + stage.draw(); + + } + + @Override + public void pause() { + pause = true; + } + + private void handleInput() { + if (Gdx.input.isKeyJustPressed(Input.Keys.F11)) if (Gdx.graphics.isFullscreen()) Gdx.graphics.setWindowedMode(1280, 720); + else Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + + if (Gdx.input.isKeyPressed(Input.Keys.A) || Gdx.input.isKeyPressed(Input.Keys.LEFT) || (Gdx.input.isTouched() && Gdx.input.getX() < Gdx.graphics.getWidth() / 2f)) platform.x -= platformSpeed; + if (Gdx.input.isKeyPressed(Input.Keys.D) || Gdx.input.isKeyPressed(Input.Keys.RIGHT) || (Gdx.input.isTouched() && Gdx.input.getX() > Gdx.graphics.getWidth() / 2f)) platform.x += platformSpeed; + platform.x = MathUtils.clamp(platform.x, 0, Gdx.graphics.getWidth() - platformWidth); } - + + private void checkCollisions() { + if (ball.x < ball.radius || ball.x > Gdx.graphics.getWidth() - ball.radius) { + ballDirection.x = -ballDirection.x; + ball.x = MathUtils.clamp(ball.x, ball.radius, Gdx.graphics.getWidth() - ball.radius); + } + if (ball.y - 1 > Gdx.graphics.getHeight() - ball.radius) { + ballDirection.y = -ballDirection.y; + ball.y = MathUtils.clamp(ball.y, ball.radius, Gdx.graphics.getHeight() - ball.radius); + } + if (Intersector.overlaps(ball, platform)) { + ball.y = platformY + platform.height + ball.radius; + ballDirection.y = -ballDirection.y; + } + if (ball.y < platformY) { + explosion.play(); + ballDirection.setZero(); + trail.setDuration(0); + burst.start(); + inGame = false; + stage.addActor(endDialog); + if (score > highScore) saveFile.writeString(String.valueOf(score), false); + scoreLabel.setText("[GREEN]" + locales.get("game.score") + ": []" + score); + return; + } + + for (Rectangle r : bricks) { + if (!Intersector.overlaps(ball, r)) continue; + hit.play(); + bricks.removeValue(r, true); + ballDirection.nor().scl(ballSpeed += 2.5f); + score++; + if (ball.x <= r.x + r.width && ball.x >= r.x) { + ballDirection.y = -ballDirection.y; + continue; + } + if (ball.y <= r.y + r.height && ball.y >= r.y) { + ballDirection.x = -ballDirection.x; + } + } + + if (bricks.isEmpty()) { + inGame = false; + return; + } + + ball.x += ballDirection.x * Gdx.graphics.getDeltaTime(); + ball.y += ballDirection.y * Gdx.graphics.getDeltaTime(); + trail.setPosition(ball.x, ball.y); + burst.setPosition(ball.x, ball.y); + } + @Override - public void dispose () { + public void dispose() { batch.dispose(); - img.dispose(); } } diff --git a/core/src/com/vovangames/bricks/Main.java b/core/src/com/vovangames/bricks/Main.java new file mode 100644 index 0000000..5bb1991 --- /dev/null +++ b/core/src/com/vovangames/bricks/Main.java @@ -0,0 +1,112 @@ +package com.vovangames.bricks; + +import com.badlogic.gdx.Game; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.audio.Sound; +import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.graphics.g2d.NinePatch; +import com.badlogic.gdx.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.graphics.g2d.ParticleEmitter; +import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; +import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable; +import com.badlogic.gdx.utils.I18NBundle; +import com.badlogic.gdx.utils.ObjectMap; +import com.badlogic.gdx.utils.PropertiesUtils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.Reader; + +public class Main extends Game { + + static Texture brickTexture, buttonTexture; + static NinePatchDrawable brickDrawable, buttonDrawable; + static BitmapFont font; + static ParticleEffect space, bounce, burst, trail; + + static Sound hit; + static Sound explosion; + + static Main instance; + + static I18NBundle locales; + static FileHandle saveFile; + static int highScore = 0; + + @Override + public void create() { + instance = this; + + saveFile = Gdx.files.local("save"); + if (saveFile.exists()) highScore = Integer.parseInt(saveFile.readString()); + + locales = I18NBundle.createBundle(Gdx.files.internal("locales/locale")); + + font = generateFont(Gdx.files.internal("game_font.ttf")); + brickTexture = new Texture("brick.png"); + buttonTexture = new Texture("button.png"); + brickDrawable = new NinePatchDrawable(new NinePatch(brickTexture, 2, 2, 2, 2)); + + hit = Gdx.audio.newSound(Gdx.files.internal("hit.wav")); + explosion = Gdx.audio.newSound(Gdx.files.internal("explosion.wav")); + + NinePatch patch = new NinePatch(buttonTexture, 14, 14, 14, 14); + patch.setLeftWidth(50); + patch.setTopHeight(50); + patch.setRightWidth(50); + patch.setBottomHeight(50); + buttonDrawable = new NinePatchDrawable(patch); + + space = new ParticleEffect(); + space.setPosition(0, 0); + space.load(Gdx.files.internal("particles/space"), Gdx.files.internal("particles/")); + space.start(); + + trail = new ParticleEffect(); + trail.load(Gdx.files.internal("particles/trail"), Gdx.files.internal("particles/")); + trail.start(); + + burst = new ParticleEffect(); + burst.load(Gdx.files.internal("particles/explosion"), Gdx.files.internal("particles/")); + + setScreen(new Menu()); + } + + public static BitmapFont generateFont(FileHandle fontPath) { + FreeTypeFontGenerator gen = new FreeTypeFontGenerator(fontPath); + FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); + parameter.color = Color.WHITE; + parameter.size = 20; + parameter.characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZабвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧЪЫЬЭЮЯ0123456789.!'()>?:[]{}`~@#$%^*_+-=\\|/<>,\0 "; + + FreeTypeFontGenerator.FreeTypeBitmapFontData data = new FreeTypeFontGenerator.FreeTypeBitmapFontData(); + data.markupEnabled = true; + + BitmapFont f = gen.generateFont(parameter, data); + + data.dispose(); + gen.dispose(); + + return f; + } + + @Override + public void resize(int width, int height) { + for(ParticleEmitter e : space.getEmitters()) { + e.getSpawnWidth().setHigh(width); + e.getSpawnHeight().setHigh(height); + e.setPosition(width / 2f, height / 2f); + } + } + + @Override + public void dispose() { + font.dispose(); + buttonTexture.dispose(); + brickTexture.dispose(); + space.dispose(); + } +} diff --git a/core/src/com/vovangames/bricks/Menu.java b/core/src/com/vovangames/bricks/Menu.java new file mode 100644 index 0000000..8302b93 --- /dev/null +++ b/core/src/com/vovangames/bricks/Menu.java @@ -0,0 +1,91 @@ +package com.vovangames.bricks; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.ParticleEffectActor; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.ScreenUtils; + +import static com.vovangames.bricks.Main.*; + +public class Menu extends ScreenAdapter { + + + Stage stage; + ImageTextButton startButton; + ImageTextButton optionsButton; + Label bestScore; + + @Override + public void show() { + stage = new Stage(); + + if (saveFile.exists()) highScore = Integer.parseInt(saveFile.readString()); + + ImageTextButton.ImageTextButtonStyle s = new ImageTextButton.ImageTextButtonStyle(); + s.font = font; + s.up = s.down = buttonDrawable; + s.fontColor = Color.BLACK; + s.overFontColor = Color.CHARTREUSE; + startButton = new ImageTextButton(locales.get("menu.start"), s); + startButton.setSize(600, 400); + startButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + instance.setScreen(new Bricks()); + } + }); + + optionsButton = new ImageTextButton(locales.get("menu.options"), s); + optionsButton.setSize(220, 180); + optionsButton.setPosition(80, 80); + optionsButton.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + instance.setScreen(new Options()); + } + }); + + bestScore = new Label(locales.get("menu.best") + ": " + highScore, new Label.LabelStyle(font, Color.WHITE)); + bestScore.setAlignment(Align.center); + + stage.addActor(bestScore); + stage.addActor(optionsButton); + stage.addActor(startButton); + Gdx.input.setInputProcessor(stage); + } + + @Override + public void render(float delta) { + ScreenUtils.clear(0, 0, 0, 1); + stage.getBatch().begin(); + space.draw(stage.getBatch(), delta); + stage.getBatch().end(); + stage.draw(); + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height); + stage.getCamera().viewportWidth = width; + stage.getCamera().viewportHeight = height; + startButton.setPosition(width / 2f, height /2f, Align.center); + bestScore.setPosition(startButton.getX(Align.center), startButton.getY(Align.top) + 80, Align.center); + } + + @Override + public void hide() { + + } + + @Override + public void dispose() { + + } +} diff --git a/core/src/com/vovangames/bricks/Options.java b/core/src/com/vovangames/bricks/Options.java new file mode 100644 index 0000000..db85ff4 --- /dev/null +++ b/core/src/com/vovangames/bricks/Options.java @@ -0,0 +1,74 @@ +package com.vovangames.bricks; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.ScreenUtils; + +import static com.vovangames.bricks.Main.*; + +public class Options extends ScreenAdapter { + + ImageTextButton eraseData; + ImageTextButton back; + Stage stage; + + @Override + public void show() { + stage = new Stage(); + + ImageTextButton.ImageTextButtonStyle s = new ImageTextButton.ImageTextButtonStyle(); + s.font = font; + s.up = s.down = buttonDrawable; + s.fontColor = Color.BLACK; + s.overFontColor = Color.RED; + eraseData = new ImageTextButton(locales.get("options.reset"), s); + eraseData.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (saveFile.exists()) saveFile.delete(); + } + }); + eraseData.setSize(600, 400); + back = new ImageTextButton(locales.get("game.menu"), s); + back.setSize(220, 180); + back.setPosition(80, 80); + back.addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + instance.setScreen(new Menu()); + } + }); + + stage.addActor(eraseData); + stage.addActor(back); + Gdx.input.setInputProcessor(stage); + } + + @Override + public void render(float delta) { + ScreenUtils.clear(0, 0, 0, 1); + stage.getBatch().begin(); + space.draw(stage.getBatch(), delta); + stage.getBatch().end(); + stage.draw(); + } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height); + stage.getCamera().viewportWidth = width; + stage.getCamera().viewportHeight = height; + eraseData.setPosition(width / 2f, height /2f, Align.center); + } + + @Override + public void dispose() { + + } +} diff --git a/desktop/src/com/vovangames/bricks/DesktopLauncher.java b/desktop/src/com/vovangames/bricks/DesktopLauncher.java index 9d01ef4..d219246 100644 --- a/desktop/src/com/vovangames/bricks/DesktopLauncher.java +++ b/desktop/src/com/vovangames/bricks/DesktopLauncher.java @@ -2,14 +2,13 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; -import com.vovangames.bricks.Bricks; -// Please note that on macOS your application needs to be started with the -XstartOnFirstThread JVM argument public class DesktopLauncher { public static void main (String[] arg) { Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setForegroundFPS(60); - config.setTitle("Bricks"); - new Lwjgl3Application(new Bricks(), config); + config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode()); + config.setTitle("Space Bricks"); + new Lwjgl3Application(new Main(), config); } } diff --git a/settings.gradle b/settings.gradle index b8df9f7..8732fc8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'desktop', 'core', 'android' \ No newline at end of file +include 'desktop', 'core', 'android'