Add mouse control

This commit is contained in:
Andros Fenollosa 2016-11-04 00:02:10 +01:00
parent 8ec8327e5e
commit a397edf8f1
23 changed files with 56 additions and 31 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.android1103000152" <manifest package="love.to.android1103235521"
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 1103000152" android:label="Game 1103235521"
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 1103000152" android:label="Game 1103235521"
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.android1103000152" <manifest package="love.to.android1103235521"
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 1103000152" android:label="Game 1103235521"
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 1103000152" android:label="Game 1103235521"
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
#Thu, 03 Nov 2016 00:01:59 +0100 #Thu, 03 Nov 2016 23:55:26 +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/android1103000152/BuildConfig.class \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103235521/BuildConfig.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103000152/LtaActivity.class \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103235521/LtaActivity.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103000152/R$attr.class \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103235521/R$attr.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103000152/R$drawable.class \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103235521/R$drawable.class \
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103000152/R.class \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/bin/classes/love/to/android1103235521/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.android1103000152.DownloadActivity { <init>(...); } -keep class love.to.android1103235521.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:17 # view AndroidManifest.xml #generated:17
-keep class love.to.android1103000152.DownloadService { <init>(...); } -keep class love.to.android1103235521.DownloadService { <init>(...); }
# view AndroidManifest.xml #generated:18 # view AndroidManifest.xml #generated:18
-keep class love.to.android1103000152.LtaActivity { <init>(...); } -keep class love.to.android1103235521.LtaActivity { <init>(...); }

View File

@ -1,3 +1,3 @@
/Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/gen/love/to/android1103000152/R.java \ /Users/androsfenollosa/www/alunizaje/StartGamedev-160604-osx/tools/love-android-sdl2/gen/love/to/android1103235521/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.android1103000152; package love.to.android1103235521;
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.android1103000152; package love.to.android1103235521;
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.android1103000152; package love.to.android1103235521;
import org.love2d.android.GameActivity; import org.love2d.android.GameActivity;
public class LtaActivity extends GameActivity {} public class LtaActivity extends GameActivity {}

View File

@ -123,6 +123,7 @@ function love.update(dt)
fire.pos_frame = 1 fire.pos_frame = 1
end end
-- Controls -- Controls
-- Keyboard
if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then
love.event.push('quit') love.event.push('quit')
end end
@ -139,6 +140,26 @@ function love.update(dt)
ship.body:applyForce(0, -ship.power) ship.body:applyForce(0, -ship.power)
fire.visible = true fire.visible = true
sounds.fire:play() sounds.fire:play()
end
-- Mouse
if love.mouse.isDown(1) then
local x, y = love.mouse.getPosition()
-- Up
if x > width / 3 and x < width - (width / 3) and y < height / 3 then
ship.body:applyForce(0, -ship.power)
fire.visible = true
sounds.fire:play()
end
-- Left
if x < width / 3 then
ship.body:applyForce(-ship.power, 0)
fire.visible = true
sounds.fire:play()
elseif x > width - (width / 3) then
ship.body:applyForce(ship.power, 0)
fire.visible = true
sounds.fire:play()
end
end end
-- Rotate asteroids -- Rotate asteroids
for key, value in pairs(asteroids) do for key, value in pairs(asteroids) do
@ -298,3 +319,7 @@ end
function love.keyreleased(key) function love.keyreleased(key)
sounds.fire:stop() sounds.fire:stop()
end end
function love.mousereleased(key)
sounds.fire:stop()
end