Code: Select all
-- gf is shorthand for Graphics for the following
function load_graphics()
load_ships()
load_buttons()
load_effects()
load_backgrounds()
load_huds()
load_icons()
end
function load_ships()
local gfx_ship_L_small_01a = love.graphics.newImage( "Graphics/Ships/Small/Ship 01a L.png")
local gfx_ship_L_small_01b = love.graphics.newImage( "Graphics/Ships/Small/Ship 01b L.png")
local gfx_ship_L_small_01c = love.graphics.newImage( "Graphics/Ships/Small/Ship 01c L.png")
local gfx_ship_L_small_01d = love.graphics.newImage( "Graphics/Ships/Small/Ship 01d L.png")
local gfx_ship_L_small_01e = love.graphics.newImage( "Graphics/Ships/Small/Ship 01e L.png")
local gfx_ship_L_small_01f = love.graphics.newImage( "Graphics/Ships/Small/Ship 01f L.png")
local gfx_ship_L_small_01g = love.graphics.newImage( "Graphics/Ships/Small/Ship 01g L.png")
local gfx_ship_L_small_02a = love.graphics.newImage( "Graphics/Ships/Small/Ship 02a L.png")
local gfx_ship_L_small_02b = love.graphics.newImage( "Graphics/Ships/Small/Ship 02b L.png")
local gfx_ship_L_small_02c = love.graphics.newImage( "Graphics/Ships/Small/Ship 02c L.png")
local gfx_ship_L_small_02d = love.graphics.newImage( "Graphics/Ships/Small/Ship 02d L.png")
local gfx_ship_L_small_02e = love.graphics.newImage( "Graphics/Ships/Small/Ship 02e L.png")
local gfx_ship_L_small_02f = love.graphics.newImage( "Graphics/Ships/Small/Ship 02f L.png")
local gfx_ship_L_small_04a = love.graphics.newImage( "Graphics/Ships/Small/Ship 04a L.png")
local gfx_ship_L_small_04b = love.graphics.newImage( "Graphics/Ships/Small/Ship 04b L.png")
local gfx_ship_L_small_04c = love.graphics.newImage( "Graphics/Ships/Small/Ship 04c L.png")
local gfx_ship_L_small_05a = love.graphics.newImage( "Graphics/Ships/Small/Ship 05a L.png")
local gfx_ship_L_small_06a = love.graphics.newImage( "Graphics/Ships/Small/Ship 06a L.png")
local gfx_ship_L_small_06b = love.graphics.newImage( "Graphics/Ships/Small/Ship 06b L.png")
local gfx_ship_L_small_06c = love.graphics.newImage( "Graphics/Ships/Small/Ship 06c L.png")
local gfx_ship_L_small_07a = love.graphics.newImage( "Graphics/Ships/Small/Ship 07a L.png")
local gfx_ship_L_small_08a = love.graphics.newImage( "Graphics/Ships/Small/Ship 08a L.png")
local gfx_ship_L_small_08b = love.graphics.newImage( "Graphics/Ships/Small/Ship 08b L.png")
local gfx_ship_L_small_09a = love.graphics.newImage( "Graphics/Ships/Small/Ship 09a L.png")
local gfx_ship_L_small_09b = love.graphics.newImage( "Graphics/Ships/Small/Ship 09b L.png")
local gfx_ship_L_small_09c = love.graphics.newImage( "Graphics/Ships/Small/Ship 09c L.png")
local gfx_ship_L_small_09d = love.graphics.newImage( "Graphics/Ships/Small/Ship 09d L.png")
local gfx_ship_R_small_01a = love.graphics.newImage( "Graphics/Ships/Small/Ship 01a.png")
local gfx_ship_R_small_01b = love.graphics.newImage( "Graphics/Ships/Small/Ship 01b.png")
local gfx_ship_R_small_01c = love.graphics.newImage( "Graphics/Ships/Small/Ship 01c.png")
local gfx_ship_R_small_01d = love.graphics.newImage( "Graphics/Ships/Small/Ship 01d.png")
local gfx_ship_R_small_01e = love.graphics.newImage( "Graphics/Ships/Small/Ship 01e.png")
local gfx_ship_R_small_01f = love.graphics.newImage( "Graphics/Ships/Small/Ship 01f.png")
local gfx_ship_R_small_01g = love.graphics.newImage( "Graphics/Ships/Small/Ship 01g.png")
local gfx_ship_R_small_02a = love.graphics.newImage( "Graphics/Ships/Small/Ship 02a.png")
local gfx_ship_R_small_02b = love.graphics.newImage( "Graphics/Ships/Small/Ship 02b.png")
local gfx_ship_R_small_02c = love.graphics.newImage( "Graphics/Ships/Small/Ship 02c.png")
local gfx_ship_R_small_02d = love.graphics.newImage( "Graphics/Ships/Small/Ship 02d.png")
local gfx_ship_R_small_02e = love.graphics.newImage( "Graphics/Ships/Small/Ship 02e.png")
local gfx_ship_R_small_02f = love.graphics.newImage( "Graphics/Ships/Small/Ship 02f.png")
local gfx_ship_R_small_04a = love.graphics.newImage( "Graphics/Ships/Small/Ship 04a.png")
local gfx_ship_R_small_04b = love.graphics.newImage( "Graphics/Ships/Small/Ship 04b.png")
local gfx_ship_R_small_04c = love.graphics.newImage( "Graphics/Ships/Small/Ship 04c.png")
local gfx_ship_R_small_05a = love.graphics.newImage( "Graphics/Ships/Small/Ship 05a.png")
local gfx_ship_R_small_06a = love.graphics.newImage( "Graphics/Ships/Small/Ship 06a.png")
local gfx_ship_R_small_06b = love.graphics.newImage( "Graphics/Ships/Small/Ship 06b.png")
local gfx_ship_R_small_06c = love.graphics.newImage( "Graphics/Ships/Small/Ship 06c.png")
local gfx_ship_R_small_07a = love.graphics.newImage( "Graphics/Ships/Small/Ship 07a.png")
local gfx_ship_R_small_08a = love.graphics.newImage( "Graphics/Ships/Small/Ship 08a.png")
local gfx_ship_R_small_08b = love.graphics.newImage( "Graphics/Ships/Small/Ship 08b.png")
local gfx_ship_R_small_09a = love.graphics.newImage( "Graphics/Ships/Small/Ship 09a.png")
local gfx_ship_R_small_09b = love.graphics.newImage( "Graphics/Ships/Small/Ship 09b.png")
local gfx_ship_R_small_09c = love.graphics.newImage( "Graphics/Ships/Small/Ship 09c.png")
local gfx_ship_R_small_09d = love.graphics.newImage( "Graphics/Ships/Small/Ship 09d.png")
gfx_ship_table = {} -- ** Ships are stored is a table as 1 = Left Side or 2 = Right Side and then Number
gfx_ship_table[1] = {
[1] = gfx_ship_L_small_01a ,
[2] = gfx_ship_L_small_01b ,
[3] = gfx_ship_L_small_01c ,
[4] = gfx_ship_L_small_01d ,
[5] = gfx_ship_L_small_01e ,
[6] = gfx_ship_L_small_01f ,
[7] = gfx_ship_L_small_01g ,
[8] = gfx_ship_L_small_02a ,
[9] = gfx_ship_L_small_02b ,
[10] = gfx_ship_L_small_02c ,
[11] = gfx_ship_L_small_02d ,
[12] = gfx_ship_L_small_02e ,
[13] = gfx_ship_L_small_02f ,
[14] = gfx_ship_L_small_04a ,
[15] = gfx_ship_L_small_04b ,
[16] = gfx_ship_L_small_04c ,
[17] = gfx_ship_L_small_05a ,
[18] = gfx_ship_L_small_06a ,
[19] = gfx_ship_L_small_06b ,
[20] = gfx_ship_L_small_06c ,
[21] = gfx_ship_L_small_07a ,
[22] = gfx_ship_L_small_08a ,
[23] = gfx_ship_L_small_08b ,
[24] = gfx_ship_L_small_09a ,
[25] = gfx_ship_L_small_09b ,
[26] = gfx_ship_L_small_09c ,
[27] = gfx_ship_L_small_09d
}
gfx_ship_table[2] = {
[1] = gfx_ship_R_small_01a ,
[2] = gfx_ship_R_small_01b ,
[3] = gfx_ship_R_small_01c ,
[4] = gfx_ship_R_small_01d ,
[5] = gfx_ship_R_small_01e ,
[6] = gfx_ship_R_small_01f ,
[7] = gfx_ship_R_small_01g ,
[8] = gfx_ship_R_small_02a ,
[9] = gfx_ship_R_small_02b ,
[10] = gfx_ship_R_small_02c ,
[11] = gfx_ship_R_small_02d ,
[12] = gfx_ship_R_small_02e ,
[13] = gfx_ship_R_small_02f ,
[14] = gfx_ship_R_small_04a ,
[15] = gfx_ship_R_small_04b ,
[16] = gfx_ship_R_small_04c ,
[17] = gfx_ship_R_small_05a ,
[18] = gfx_ship_R_small_06a ,
[19] = gfx_ship_R_small_06b ,
[20] = gfx_ship_R_small_06c ,
[21] = gfx_ship_R_small_07a ,
[22] = gfx_ship_R_small_08a ,
[23] = gfx_ship_R_small_08b ,
[24] = gfx_ship_R_small_09a ,
[25] = gfx_ship_R_small_09b ,
[26] = gfx_ship_R_small_09c ,
[27] = gfx_ship_R_small_09d
}
end
function load_buttons()
end
function load_effects()
local gfx_effect_01 = love.graphics.newImage( "Graphics/Effects/01Blast Blue.png")
local gfx_effect_02 = love.graphics.newImage( "Graphics/Effects/02Blast Gold.png")
local gfx_effect_03 = love.graphics.newImage( "Graphics/Effects/03Blast Green.png")
local gfx_effect_04 = love.graphics.newImage( "Graphics/Effects/04Blast Purple.png")
local gfx_effect_05 = love.graphics.newImage( "Graphics/Effects/05Blast Red.png")
local gfx_effect_06 = love.graphics.newImage( "Graphics/Effects/06Blast Silver.png")
local gfx_effect_07 = love.graphics.newImage( "Graphics/Effects/07Disable 1.png")
local gfx_effect_08 = love.graphics.newImage( "Graphics/Effects/08Disable 2.png")
local gfx_effect_09 = love.graphics.newImage( "Graphics/Effects/09Disable 3.png")
local gfx_effect_10 = love.graphics.newImage( "Graphics/Effects/10Laser Blue.png")
local gfx_effect_11 = love.graphics.newImage( "Graphics/Effects/11Laser Gold.png")
local gfx_effect_12 = love.graphics.newImage( "Graphics/Effects/12Laser Green.png")
local gfx_effect_13 = love.graphics.newImage( "Graphics/Effects/13Laser Purple.png")
local gfx_effect_14 = love.graphics.newImage( "Graphics/Effects/14Laser Red.png")
local gfx_effect_15 = love.graphics.newImage( "Graphics/Effects/15Missle L.png")
local gfx_effect_16 = love.graphics.newImage( "Graphics/Effects/16Missle R.png")
local mgfx_effect_01 = newAnimation(gfx_effect_01, 16, 16, .15, 6)
local mgfx_effect_02 = newAnimation(gfx_effect_02, 16, 16, .15, 6)
local mgfx_effect_03 = newAnimation(gfx_effect_03, 16, 16, .15, 6)
local mgfx_effect_04 = newAnimation(gfx_effect_04, 16, 16, .15, 6)
local mgfx_effect_05 = newAnimation(gfx_effect_05, 16, 16, .15, 6)
local mgfx_effect_06 = newAnimation(gfx_effect_06, 16, 16, .15, 6)
gfx_effect_table = {} -- Effects stored as Table
gfx_effect_table = {
[1] = mgfx_effect_01,
[2] = mgfx_effect_02,
[3] = mgfx_effect_03,
[4] = mgfx_effect_04,
[5] = mgfx_effect_05,
[6] = mgfx_effect_06,
[7] = gfx_effect_07,
[8] = gfx_effect_08,
[9] = gfx_effect_09,
[10] = gfx_effect_10,
[11] = gfx_effect_11,
[12] = gfx_effect_12,
[13] = gfx_effect_13,
[14] = gfx_effect_14,
[15] = gfx_effect_15,
[16] = gfx_effect_16
}
end
function load_backgrounds()
local gfx_backgraound01 = love.graphics.newImage( "Graphics/Backgrounds/Background 01.png")
local gfx_backgraound02 = love.graphics.newImage( "Graphics/Backgrounds/Background 02.png")
local gfx_backgraound03 = love.graphics.newImage( "Graphics/Backgrounds/Background 03.png")
local gfx_backgraound04 = love.graphics.newImage( "Graphics/Backgrounds/Background 04.png")
local gfx_backgraound05 = love.graphics.newImage( "Graphics/Backgrounds/Background 05.png")
local gfx_backgraound06 = love.graphics.newImage( "Graphics/Backgrounds/Background 06.png")
local gfx_backgraound07 = love.graphics.newImage( "Graphics/Backgrounds/Background 07.png")
local gfx_backgraound08 = love.graphics.newImage( "Graphics/Backgrounds/Background 08.png")
local gfx_backgraound09 = love.graphics.newImage( "Graphics/Backgrounds/Background 09.png")
gfx_background_table = {} -- Backgounds stored as Table
gfx_background_table = {
[1] = gfx_backgraound01,
[2] = gfx_backgraound02,
[3] = gfx_backgraound03,
[4] = gfx_backgraound04,
[5] = gfx_backgraound05,
[6] = gfx_backgraound06,
[7] = gfx_backgraound07,
[8] = gfx_backgraound08,
[9] = gfx_backgraound09
}
end
function load_huds()
local gfx_hud01 = love.graphics.newImage( "Graphics/Huds/HUD.png")
gfx_hud_table = {}
gfx_hud_table = {
[1] = gfx_hud01 -- Space Battle HUD
}
end
function load_icons()
end
function love.update(dt)
gfx_effect_table[1]:update(dt) -- Updating Animations
gfx_effect_table[2]:update(dt) -- Updating Animations
gfx_effect_table[3]:update(dt) -- Updating Animations
gfx_effect_table[4]:update(dt) -- Updating Animations
gfx_effect_table[5]:update(dt) -- Updating Animations
gfx_effect_table[6]:update(dt) -- Updating Animations
end
Code: Select all
gfx_ship_table[1] = {
[1] = love.graphics.newImage( "Graphics/Ships/Small/Ship 01a L.png")
}
**EDIT** Coding with little sleep is never good. So I see I can indeed skip the whole local bit. I feel like such a noob. But I am still curious if there is a better way of doing what I have done with my code.