This commit is contained in:
Andros Fenollosa 2016-11-04 18:12:38 +01:00
parent 20b7769ca0
commit 73cec1f153
23 changed files with 81 additions and 73 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="love.to.android1104173735"
<manifest package="love.to.android1104181206"
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 1104173735"
android:label="Game 1104181206"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" />
<activity
android:name="LtaActivity"
android:configChanges="orientation|screenSize"
android:label="Game 1104173735"
android:label="Game 1104181206"
android:launchMode="singleTop"
android:screenOrientation="landscape" >
<intent-filter>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="love.to.android1104173735"
<manifest package="love.to.android1104181206"
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 1104173735"
android:label="Game 1104181206"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" />
<activity
android:name="LtaActivity"
android:configChanges="orientation|screenSize"
android:label="Game 1104173735"
android:label="Game 1104181206"
android:launchMode="singleTop"
android:screenOrientation="landscape" >
<intent-filter>

View File

@ -1,5 +1,5 @@
#Last build type
#Fri, 04 Nov 2016 17:37:41 +0100
#Fri, 04 Nov 2016 18:12:11 +0100
build.last.target=debug

View File

@ -1,9 +1,9 @@
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes.dex : \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104173735/BuildConfig.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104173735/LtaActivity.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104173735/R$attr.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104173735/R$drawable.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104173735/R.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/BuildConfig.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/LtaActivity.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R$attr.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R$drawable.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1104181206/R.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/DummyEdit.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$1.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.class \

View File

@ -1,9 +1,9 @@
# view AndroidManifest.xml #generated:45
-keep class love.to.android1104173735.DownloadActivity { <init>(...); }
-keep class love.to.android1104181206.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:17
-keep class love.to.android1104173735.DownloadService { <init>(...); }
-keep class love.to.android1104181206.DownloadService { <init>(...); }
# view AndroidManifest.xml #generated:18
-keep class love.to.android1104173735.LtaActivity { <init>(...); }
-keep class love.to.android1104181206.LtaActivity { <init>(...); }

View File

@ -1,3 +1,3 @@
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/gen/love/to/android1104173735/R.java \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/gen/love/to/android1104181206/R.java \
: /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/res/drawable-xxhdpi/ic_launcher.png \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/AndroidManifest.xml \

View File

