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"?>
<manifest package="love.to.android1103000152"
<manifest package="love.to.android1103235521"
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 1103000152"
android:label="Game 1103235521"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" />
<activity
android:name="LtaActivity"
android:configChanges="orientation|screenSize"
android:label="Game 1103000152"
android:label="Game 1103235521"
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.android1103000152"
<manifest package="love.to.android1103235521"
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 1103000152"
android:label="Game 1103235521"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" />
<activity
android:name="LtaActivity"
android:configChanges="orientation|screenSize"
android:label="Game 1103000152"
android:label="Game 1103235521"
android:launchMode="singleTop"
android:screenOrientation="landscape" >
<intent-filter>

View File

@ -1,5 +1,5 @@
#Last build type
#Thu, 03 Nov 2016 00:01:59 +0100
#Thu, 03 Nov 2016 23:55:26 +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/android1103000152/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/android1103000152/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/android1103000152/R.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/android1103235521/LtaActivity.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/android1103235521/R$drawable.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/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.android1103000152.DownloadActivity { <init>(...); }
-keep class love.to.android1103235521.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:17
-keep class love.to.android1103000152.DownloadService { <init>(...); }
-keep class love.to.android1103235521.DownloadService { <init>(...); }
# 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/bin/AndroidManifest.xml \

View File

@ -1,5 +1,5 @@
/** Automatically generated file. DO NOT MODIFY */
package love.to.android1103000152;
package love.to.android1103235521;
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.android1103000152;
package love.to.android1103235521;
public final class R {
public static final class attr {

View File

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

View File

@ -123,23 +123,44 @@ function love.update(dt)
fire.pos_frame = 1
end
-- Controls
-- Keyboard
if love.keyboard.isDown('escape') or love.keyboard.isDown('q') then
love.event.push('quit')
end
if love.keyboard.isDown('right') then
ship.body:applyForce(ship.power, 0)
fire.visible = true
sounds.fire:play()
elseif love.keyboard.isDown('left') then
ship.body:applyForce(-ship.power, 0)
fire.visible = true
sounds.fire:play()
end
ship.body:applyForce(ship.power, 0)
fire.visible = true
sounds.fire:play()
elseif love.keyboard.isDown('left') then
ship.body:applyForce(-ship.power, 0)
fire.visible = true
sounds.fire:play()
end
if love.keyboard.isDown('up') then
ship.body:applyForce(0, -ship.power)
fire.visible = true
sounds.fire:play()
end
ship.body:applyForce(0, -ship.power)
fire.visible = true
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
-- Rotate asteroids
for key, value in pairs(asteroids) do
value.angle = asteroids[key].angle + (dt * math.pi / 10)
@ -298,3 +319,7 @@ end
function love.keyreleased(key)
sounds.fire:stop()
end
function love.mousereleased(key)
sounds.fire:stop()
end