Add final star
This commit is contained in:
parent
5fb3cd8d47
commit
5147e66de4
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"?>
|
||||
<manifest package="love.to.android1112134304"
|
||||
<manifest package="love.to.android1112203313"
|
||||
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 1112134304"
|
||||
android:label="Game 1112203313"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1112134304"
|
||||
android:label="Game 1112203313"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="love.to.android1112134304"
|
||||
<manifest package="love.to.android1112203313"
|
||||
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 1112134304"
|
||||
android:label="Game 1112203313"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<service android:name=".DownloadService" />
|
||||
<activity
|
||||
android:name="LtaActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="Game 1112134304"
|
||||
android:label="Game 1112203313"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Last build type
|
||||
#Sat, 12 Nov 2016 13:43:10 +0100
|
||||
#Sat, 12 Nov 2016 20:33:20 +0100
|
||||
|
||||
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/love/to/android1112134304/BuildConfig.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/LtaActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$attr.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R$drawable.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112134304/R.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/BuildConfig.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/LtaActivity.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$attr.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/R$drawable.class \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/bin/classes/love/to/android1112203313/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/SDLActivity$1.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
|
||||
-keep class love.to.android1112134304.DownloadActivity { <init>(...); }
|
||||
-keep class love.to.android1112203313.DownloadActivity { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:17
|
||||
-keep class love.to.android1112134304.DownloadService { <init>(...); }
|
||||
-keep class love.to.android1112203313.DownloadService { <init>(...); }
|
||||
|
||||
# view AndroidManifest.xml #generated:18
|
||||
-keep class love.to.android1112134304.LtaActivity { <init>(...); }
|
||||
-keep class love.to.android1112203313.LtaActivity { <init>(...); }
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1112134304/R.java \
|
||||
/Users/androsfenollosa/www/alunizaje/android/tools/love-android-sdl2/gen/love/to/android1112203313/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/bin/AndroidManifest.xml \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package love.to.android1112134304;
|
||||
package love.to.android1112203313;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = true;
|
@ -5,7 +5,7 @@
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package love.to.android1112134304;
|
||||
package love.to.android1112203313;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
@ -1,4 +1,4 @@
|
||||
package love.to.android1112134304;
|
||||
package love.to.android1112203313;
|
||||
import org.love2d.android.GameActivity;
|
||||
|
||||
public class LtaActivity extends GameActivity {}
|
39
assets/scripts/background.lua
Normal file
39
assets/scripts/background.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local anim8 = require 'assets/scripts/vendor/anim8'
|
||||
local tools = require 'assets/scripts/tools'
|
||||
|
||||
local background = {}
|
||||
local stars = {}
|
||||
|
||||
function background.load()
|
||||
num_stars = 100
|
||||
local star = {}
|
||||
star.num_frames = 9
|
||||
star.ani_speed = 1
|
||||
star.width_frame = 16
|
||||
star.height_frame = 16
|
||||
star.img = love.graphics.newImage('assets/sprites/background/star.png')
|
||||
local g = anim8.newGrid(star.width_frame, star.height_frame, star.img:getWidth(), star.img:getHeight())
|
||||
star.animation = anim8.newAnimation(g('1-' .. star.num_frames, 1), star.ani_speed)
|
||||
for i = 1, num_stars do
|
||||
local temp_star = tools.clone_table(star)
|
||||
temp_star.animation = anim8.newAnimation(g('1-' .. star.num_frames, 1), math.random(star.ani_speed, star.ani_speed * 2))
|
||||
temp_star.animation:gotoFrame(math.random(1, star.num_frames))
|
||||
temp_star.x = math.random(-star.width_frame , canvas.width)
|
||||
temp_star.y = math.random(-star.height_frame, canvas.height)
|
||||
stars[i] = temp_star
|
||||
end
|
||||
end
|
||||
|
||||
function background.update(dt)
|
||||
for key, star in pairs(stars) do
|
||||
star.animation:update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
function background.draw()
|
||||
for key, star in pairs(stars) do
|
||||
star.animation:draw(star.img, star.x, star.y)
|
||||
end
|
||||
end
|
||||
|
||||
return background
|
@ -12,7 +12,7 @@ function spaceship.load(world)
|
||||
spaceship.shape = love.physics.newCircleShape(20)
|
||||
spaceship.fixture = love.physics.newFixture(spaceship.body, spaceship.shape, 1)
|
||||
spaceship.fixture:setRestitution(0.9)
|
||||
local g = anim8.newGrid(98, 93, spaceship.img:getWidth(), spaceship.img:getHeight())
|
||||
local g = anim8.newGrid(110, 103, spaceship.img:getWidth(), spaceship.img:getHeight())
|
||||
spaceship.animation = anim8.newAnimation(g('1-1', 1), 0.1)
|
||||
end
|
||||
|
||||
|
39
assets/scripts/tools.lua
Normal file
39
assets/scripts/tools.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local tools = {}
|
||||
|
||||
-- Get Table length
|
||||
function tools.table_length(T)
|
||||
local count = 0
|
||||
for _ in pairs(T) do count = count + 1 end
|
||||
return count
|
||||
end
|
||||
|
||||
-- Pause system n seconds
|
||||
local clock = os.clock
|
||||
function tools.sleep(n) -- seconds
|
||||
local t0 = clock()
|
||||
while clock() - t0 <= n do end
|
||||
end
|
||||
|
||||
-- Collision detection function
|
||||
function tools.check_circle_collision(circle1, circle2)
|
||||
local distance = math.sqrt((circle1.x - circle2.x) ^ 2 + (circle1.y - circle2.y) ^ 2)
|
||||
return distance <= circle1.radius + circle2.radius
|
||||
end
|
||||
|
||||
-- Deep copy table
|
||||
function tools.clone_table(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[tools.clone_table(orig_key)] = tools.clone_table(orig_value)
|
||||
end
|
||||
setmetatable(copy, tools.clone_table(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
return tools
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
BIN
assets/sprites/background/star.png
Normal file
BIN
assets/sprites/background/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 624 B After Width: | Height: | Size: 5.9 KiB |
6
main.lua
6
main.lua
@ -1,3 +1,4 @@
|
||||
local background = require 'assets/scripts/background'
|
||||
local spaceship = require 'assets/scripts/spaceship'
|
||||
local controls = require 'assets/scripts/controls'
|
||||
|
||||
@ -7,12 +8,15 @@ function love.load()
|
||||
math.randomseed(os.time())
|
||||
local width, height = love.window.getDesktopDimensions( display )
|
||||
window = { width = width , height = height }
|
||||
canvas = { width = width, height = 2880 }
|
||||
love.window.setMode(window.width, window.height)
|
||||
-- Physics
|
||||
world_meter = 64
|
||||
gravity = 2
|
||||
love.physics.setMeter(world_meter) -- Height earth in meters
|
||||
world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth
|
||||
-- Background
|
||||
background.load()
|
||||
-- Spaceship
|
||||
spaceship.load(world)
|
||||
end
|
||||
@ -20,12 +24,14 @@ end
|
||||
-- UPDATE
|
||||
function love.update(dt)
|
||||
world:update(dt)
|
||||
background.update(dt)
|
||||
controls.update(dt)
|
||||
spaceship.update(dt)
|
||||
end
|
||||
|
||||
-- DRAW
|
||||
function love.draw()
|
||||
background.draw()
|
||||
spaceship.draw()
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user