@ -1,5 +1,5 @@
/** Automatically generated file. DO NOT MODIFY */
package love.to.android1104173735;
package love.to.android1104181206;
public final class BuildConfig {
public final static boolean DEBUG = true;

View File

@ -5,7 +5,7 @@
* should not be modified by hand.
*/
package love.to.android1104173735;
package love.to.android1104181206;
public final class R {
public static final class attr {

View File

@ -1,4 +1,4 @@
package love.to.android1104173735;
package love.to.android1104181206;
import org.love2d.android.GameActivity;
public class LtaActivity extends GameActivity {}

116
main.lua
View File

@ -33,6 +33,8 @@ function love.load()
ship.shape = love.physics.newCircleShape(20)
ship.fixture = love.physics.newFixture(ship.body, ship.shape, 1)
ship.fixture:setRestitution(0.9)
ship.time_start = 1
start_time = 0
-- Fire
fire = {}
fire.img = love.graphics.newImage('assets/sprite/fire.png')
@ -116,6 +118,7 @@ end
-- UPDATE
function love.update(dt)
start_time = dt + start_time
-- Sprite
if not explosion.finish and explosion.active then -- Explosion
explosion.time = explosion.time + dt
@ -144,31 +147,33 @@ function love.update(dt)
fire.pos_frame = 1
end
-- Controls
control_up, control_right, control_left, control_quit = false, false, false, false
-- Keyboard
if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then
control_quit = true
end
if love.keyboard.isDown('right') then
control_right = true
elseif love.keyboard.isDown('left') then
control_left = true
end
if love.keyboard.isDown('up') then
control_up = true
end
-- Mouse
if love.mouse.isDown(1) then
local x, y = love.mouse.getPosition()
-- Up
if x > button_up.x and x < button_up.x + button.img:getWidth() and y > button_up.y + camera.y and y < button_up.y + button.img:getHeight() + camera.y then
control_up = true
if start_time > ship.time_start then
control_up, control_right, control_left, control_quit = false, false, false, false
-- Keyboard
if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then
control_quit = true
end
-- Right
if x > button_right.x and x < button_right.x + button.img:getWidth() and y > button_right.y + camera.y and y < button_right.y + button.img:getHeight() + camera.y then
control_right = true
elseif x > button_left.x and x < button_left.x + button.img:getWidth() and y > button_left.y + camera.y and y < button_left.y + button.img:getHeight() + camera.y then
control_left = true
if love.keyboard.isDown('right') then
control_right = true
elseif love.keyboard.isDown('left') then
control_left = true
end
if love.keyboard.isDown('up') then
control_up = true
end
-- Mouse
if love.mouse.isDown(1) then
local x, y = love.mouse.getPosition()
-- Up
if x > button_up.x and x < button_up.x + button.img:getWidth() and y > button_up.y + camera.y and y < button_up.y + button.img:getHeight() + camera.y then
control_up = true
end
-- Right
if x > button_right.x and x < button_right.x + button.img:getWidth() and y > button_right.y + camera.y and y < button_right.y + button.img:getHeight() + camera.y then
control_right = true
elseif x > button_left.x and x < button_left.x + button.img:getWidth() and y > button_left.y + camera.y and y < button_left.y + button.img:getHeight() + camera.y then
control_left = true
end
end
end
-- Ship move
@ -291,35 +296,37 @@ function love.draw()
love.graphics.draw(explosion.img, explosion.frames[explosion.pos_frame], ship.body:getX(), ship.body:getY() + ship.img:getHeight() / 2)
end
-- Controls
-- Up
button_up.y = level.y + (camera.height / 4) + -camera.y
local button_frame_up = button.frames[1]
if control_up then
button_frame_up = button.frames[2]
end
love.graphics.draw(button.img, button_frame_up, button_up.x, button_up.y)
if debug then
love.graphics.rectangle('fill', button_up.x, button_up.y, button.img:getWidth(), button.img:getHeight())
end
-- Right
button_right.y = button_up.y + (button.img:getHeight() + (button.img:getHeight() / 3))
local button_frame_right = button.frames[1]
if control_right then
button_frame_right = button.frames[2]
end
love.graphics.draw(button.img, button_frame_right, button_right.x + (button.img:getWidth() / (2 * button.num_frames)), button_right.y + button.img:getHeight(), 90 * math.pi / 180, 1, 1, button.img:getWidth() / 2, button.img:getHeight() / 2)
if debug then
love.graphics.rectangle('fill', button_right.x, button_right.y, button.img:getWidth(), button.img:getHeight())
end
-- Left
button_left.y = button_right.y
local button_frame_left = button.frames[1]
if control_left then
button_frame_left = button.frames[2]
end
love.graphics.draw(button.img, button_frame_left, button_left.x + (button.img:getWidth() / (2 * button.num_frames)), button_left.y, 270 * math.pi / 180, 1, 1, button.img:getWidth() / 2, button.img:getHeight() / 2)
if debug then
love.graphics.rectangle('fill', button_left.x, button_left.y, button.img:getWidth(), button.img:getHeight())
if start_time > ship.time_start then
-- Up
button_up.y = level.y + (camera.height / 4) + -camera.y
local button_frame_up = button.frames[1]
if control_up then
button_frame_up = button.frames[2]
end
love.graphics.draw(button.img, button_frame_up, button_up.x, button_up.y)
if debug then
love.graphics.rectangle('fill', button_up.x, button_up.y, button.img:getWidth(), button.img:getHeight())
end
-- Right
button_right.y = button_up.y + (button.img:getHeight() + (button.img:getHeight() / 3))
local button_frame_right = button.frames[1]
if control_right then
button_frame_right = button.frames[2]
end
love.graphics.draw(button.img, button_frame_right, button_right.x + (button.img:getWidth() / (2 * button.num_frames)), button_right.y + button.img:getHeight(), 90 * math.pi / 180, 1, 1, button.img:getWidth() / 2, button.img:getHeight() / 2)
if debug then
love.graphics.rectangle('fill', button_right.x, button_right.y, button.img:getWidth(), button.img:getHeight())
end
-- Left
button_left.y = button_right.y
local button_frame_left = button.frames[1]
if control_left then
button_frame_left = button.frames[2]
end
love.graphics.draw(button.img, button_frame_left, button_left.x + (button.img:getWidth() / (2 * button.num_frames)), button_left.y, 270 * math.pi / 180, 1, 1, button.img:getWidth() / 2, button.img:getHeight() / 2)
if debug then
love.graphics.rectangle('fill', button_left.x, button_left.y, button.img:getWidth(), button.img:getHeight())
end
end
-- Texts
if not play and not win then -- Game over
@ -362,7 +369,7 @@ function restart(level_arg)
local temp_img = img_asteroide[math.random(1, table_length(img_asteroide))]
asteroids[i] = {
x = math.random(0, canvas.width - temp_img:getWidth()),
y = math.random(200, canvas.height - temp_img:getHeight()),
y = math.random(window.height / 2, canvas.height - temp_img:getHeight()),
speed = math.random(1, max_speed_asteroids),
img = temp_img,
angle = math.random(0, 90)
@ -372,6 +379,7 @@ function restart(level_arg)
ship.body = love.physics.newBody(world, (canvas.width / 2) - (ship.img:getWidth() / 2) , ship.y, 'dynamic')
win = false
play = true
start_time = 0
end
-- Controls