Add explosion
This commit is contained in:
parent
2af855e88a
commit
0bf3f6926e
BIN
android/game.apk
BIN
android/game.apk
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest package="love.to.android1208185535"
|
<manifest package="love.to.android1208204140"
|
||||||
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 1208185535"
|
android:label="Game 1208204140"
|
||||||
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 1208185535"
|
android:label="Game 1208204140"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="landscape" >
|
android:screenOrientation="landscape" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest package="love.to.android1208185535"
|
<manifest package="love.to.android1208204140"
|
||||||
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 1208185535"
|
android:label="Game 1208204140"
|
||||||
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 1208185535"
|
android:label="Game 1208204140"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="landscape" >
|
android:screenOrientation="landscape" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#Last build type
|
#Last build type
|
||||||
#Thu, 08 Dec 2016 18:55:42 +0100
|
#Thu, 08 Dec 2016 20:41:46 +0100
|
||||||
|
|
||||||
build.last.target=debug
|
build.last.target=debug
|
||||||
|
|
||||||
|
Binary file not shown.
@ -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.dex : \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208185535/BuildConfig.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208204140/BuildConfig.class \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208185535/LtaActivity.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208204140/LtaActivity.class \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208185535/R$attr.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208204140/R$attr.class \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208185535/R$drawable.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208204140/R$drawable.class \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208185535/R.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1208204140/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/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$1.class \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.class \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/org/libsdl/app/SDLActivity$2.class \
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
# view AndroidManifest.xml #generated:45
|
# view AndroidManifest.xml #generated:45
|
||||||
-keep class love.to.android1208185535.DownloadActivity { <init>(...); }
|
-keep class love.to.android1208204140.DownloadActivity { <init>(...); }
|
||||||
|
|
||||||
# view AndroidManifest.xml #generated:17
|
# view AndroidManifest.xml #generated:17
|
||||||
-keep class love.to.android1208185535.DownloadService { <init>(...); }
|
-keep class love.to.android1208204140.DownloadService { <init>(...); }
|
||||||
|
|
||||||
# view AndroidManifest.xml #generated:18
|
# view AndroidManifest.xml #generated:18
|
||||||
-keep class love.to.android1208185535.LtaActivity { <init>(...); }
|
-keep class love.to.android1208204140.LtaActivity { <init>(...); }
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1208185535/R.java \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1208204140/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/res/drawable-xxhdpi/ic_launcher.png \
|
||||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/AndroidManifest.xml \
|
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/AndroidManifest.xml \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** Automatically generated file. DO NOT MODIFY */
|
/** Automatically generated file. DO NOT MODIFY */
|
||||||
package love.to.android1208185535;
|
package love.to.android1208204140;
|
||||||
|
|
||||||
public final class BuildConfig {
|
public final class BuildConfig {
|
||||||
public final static boolean DEBUG = true;
|
public final static boolean DEBUG = true;
|
@ -5,7 +5,7 @@
|
|||||||
* should not be modified by hand.
|
* should not be modified by hand.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package love.to.android1208185535;
|
package love.to.android1208204140;
|
||||||
|
|
||||||
public final class R {
|
public final class R {
|
||||||
public static final class attr {
|
public static final class attr {
|
@ -1,4 +1,4 @@
|
|||||||
package love.to.android1208185535;
|
package love.to.android1208204140;
|
||||||
import org.love2d.android.GameActivity;
|
import org.love2d.android.GameActivity;
|
||||||
|
|
||||||
public class LtaActivity extends GameActivity {}
|
public class LtaActivity extends GameActivity {}
|
@ -8,6 +8,7 @@ function game.load()
|
|||||||
game.canvas = { width = width, height = 2880 }
|
game.canvas = { width = width, height = 2880 }
|
||||||
love.window.setMode(game.window.width, game.window.height)
|
love.window.setMode(game.window.width, game.window.height)
|
||||||
game.level = 1
|
game.level = 1
|
||||||
|
game.play = true
|
||||||
-- Physics
|
-- Physics
|
||||||
local world_meter = 64
|
local world_meter = 64
|
||||||
local gravity = 2
|
local gravity = 2
|
||||||
|
@ -31,6 +31,19 @@ function spaceship.load(game)
|
|||||||
light.height = 66
|
light.height = 66
|
||||||
g = anim8.newGrid(light.width, light.height, light.img:getWidth(), light.img:getHeight())
|
g = anim8.newGrid(light.width, light.height, light.img:getWidth(), light.img:getHeight())
|
||||||
light.animation = anim8.newAnimation(g('1-' .. light.num_frames, 1), 0.05)
|
light.animation = anim8.newAnimation(g('1-' .. light.num_frames, 1), 0.05)
|
||||||
|
-- Explosion
|
||||||
|
explosion = {
|
||||||
|
img = love.graphics.newImage('assets/sprites/spaceship/explosion.png'),
|
||||||
|
num_frames = 10,
|
||||||
|
speed = 0.05,
|
||||||
|
x = -game.canvas.width,
|
||||||
|
y = -game.canvas.height
|
||||||
|
}
|
||||||
|
g = anim8.newGrid(explosion.img:getWidth() / explosion.num_frames, explosion.img:getHeight(), explosion.img:getWidth(), explosion.img:getHeight())
|
||||||
|
explosion.animation = anim8.newAnimation(g('1-' .. explosion.num_frames, 1), explosion.speed, 'pauseAtEnd')
|
||||||
|
explosion.animation:pause()
|
||||||
|
explosion.claim_x = 45
|
||||||
|
explosion.claim_y = 40
|
||||||
-- Collision
|
-- Collision
|
||||||
body.collision = {}
|
body.collision = {}
|
||||||
body.collision.claim = 79
|
body.collision.claim = 79
|
||||||
@ -64,6 +77,8 @@ function spaceship.update(dt, game)
|
|||||||
light.animation:update(dt)
|
light.animation:update(dt)
|
||||||
light.x = body.body:getX() + 43
|
light.x = body.body:getX() + 43
|
||||||
light.y = body.body:getY() - 15
|
light.y = body.body:getY() - 15
|
||||||
|
-- Explosion
|
||||||
|
explosion.animation:update(dt)
|
||||||
-- Controls
|
-- Controls
|
||||||
if control_up then
|
if control_up then
|
||||||
body.body:applyForce(0, -body.power)
|
body.body:applyForce(0, -body.power)
|
||||||
@ -84,7 +99,13 @@ function spaceship.update(dt, game)
|
|||||||
body.collision.hc:moveTo(body.body:getX() + body.collision.claim, body.body:getY() + body.collision.claim)
|
body.collision.hc:moveTo(body.body:getX() + body.collision.claim, body.body:getY() + body.collision.claim)
|
||||||
-- Check for collisions
|
-- Check for collisions
|
||||||
for shape, delta in pairs(HC.collisions(body.collision.hc)) do
|
for shape, delta in pairs(HC.collisions(body.collision.hc)) do
|
||||||
|
game.play = false
|
||||||
|
explosion.x, explosion.y, explosion.enable = body.body:getX() - explosion.claim_x, body.body:getY() - explosion.claim_y, true
|
||||||
|
explosion.animation:resume()
|
||||||
end
|
end
|
||||||
|
if not game.play then
|
||||||
|
body.body:setLinearVelocity(0, 0)
|
||||||
|
end
|
||||||
-- Check game limits
|
-- Check game limits
|
||||||
if body.body:getY() <= 0 then -- Top game
|
if body.body:getY() <= 0 then -- Top game
|
||||||
x, y = body.body:getLinearVelocity()
|
x, y = body.body:getLinearVelocity()
|
||||||
@ -100,13 +121,19 @@ function spaceship.update(dt, game)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function spaceship.draw()
|
function spaceship.draw(game)
|
||||||
light.animation:draw(light.img, light.x, light.y)
|
if game.play then
|
||||||
if press_button then
|
-- Lignt
|
||||||
body.animation_fire:draw(body.img, body.body:getX(), body.body:getY())
|
light.animation:draw(light.img, light.x, light.y)
|
||||||
else
|
-- Spaceship
|
||||||
body.animation_stop:draw(body.img, body.body:getX(), body.body:getY())
|
if press_button then
|
||||||
|
body.animation_fire:draw(body.img, body.body:getX(), body.body:getY())
|
||||||
|
else
|
||||||
|
body.animation_stop:draw(body.img, body.body:getX(), body.body:getY())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
-- Explosion
|
||||||
|
explosion.animation:draw(explosion.img, explosion.x, explosion.y)
|
||||||
-- Collision
|
-- Collision
|
||||||
if collision_debug then
|
if collision_debug then
|
||||||
body.collision.hc:draw('fill')
|
body.collision.hc:draw('fill')
|
||||||
|
2
main.lua
2
main.lua
@ -33,7 +33,7 @@ function love.draw()
|
|||||||
camera.gcam:draw(function(l,t,w,h)
|
camera.gcam:draw(function(l,t,w,h)
|
||||||
background.draw()
|
background.draw()
|
||||||
moon.draw()
|
moon.draw()
|
||||||
spaceship.draw()
|
spaceship.draw(game)
|
||||||
asteroids.draw()
|
asteroids.draw()
|
||||||
end)
|
end)
|
||||||
controls.draw()
|
controls.draw()
|
||||||
|
Loading…
Reference in New Issue
Block a user