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"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="love.to.android1104173735" <manifest package="love.to.android1104181206"
android:versionCode="15" android:versionCode="15"
android:versionName="0.9.2" android:versionName="0.9.2"
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android"> android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
@ -12,13 +12,13 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="Game 1104173735" android:label="Game 1104181206"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" /> <service android:name=".DownloadService" />
<activity <activity
android:name="LtaActivity" android:name="LtaActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="Game 1104173735" android:label="Game 1104181206"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="landscape" > android:screenOrientation="landscape" >
<intent-filter> <intent-filter>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="love.to.android1104173735" <manifest package="love.to.android1104181206"
android:versionCode="15" android:versionCode="15"
android:versionName="0.9.2" android:versionName="0.9.2"
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android"> android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
@ -12,13 +12,13 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="Game 1104173735" android:label="Game 1104181206"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" /> <service android:name=".DownloadService" />
<activity <activity
android:name="LtaActivity" android:name="LtaActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="Game 1104173735" android:label="Game 1104181206"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="landscape" > android:screenOrientation="landscape" >
<intent-filter> <intent-filter>

View File

@ -1,5 +1,5 @@
#Last build type #Last build type
#Fri, 04 Nov 2016 17:37:41 +0100 #Fri, 04 Nov 2016 18:12:11 +0100
build.last.target=debug 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.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/android1104181206/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/android1104181206/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/android1104181206/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/android1104181206/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/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/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$1.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.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 # view AndroidManifest.xml #generated:45
-keep class love.to.android1104173735.DownloadActivity { <init>(...); } -keep class love.to.android1104181206.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:17 # view AndroidManifest.xml #generated:17
-keep class love.to.android1104173735.DownloadService { <init>(...); } -keep class love.to.android1104181206.DownloadService { <init>(...); }
# view AndroidManifest.xml #generated:18 # 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/res/drawable-xxhdpi/ic_launcher.png \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/AndroidManifest.xml \ /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 */ /** Automatically generated file. DO NOT MODIFY */
package love.to.android1104173735; package love.to.android1104181206;
public final class BuildConfig { public final class BuildConfig {
public final static boolean DEBUG = true; public final static boolean DEBUG = true;

View File

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

View File

@ -1,4 +1,4 @@
package love.to.android1104173735; package love.to.android1104181206;
import org.love2d.android.GameActivity; import org.love2d.android.GameActivity;
public class LtaActivity extends 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.shape = love.physics.newCircleShape(20)
ship.fixture = love.physics.newFixture(ship.body, ship.shape, 1) ship.fixture = love.physics.newFixture(ship.body, ship.shape, 1)
ship.fixture:setRestitution(0.9) ship.fixture:setRestitution(0.9)
ship.time_start = 1
start_time = 0
-- Fire -- Fire
fire = {} fire = {}
fire.img = love.graphics.newImage('assets/sprite/fire.png') fire.img = love.graphics.newImage('assets/sprite/fire.png')
@ -116,6 +118,7 @@ end
-- UPDATE -- UPDATE
function love.update(dt) function love.update(dt)
start_time = dt + start_time
-- Sprite -- Sprite
if not explosion.finish and explosion.active then -- Explosion if not explosion.finish and explosion.active then -- Explosion
explosion.time = explosion.time + dt explosion.time = explosion.time + dt
@ -144,31 +147,33 @@ function love.update(dt)
fire.pos_frame = 1 fire.pos_frame = 1
end end
-- Controls -- Controls
control_up, control_right, control_left, control_quit = false, false, false, false if start_time > ship.time_start then
-- Keyboard control_up, control_right, control_left, control_quit = false, false, false, false
if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then -- Keyboard
control_quit = true if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then
end control_quit = 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 end
-- Right if love.keyboard.isDown('right') then
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
control_right = true elseif love.keyboard.isDown('left') then
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
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
end end
-- Ship move -- 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) love.graphics.draw(explosion.img, explosion.frames[explosion.pos_frame], ship.body:getX(), ship.body:getY() + ship.img:getHeight() / 2)
end end
-- Controls -- Controls
-- Up if start_time > ship.time_start then
button_up.y = level.y + (camera.height / 4) + -camera.y -- Up
local button_frame_up = button.frames[1] button_up.y = level.y + (camera.height / 4) + -camera.y
if control_up then local button_frame_up = button.frames[1]
button_frame_up = button.frames[2] if control_up then
end button_frame_up = button.frames[2]
love.graphics.draw(button.img, button_frame_up, button_up.x, button_up.y) end
if debug then love.graphics.draw(button.img, button_frame_up, button_up.x, button_up.y)
love.graphics.rectangle('fill', button_up.x, button_up.y, button.img:getWidth(), button.img:getHeight()) if debug then
end love.graphics.rectangle('fill', button_up.x, button_up.y, button.img:getWidth(), button.img:getHeight())
-- Right end
button_right.y = button_up.y + (button.img:getHeight() + (button.img:getHeight() / 3)) -- Right
local button_frame_right = button.frames[1] button_right.y = button_up.y + (button.img:getHeight() + (button.img:getHeight() / 3))
if control_right then local button_frame_right = button.frames[1]
button_frame_right = button.frames[2] if control_right then
end button_frame_right = button.frames[2]
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) end
if debug then 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)
love.graphics.rectangle('fill', button_right.x, button_right.y, button.img:getWidth(), button.img:getHeight()) if debug then
end love.graphics.rectangle('fill', button_right.x, button_right.y, button.img:getWidth(), button.img:getHeight())
-- Left end
button_left.y = button_right.y -- Left
local button_frame_left = button.frames[1] button_left.y = button_right.y
if control_left then local button_frame_left = button.frames[1]
button_frame_left = button.frames[2] if control_left then
end button_frame_left = button.frames[2]
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) end
if debug then 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)
love.graphics.rectangle('fill', button_left.x, button_left.y, button.img:getWidth(), button.img:getHeight()) if debug then
love.graphics.rectangle('fill', button_left.x, button_left.y, button.img:getWidth(), button.img:getHeight())
end
end end
-- Texts -- Texts
if not play and not win then -- Game over 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))] local temp_img = img_asteroide[math.random(1, table_length(img_asteroide))]
asteroids[i] = { asteroids[i] = {
x = math.random(0, canvas.width - temp_img:getWidth()), 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), speed = math.random(1, max_speed_asteroids),
img = temp_img, img = temp_img,
angle = math.random(0, 90) 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') ship.body = love.physics.newBody(world, (canvas.width / 2) - (ship.img:getWidth() / 2) , ship.y, 'dynamic')
win = false win = false
play = true play = true
start_time = 0
end end
-- Controls -- Controls