diff --git a/android/game.apk b/android/game.apk index f7209a8..dd4b412 100644 Binary files a/android/game.apk and b/android/game.apk differ diff --git a/android/game.love b/android/game.love index cc26c9f..e1d353f 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 f57f51c..eebcf4e 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 cc26c9f..e1d353f 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 f57f51c..eebcf4e 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 8310547..8ff6b6e 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 -#Sat, 12 Nov 2016 13:43:10 +0100 +#Sat, 12 Nov 2016 20:33:20 +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 58a26e2..cadab10 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 4a3d598..0edf381 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/android1112134304/BuildConfig.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/LtaActivity.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$attr.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$drawable.class \ -/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/BuildConfig.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/LtaActivity.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$attr.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$drawable.class \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/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/android1112134304/R$attr.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$attr.class deleted file mode 100644 index 6dd350c..0000000 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$attr.class and /dev/null differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/BuildConfig.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/BuildConfig.class similarity index 74% rename from android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/BuildConfig.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/BuildConfig.class index dcc7880..57b60cd 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/BuildConfig.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/BuildConfig.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/LtaActivity.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/LtaActivity.class similarity index 62% rename from android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/LtaActivity.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/LtaActivity.class index f8ec491..91f552e 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/LtaActivity.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/LtaActivity.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$attr.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$attr.class new file mode 100644 index 0000000..8b3baff Binary files /dev/null and b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$attr.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$drawable.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$drawable.class similarity index 56% rename from android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$drawable.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$drawable.class index 22b315d..dd093e2 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$drawable.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$drawable.class differ diff --git a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R.class b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R.class similarity index 63% rename from android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R.class rename to android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R.class index 762b69b..69f6e77 100644 Binary files a/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R.class and b/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/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 6f257dd..1eee0a1 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 f7209a8..dd4b412 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 939bab0..4bfe0fe 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 94008fb..4881f14 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.android1112134304.DownloadActivity { (...); } +-keep class love.to.android1112203313.DownloadActivity { (...); } # view AndroidManifest.xml #generated:17 --keep class love.to.android1112134304.DownloadService { (...); } +-keep class love.to.android1112203313.DownloadService { (...); } # view AndroidManifest.xml #generated:18 --keep class love.to.android1112134304.LtaActivity { (...); } +-keep class love.to.android1112203313.LtaActivity { (...); } diff --git a/android/tools/love-android-sdl2/gen/R.java.d b/android/tools/love-android-sdl2/gen/R.java.d index 12130ab..7faac3c 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/android1112134304/R.java \ +/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1112203313/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/android1112134304/BuildConfig.java b/android/tools/love-android-sdl2/gen/love/to/android1112203313/BuildConfig.java similarity index 79% rename from android/tools/love-android-sdl2/gen/love/to/android1112134304/BuildConfig.java rename to android/tools/love-android-sdl2/gen/love/to/android1112203313/BuildConfig.java index c23cce2..5a6c677 100644 --- a/android/tools/love-android-sdl2/gen/love/to/android1112134304/BuildConfig.java +++ b/android/tools/love-android-sdl2/gen/love/to/android1112203313/BuildConfig.java @@ -1,5 +1,5 @@ /** Automatically generated file. DO NOT MODIFY */ -package love.to.android1112134304; +package love.to.android1112203313; public final class BuildConfig { public final static boolean DEBUG = true; diff --git a/android/tools/love-android-sdl2/gen/love/to/android1112134304/R.java b/android/tools/love-android-sdl2/gen/love/to/android1112203313/R.java similarity index 91% rename from android/tools/love-android-sdl2/gen/love/to/android1112134304/R.java rename to android/tools/love-android-sdl2/gen/love/to/android1112203313/R.java index c88c802..03a2917 100644 --- a/android/tools/love-android-sdl2/gen/love/to/android1112134304/R.java +++ b/android/tools/love-android-sdl2/gen/love/to/android1112203313/R.java @@ -5,7 +5,7 @@ * should not be modified by hand. */ -package love.to.android1112134304; +package love.to.android1112203313; public final class R { public static final class attr { diff --git a/android/tools/love-android-sdl2/src/love/to/android1112134304/LtaActivity.java b/android/tools/love-android-sdl2/src/love/to/android1112203313/LtaActivity.java similarity index 69% rename from android/tools/love-android-sdl2/src/love/to/android1112134304/LtaActivity.java rename to android/tools/love-android-sdl2/src/love/to/android1112203313/LtaActivity.java index 7ed0cf0..bb41fc8 100644 --- a/android/tools/love-android-sdl2/src/love/to/android1112134304/LtaActivity.java +++ b/android/tools/love-android-sdl2/src/love/to/android1112203313/LtaActivity.java @@ -1,4 +1,4 @@ -package love.to.android1112134304; +package love.to.android1112203313; import org.love2d.android.GameActivity; public class LtaActivity extends GameActivity {} diff --git a/assets/scripts/background.lua b/assets/scripts/background.lua new file mode 100644 index 0000000..1ca7111 --- /dev/null +++ b/assets/scripts/background.lua @@ -0,0 +1,39 @@ +local anim8 = require 'assets/scripts/vendor/anim8' +local tools = require 'assets/scripts/tools' + +local background = {} +local stars = {} + +function background.load() + num_stars = 100 + local star = {} + star.num_frames = 9 + star.ani_speed = 1 + star.width_frame = 16 + star.height_frame = 16 + star.img = love.graphics.newImage('assets/sprites/background/star.png') + local g = anim8.newGrid(star.width_frame, star.height_frame, star.img:getWidth(), star.img:getHeight()) + star.animation = anim8.newAnimation(g('1-' .. star.num_frames, 1), star.ani_speed) + for i = 1, num_stars do + local temp_star = tools.clone_table(star) + temp_star.animation = anim8.newAnimation(g('1-' .. star.num_frames, 1), math.random(star.ani_speed, star.ani_speed * 2)) + temp_star.animation:gotoFrame(math.random(1, star.num_frames)) + temp_star.x = math.random(-star.width_frame , canvas.width) + temp_star.y = math.random(-star.height_frame, canvas.height) + stars[i] = temp_star + end +end + +function background.update(dt) + for key, star in pairs(stars) do + star.animation:update(dt) + end +end + +function background.draw() + for key, star in pairs(stars) do + star.animation:draw(star.img, star.x, star.y) + end +end + +return background \ No newline at end of file diff --git a/assets/scripts/spaceship.lua b/assets/scripts/spaceship.lua index 640de71..1f20dd2 100644 --- a/assets/scripts/spaceship.lua +++ b/assets/scripts/spaceship.lua @@ -12,7 +12,7 @@ function spaceship.load(world) spaceship.shape = love.physics.newCircleShape(20) spaceship.fixture = love.physics.newFixture(spaceship.body, spaceship.shape, 1) spaceship.fixture:setRestitution(0.9) - local g = anim8.newGrid(98, 93, spaceship.img:getWidth(), spaceship.img:getHeight()) + local g = anim8.newGrid(110, 103, spaceship.img:getWidth(), spaceship.img:getHeight()) spaceship.animation = anim8.newAnimation(g('1-1', 1), 0.1) end diff --git a/assets/scripts/tools.lua b/assets/scripts/tools.lua new file mode 100644 index 0000000..7ced0c0 --- /dev/null +++ b/assets/scripts/tools.lua @@ -0,0 +1,39 @@ +local tools = {} + +-- Get Table length +function tools.table_length(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + +-- Pause system n seconds +local clock = os.clock +function tools.sleep(n) -- seconds + local t0 = clock() + while clock() - t0 <= n do end +end + +-- Collision detection function +function tools.check_circle_collision(circle1, circle2) + local distance = math.sqrt((circle1.x - circle2.x) ^ 2 + (circle1.y - circle2.y) ^ 2) + return distance <= circle1.radius + circle2.radius +end + +-- Deep copy table +function tools.clone_table(orig) + local orig_type = type(orig) + local copy + if orig_type == 'table' then + copy = {} + for orig_key, orig_value in next, orig, nil do + copy[tools.clone_table(orig_key)] = tools.clone_table(orig_value) + end + setmetatable(copy, tools.clone_table(getmetatable(orig))) + else -- number, string, boolean, etc + copy = orig + end + return copy +end + +return tools \ No newline at end of file diff --git a/assets/sprites/background/background.png b/assets/sprites/background/background.png deleted file mode 100644 index 53e6cec..0000000 Binary files a/assets/sprites/background/background.png and /dev/null differ diff --git a/assets/sprites/background/star.png b/assets/sprites/background/star.png new file mode 100644 index 0000000..2226b5e Binary files /dev/null and b/assets/sprites/background/star.png differ diff --git a/assets/sprites/spaceship/body.png b/assets/sprites/spaceship/body.png index ce7a230..551635f 100644 Binary files a/assets/sprites/spaceship/body.png and b/assets/sprites/spaceship/body.png differ diff --git a/main.lua b/main.lua index 2782575..204e402 100644 --- a/main.lua +++ b/main.lua @@ -1,3 +1,4 @@ +local background = require 'assets/scripts/background' local spaceship = require 'assets/scripts/spaceship' local controls = require 'assets/scripts/controls' @@ -7,12 +8,15 @@ function love.load() math.randomseed(os.time()) local width, height = love.window.getDesktopDimensions( display ) window = { width = width , height = height } + canvas = { width = width, height = 2880 } love.window.setMode(window.width, window.height) -- Physics world_meter = 64 gravity = 2 love.physics.setMeter(world_meter) -- Height earth in meters world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth + -- Background + background.load() -- Spaceship spaceship.load(world) end @@ -20,12 +24,14 @@ end -- UPDATE function love.update(dt) world:update(dt) + background.update(dt) controls.update(dt) spaceship.update(dt) end -- DRAW function love.draw() + background.draw() spaceship.draw() end