Fix asteroids
BIN
android/game.apk
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android1112203313"
|
||||
<manifest package="love.to.android1126182250"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.2"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
@ -12,13 +12,13 @@
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="Game 1112203313"
|
||||
android:label="Game 1126182250"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1112203313"
|
||||
android:label="Game 1126182250"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android1112203313"
|
||||
<manifest package="love.to.android1126182250"
|
||||
android:versionCode="15"
|
||||
android:versionName="0.9.2"
|
||||
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
@ -12,13 +12,13 @@
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="Game 1112203313"
|
||||
android:label="Game 1126182250"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1112203313"
|
||||
android:label="Game 1126182250"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Last build type
|
||||
#Sat, 12 Nov 2016 20:33:20 +0100
|
||||
#Sat, 26 Nov 2016 18:22:56 +0100
|
||||
|
||||
build.last.target=debug
|
||||
|
||||
|
@ -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/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/love/to/android1126182250/BuildConfig.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1126182250/LtaActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1126182250/R$attr.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1126182250/R$drawable.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1126182250/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 \
|
||||
|
@ -1,9 +1,9 @@
|
||||
# view AndroidManifest.xml #generated:45
|
||||
-keep class love.to.android1112203313.DownloadActivity { <init>(...); }
|
||||
-keep class love.to.android1126182250.DownloadActivity { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:17
|
||||
-keep class love.to.android1112203313.DownloadService { <init>(...); }
|
||||
-keep class love.to.android1126182250.DownloadService { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:18
|
||||
-keep class love.to.android1112203313.LtaActivity { <init>(...); }
|
||||
-keep class love.to.android1126182250.LtaActivity { <init>(...); }
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1112203313/R.java \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1126182250/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 \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package love.to.android1112203313;
|
||||
package love.to.android1126182250;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = true;
|
@ -5,7 +5,7 @@
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package love.to.android1112203313;
|
||||
package love.to.android1126182250;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
@ -1,4 +1,4 @@
|
||||
package love.to.android1112203313;
|
||||
package love.to.android1126182250;
|
||||
import org.love2d.android.GameActivity;
|
||||
|
||||
public class LtaActivity extends GameActivity {}
|
@ -1,50 +1,59 @@
|
||||
local tools = require 'assets/scripts/tools'
|
||||
|
||||
local asteroids = {}
|
||||
local imgs = nil
|
||||
|
||||
function asteroids.load(game)
|
||||
local imgs = {
|
||||
love.graphics.newImage('assets/sprites/asteroids/1.png'),
|
||||
love.graphics.newImage('assets/sprites/asteroids/2.png'),
|
||||
love.graphics.newImage('assets/sprites/asteroids/3.png')
|
||||
imgs = {
|
||||
love.graphics.newImage('assets/sprites/asteroids/asteroid01.png'),
|
||||
love.graphics.newImage('assets/sprites/asteroids/asteroid02.png'),
|
||||
love.graphics.newImage('assets/sprites/asteroids/asteroid03.png'),
|
||||
love.graphics.newImage('assets/sprites/asteroids/asteroid04.png')
|
||||
}
|
||||
local num = game.levelaa * 5
|
||||
local max_speed = 5
|
||||
asteroids.num = game.level * 5
|
||||
asteroids.max_speed = 5
|
||||
-- Generate asteroids
|
||||
asteroids.bodys = {}
|
||||
for i=1, num do
|
||||
local temp_img = imgs[math.random(1, tools.table_length(imgs))]
|
||||
asteroids.bodys[i] = {
|
||||
x = math.random(0, game.canvas.width - temp_img:getWidth()),
|
||||
y = math.random(game.window.height / 2, game.canvas.height - temp_img:getHeight()),
|
||||
speed = math.random(1, max_speed),
|
||||
img = temp_img,
|
||||
angle = math.random(0, 90)
|
||||
}
|
||||
for i = 1, asteroids.num do
|
||||
make_asteroid(i, game, true)
|
||||
end
|
||||
end
|
||||
|
||||
function asteroids.update(dt, game)
|
||||
-- Rotate asteroids
|
||||
for key, asteroid in pairs(asteroids.bodys) do
|
||||
value.angle = asteroid.angle + (dt * math.pi / 10)
|
||||
value.x = asteroid.x - asteroid.speed
|
||||
asteroid.angle = asteroid.angle + (dt * math.pi / 10)
|
||||
asteroid.x = asteroid.x - asteroid.speed
|
||||
end
|
||||
-- Destroy asteroids
|
||||
for key, asteroid in pairs(asteroids.bodys) do
|
||||
if value.x + asteroid.img:getWidth() < 0 then
|
||||
table.remove(asteroid, key)
|
||||
if asteroid.x + asteroid.img:getWidth() < 0 then
|
||||
table.remove(asteroids.bodys, key)
|
||||
end
|
||||
end
|
||||
-- Create asteroids
|
||||
if tools.table_length(asteroids.bodys) < asteroids.num then
|
||||
local temp_img = imgs[math.random(1, table_length(imgs))]
|
||||
asteroids.bodys[table_length(asteroids.bodys) + 1] = {
|
||||
make_asteroid(tools.table_length(asteroids.bodys) + 1, game, false)
|
||||
end
|
||||
end
|
||||
|
||||
function asteroids.draw()
|
||||
for key, asteroid in pairs(asteroids.bodys) do
|
||||
love.graphics.draw(asteroid.img, asteroid.x, asteroid.y, asteroid.angle, 1, 1, asteroid.img:getWidth() / 2, asteroid.img:getHeight() / 2)
|
||||
end
|
||||
end
|
||||
|
||||
function make_asteroid(pos, game, x_random)
|
||||
local temp_img = imgs[math.random(1, tools.table_length(imgs))]
|
||||
asteroids.bodys[pos] = {
|
||||
x = game.canvas.width + temp_img:getWidth(),
|
||||
y = math.random(game.window.height, game.canvas.height - temp_img:getHeight()),
|
||||
speed = math.random(1, max_speed),
|
||||
y = math.random(game.window.height / 2, game.canvas.height - temp_img:getHeight()),
|
||||
speed = math.random(1, asteroids.max_speed),
|
||||
img = temp_img,
|
||||
angle = math.random(0, 90)}
|
||||
angle = math.random(0, 90)
|
||||
}
|
||||
if x_random then
|
||||
asteroids.bodys[pos].x = math.random(0, game.canvas.width - temp_img:getWidth())
|
||||
end
|
||||
end
|
||||
|
||||
|
Before Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 559 B |
BIN
assets/sprites/asteroids/asteroid01.png
Executable file
After Width: | Height: | Size: 3.7 KiB |
BIN
assets/sprites/asteroids/asteroid02.png
Executable file
After Width: | Height: | Size: 4.4 KiB |
BIN
assets/sprites/asteroids/asteroid03.png
Executable file
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/sprites/asteroids/asteroid04.png
Executable file
After Width: | Height: | Size: 3.4 KiB |
5
main.lua
@ -16,15 +16,16 @@ end
|
||||
function love.update(dt)
|
||||
game.world:update(dt)
|
||||
background.update(dt)
|
||||
asteroids.load(dt, game)
|
||||
controls.update(dt)
|
||||
asteroids.update(dt, game)
|
||||
spaceship.update(dt)
|
||||
controls.update(dt)
|
||||
end
|
||||
|
||||
-- DRAW
|
||||
function love.draw()
|
||||
background.draw()
|
||||
spaceship.draw()
|
||||
asteroids.draw()
|
||||
end
|
||||
|
||||
-- CONTROLS
|
||||
|