diff --git a/android/game.apk b/android/game.apk index 9482ce9..ccb8a13 100644 Binary files a/android/game.apk and b/android/game.apk differ diff --git a/android/game.love b/android/game.love index 7c171f2..04b2ebf 100644 Binary files a/android/game.love and b/android/game.love differ diff --git a/android/tools/love-android-sdl2/AndroidManifest.xml b/android/tools/love-android-sdl2/AndroidManifest.xml index 68a6909..0333880 100644 --- a/android/tools/love-android-sdl2/AndroidManifest.xml +++ b/android/tools/love-android-sdl2/AndroidManifest.xml @@ -1,5 +1,5 @@ - @@ -12,13 +12,13 @@ diff --git a/android/tools/love-android-sdl2/assets/game.love b/android/tools/love-android-sdl2/assets/game.love index 7c171f2..04b2ebf 100644 Binary files a/android/tools/love-android-sdl2/assets/game.love and b/android/tools/love-android-sdl2/assets/game.love differ diff --git a/android/tools/love-android-sdl2/bin/AndroidManifest.xml b/android/tools/love-android-sdl2/bin/AndroidManifest.xml index 68a6909..0333880 100644 --- a/android/tools/love-android-sdl2/bin/AndroidManifest.xml +++ b/android/tools/love-android-sdl2/bin/AndroidManifest.xml @@ -1,5 +1,5 @@ - @@ -12,13 +12,13 @@ diff --git a/android/tools/love-android-sdl2/bin/build.prop b/android/tools/love-android-sdl2/bin/build.prop index 9f0b514..f743270 100644 --- a/android/tools/love-android-sdl2/bin/build.prop +++ b/android/tools/love-android-sdl2/bin/build.prop @@ -1,5 +1,5 @@ #Last build type -#Tue, 03 Jan 2017 23:52:00 +0100 +#Thu, 05 Jan 2017 10:14:55 +0100 build.last.target=debug diff --git a/android/tools/love-android-sdl2/bin/classes.dex b/android/tools/love-android-sdl2/bin/classes.dex index 3457baa..33fb6da 100644 Binary files a/android/tools/love-android-sdl2/bin/classes.dex and b/android/tools/love-android-sdl2/bin/classes.dex differ diff --git a/android/tools/love-android-sdl2/bin/classes.dex.d b/android/tools/love-android-sdl2/bin/classes.dex.d index 218115b..19a16f3 100644 --- a/android/tools/love-android-sdl2/bin/classes.dex.d +++ b/android/tools/love-android-sdl2/bin/classes.dex.d @@ -1,9 +1,9 @@ /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes.dex : \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/BuildConfig.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/LtaActivity.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$attr.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$drawable.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/BuildConfig.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/LtaActivity.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$attr.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$drawable.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R.class \ /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/org/libsdl/app/DummyEdit.class \ /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$1.class \ /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.class \ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$attr.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$attr.class deleted file mode 100644 index 14f58cf..0000000 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$attr.class and /dev/null differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/BuildConfig.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/BuildConfig.class similarity index 74% rename from android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/BuildConfig.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/BuildConfig.class index b3e3996..9d6869d 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/BuildConfig.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/BuildConfig.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/LtaActivity.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/LtaActivity.class similarity index 62% rename from android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/LtaActivity.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/LtaActivity.class index 6699234..0e2e8ef 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/LtaActivity.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/LtaActivity.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$attr.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$attr.class new file mode 100644 index 0000000..a09ac52 Binary files /dev/null and b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$attr.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$drawable.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$drawable.class similarity index 56% rename from android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$drawable.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$drawable.class index 44129b5..7b6607d 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R$drawable.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R$drawable.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R.class b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R.class similarity index 63% rename from android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R.class index 806422e..a948187 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android0103235155/R.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android0105101448/R.class differ diff --git a/android/tools/love-android-sdl2/bin/love_android_sdl2-debug-unaligned.apk b/android/tools/love-android-sdl2/bin/love_android_sdl2-debug-unaligned.apk index c108310..c187e24 100644 Binary files a/android/tools/love-android-sdl2/bin/love_android_sdl2-debug-unaligned.apk and b/android/tools/love-android-sdl2/bin/love_android_sdl2-debug-unaligned.apk differ diff --git a/android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk b/android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk index 9482ce9..ccb8a13 100644 Binary files a/android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk and b/android/tools/love-android-sdl2/bin/love_android_sdl2-debug.apk differ diff --git a/android/tools/love-android-sdl2/bin/love_android_sdl2.ap_ b/android/tools/love-android-sdl2/bin/love_android_sdl2.ap_ index 147e29d..681fbb9 100644 Binary files a/android/tools/love-android-sdl2/bin/love_android_sdl2.ap_ and b/android/tools/love-android-sdl2/bin/love_android_sdl2.ap_ differ diff --git a/android/tools/love-android-sdl2/bin/proguard.txt b/android/tools/love-android-sdl2/bin/proguard.txt index f48d178..9f481dd 100644 --- a/android/tools/love-android-sdl2/bin/proguard.txt +++ b/android/tools/love-android-sdl2/bin/proguard.txt @@ -1,9 +1,9 @@ # view AndroidManifest.xml #generated:45 --keep class love.to.android0103235155.DownloadActivity { (...); } +-keep class love.to.android0105101448.DownloadActivity { (...); } # view AndroidManifest.xml #generated:17 --keep class love.to.android0103235155.DownloadService { (...); } +-keep class love.to.android0105101448.DownloadService { (...); } # view AndroidManifest.xml #generated:18 --keep class love.to.android0103235155.LtaActivity { (...); } +-keep class love.to.android0105101448.LtaActivity { (...); } diff --git a/android/tools/love-android-sdl2/gen/R.java.d b/android/tools/love-android-sdl2/gen/R.java.d index 735cf0d..0fea14b 100644 --- a/android/tools/love-android-sdl2/gen/R.java.d +++ b/android/tools/love-android-sdl2/gen/R.java.d @@ -1,3 +1,3 @@ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android0103235155/R.java \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android0105101448/R.java \ : /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/res/drawable-xxhdpi/ic_launcher.png \ /Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/AndroidManifest.xml \ diff --git a/android/tools/love-android-sdl2/gen/love/to/android0103235155/BuildConfig.java b/android/tools/love-android-sdl2/gen/love/to/android0105101448/BuildConfig.java similarity index 79% rename from android/tools/love-android-sdl2/gen/love/to/android0103235155/BuildConfig.java rename to android/tools/love-android-sdl2/gen/love/to/android0105101448/BuildConfig.java index ab8b43b..694fc3c 100644 --- a/android/tools/love-android-sdl2/gen/love/to/android0103235155/BuildConfig.java +++ b/android/tools/love-android-sdl2/gen/love/to/android0105101448/BuildConfig.java @@ -1,5 +1,5 @@ /** Automatically generated file. DO NOT MODIFY */ -package love.to.android0103235155; +package love.to.android0105101448; public final class BuildConfig { public final static boolean DEBUG = true; diff --git a/android/tools/love-android-sdl2/gen/love/to/android0103235155/R.java b/android/tools/love-android-sdl2/gen/love/to/android0105101448/R.java similarity index 91% rename from android/tools/love-android-sdl2/gen/love/to/android0103235155/R.java rename to android/tools/love-android-sdl2/gen/love/to/android0105101448/R.java index 9b7091e..9260355 100644 --- a/android/tools/love-android-sdl2/gen/love/to/android0103235155/R.java +++ b/android/tools/love-android-sdl2/gen/love/to/android0105101448/R.java @@ -5,7 +5,7 @@ * should not be modified by hand. */ -package love.to.android0103235155; +package love.to.android0105101448; public final class R { public static final class attr { diff --git a/android/tools/love-android-sdl2/src/love/to/android0103235155/LtaActivity.java b/android/tools/love-android-sdl2/src/love/to/android0105101448/LtaActivity.java similarity index 69% rename from android/tools/love-android-sdl2/src/love/to/android0103235155/LtaActivity.java rename to android/tools/love-android-sdl2/src/love/to/android0105101448/LtaActivity.java index 707deed..a3892df 100644 --- a/android/tools/love-android-sdl2/src/love/to/android0103235155/LtaActivity.java +++ b/android/tools/love-android-sdl2/src/love/to/android0105101448/LtaActivity.java @@ -1,4 +1,4 @@ -package love.to.android0103235155; +package love.to.android0105101448; import org.love2d.android.GameActivity; public class LtaActivity extends GameActivity {} diff --git a/assets/scripts/game.lua b/assets/scripts/game.lua index b26f09f..23b6fa7 100644 --- a/assets/scripts/game.lua +++ b/assets/scripts/game.lua @@ -3,6 +3,8 @@ local game = {} function game.load() -- Configuration math.randomseed(os.time()) + PADDING = 50 + game.lifes = 3 local width, height = love.window.getDesktopDimensions( display ) game.window = { width = width , height = height } game.canvas = { width = width, height = 2880 } diff --git a/assets/scripts/controls.lua b/assets/scripts/gui/controls.lua similarity index 91% rename from assets/scripts/controls.lua rename to assets/scripts/gui/controls.lua index 1d96798..2a4feb4 100644 --- a/assets/scripts/controls.lua +++ b/assets/scripts/gui/controls.lua @@ -3,21 +3,20 @@ local controls = {} local BUTTONS = {} function controls.load(game) - local padding = 50 -- Button left - local img_button_left = love.graphics.newImage('assets/sprites/hui/button_left.png') - local left_x = padding - local left_y = (game.window.height / 3 * 2) - img_button_left:getHeight() - padding + local img_button_left = love.graphics.newImage('assets/sprites/gui/button_left.png') + local left_x = PADDING + local left_y = (game.window.height / 3 * 2) - img_button_left:getHeight() - PADDING controls.new_button('button_left', left_x, left_y, img_button_left) -- Button right - local img_button_right = love.graphics.newImage('assets/sprites/hui/button_right.png') - local right_x = game.window.width - (img_button_right:getWidth() / 2) - padding - local right_y = (game.window.height / 3 * 2) - img_button_right:getHeight() - padding + local img_button_right = love.graphics.newImage('assets/sprites/gui/button_right.png') + local right_x = game.window.width - (img_button_right:getWidth() / 2) - PADDING + local right_y = (game.window.height / 3 * 2) - img_button_right:getHeight() - PADDING controls.new_button('button_right', right_x, right_y, img_button_right) -- Button up - local img_button_up = love.graphics.newImage('assets/sprites/hui/button_up.png') - local up_x = game.window.width - (img_button_up:getWidth() / 2) - padding - local up_y = (game.window.height / 3) - img_button_up:getHeight() - padding + local img_button_up = love.graphics.newImage('assets/sprites/gui/button_up.png') + local up_x = game.window.width - (img_button_up:getWidth() / 2) - PADDING + local up_y = (game.window.height / 3) - img_button_up:getHeight() - PADDING controls.new_button('button_up', up_x, up_y, img_button_up) end diff --git a/assets/scripts/gui/life.lua b/assets/scripts/gui/life.lua new file mode 100644 index 0000000..2501f3c --- /dev/null +++ b/assets/scripts/gui/life.lua @@ -0,0 +1,59 @@ +local anim8 = require 'assets/scripts/vendor/anim8' +local tools = require 'assets/scripts/tools' + +local life = {} + +function life.load(game) + local PADDING = 50 + -- Up + life.top = { + x = PADDING, + y = PADDING, + img = love.graphics.newImage('assets/sprites/gui/life_top.png'), + num_frames = 2 + } + g = anim8.newGrid(life.top.img:getWidth() / life.top.num_frames, life.top.img:getHeight(), life.top.img:getWidth(), life.top.img:getHeight()) + life.top.animation = anim8.newAnimation(g('1-' .. life.top.num_frames, 1), 1) + life.top.animation:gotoFrame(1) + life.top.animation:pause() + -- Down + life.down = { + img = love.graphics.newImage('assets/sprites/gui/life_down.png'), + x = PADDING, + y = life.top.y + life.top.img:getHeight() + } + -- Indicator + life.indicator = { + x_shaft = life.down.x + (life.down.img:getWidth() / 2), + y_shaft = life.down.y + (life.down.img:getHeight() / 2), + x_target = life.top.x + (life.top.img:getWidth() / 2 / life.top.num_frames), + y_target = life.top.y + (life.top.img:getHeight() / 2), + width = 10, + color = {0, 0, 0}, + angle = 230, + move_up = false + } + life.indicator.radius = tools.distance(life.indicator.x_shaft, life.indicator.y_shaft, life.indicator.x_target, life.indicator.y_target) + love.graphics.setLineWidth(life.indicator.width) +end + +function life.update(dt, game) + life.top.animation:update(dt) + -- 1 230 240 + if game.life == 3 then + end + life.indicator.x_target, life.indicator.y_target = tools.circle_position(life.indicator.angle, life.indicator.radius, life.indicator.x_shaft, life.indicator.y_shaft) +end + +function life.draw() + -- Background top + life.top.animation:draw(life.top.img, life.top.x, life.top.y) + -- Indicator + love.graphics.setColor(life.indicator.color) + love.graphics.line(life.indicator.x_shaft, life.indicator.y_shaft, life.indicator.x_target, life.indicator.y_target) + love.graphics.setColor(255, 255, 255) + -- Background down + love.graphics.draw(life.down.img, life.down.x, life.down.y) +end + +return life \ No newline at end of file diff --git a/assets/scripts/tools.lua b/assets/scripts/tools.lua index 4200407..780919b0 100644 --- a/assets/scripts/tools.lua +++ b/assets/scripts/tools.lua @@ -71,4 +71,15 @@ function tools.print_r(t) print() end +function tools.distance(x1, y1, x2, y2) + local dx = x1 - x2 + local dy = y1 - y2 + return math.sqrt ( dx * dx + dy * dy ) +end + +function tools.circle_position(angle, radius, x_center, y_center) + local angle_temp = angle * math.pi / 180 + return x_center + radius * math.cos(angle_temp), y_center + radius * math.sin(angle_temp) +end + return tools \ No newline at end of file diff --git a/assets/sprites/hui/button_left.png b/assets/sprites/gui/button_left.png similarity index 100% rename from assets/sprites/hui/button_left.png rename to assets/sprites/gui/button_left.png diff --git a/assets/sprites/hui/button_right.png b/assets/sprites/gui/button_right.png similarity index 100% rename from assets/sprites/hui/button_right.png rename to assets/sprites/gui/button_right.png diff --git a/assets/sprites/hui/button_up.png b/assets/sprites/gui/button_up.png similarity index 100% rename from assets/sprites/hui/button_up.png rename to assets/sprites/gui/button_up.png diff --git a/assets/sprites/hui/heart.png b/assets/sprites/gui/heart.png similarity index 100% rename from assets/sprites/hui/heart.png rename to assets/sprites/gui/heart.png diff --git a/assets/sprites/gui/life_down.png b/assets/sprites/gui/life_down.png new file mode 100644 index 0000000..e9b1a93 Binary files /dev/null and b/assets/sprites/gui/life_down.png differ diff --git a/assets/sprites/gui/life_top.png b/assets/sprites/gui/life_top.png new file mode 100644 index 0000000..f78189e Binary files /dev/null and b/assets/sprites/gui/life_top.png differ diff --git a/main.lua b/main.lua index d9e79aa..2ce6e9c 100644 --- a/main.lua +++ b/main.lua @@ -3,7 +3,8 @@ local background = require 'assets/scripts/background' local spaceship = require 'assets/scripts/spaceship' local asteroids = require 'assets/scripts/asteroids' local moon = require 'assets/scripts/moon' -local controls = require 'assets/scripts/controls' +local controls = require 'assets/scripts/gui/controls' +local life = require 'assets/scripts/gui/life' local camera = require 'assets/scripts/camera' -- LOAD @@ -15,6 +16,7 @@ function love.load() moon.load(game) spaceship.load(game) controls.load(game) + life.load(game) end -- UPDATE @@ -27,6 +29,7 @@ function love.update(dt) asteroids.update(dt, game) moon.update() spaceship.update(dt, game) + life.update(dt, game) camera.update(game, spaceship) end @@ -39,6 +42,7 @@ function love.draw() asteroids.draw() end) controls.draw() + life.draw() end -- CONTROLS