Question on Tables and Storing [SOLVED]

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Question on Tables and Storing [SOLVED]

Post by Kjell Granlund »

Ok well I was wondering if there was a better way of doing this bit of code for loading in the graphics in my game:

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	
Could I simply use:

Code: Select all

gfx_ship_table[1] = {
[1]  = love.graphics.newImage( "Graphics/Ships/Small/Ship 01a L.png")
}
Instead of using locals and such? If so then is there an even better way than that? Just seems like alot of typing is all...

**EDIT** :huh: 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.
Last edited by Kjell Granlund on Mon Jan 14, 2013 12:17 am, edited 2 times in total.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Question on Tables and Storing

Post by Jasoco »

Yeah, tables can contain anything including other tables. I would definitely figure out a better way to do that. That's a lot of code when it could be so much smaller with better named variables and the use of quads on single images where possible instead of separate images for every frame.
User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Re: Question on Tables and Storing

Post by Kjell Granlund »

Quads you say? :shock: What are those? I have heard people speak of them, but I do not know what they are. Would that mean rewriting all my code to use these quads you speak of?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Question on Tables and Storing

Post by Jasoco »

That code is going to have to be rewritten either way. It's a huge mess that will be very hard to maintain. But you will also have to rethink everything. I don't know exactly how many graphics you have but you should put all like images into single sheets and use quads. Look them up on the Wiki. That's what it's there for.
User avatar
Kjell Granlund
Prole
Posts: 33
Joined: Tue Jan 08, 2013 12:39 am
Location: Virginia Beach, VA USA

Re: Question on Tables and Storing

Post by Kjell Granlund »

Thanks, I read them on the wiki, but I am a visual learner so I will hunt for a few demos that people have made and eat away at that juicy code. As for how many images I have. Well I believe the count is close to 400 of so. I am now structuring my folders and such and doing the code to match. I might be able to use queads but perhaps not for backgrounds? They are 800x600. Unless I want a HUGE picture. Thanks again and hopefully I can make my code ALOT shorter. Im kinda glad I didnt post my .love as I am kinda embarressed how badly it is written.

Without using Quads (until I learn them) is there anything else I can do to shorten this code?

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()
	
-- ** Ships are stored is a table as 1 = Left Side or 2 = Right Side and then Number
	
	gfx_ship_table = {} 
	
	gfx_ship_table[1] = {
		[1]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01a L.png"),
		[2]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01b L.png"),
		[3]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01c L.png"),
		[4]	 =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01d L.png"),
		[5]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01e L.png"),
		[6]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01f L.png"),
		[7]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01g L.png"),
		[8]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02a L.png"),
		[9]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02b L.png"),
		[10] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02c L.png"),
		[11] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02d L.png"),
		[12] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02e L.png"),
		[13] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02f L.png"),
		[14] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04a L.png"),
		[15] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04b L.png"),
		[16] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04c L.png"),
		[17] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 05a L.png"),
		[18] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06a L.png"),
		[19] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06b L.png"),
		[20] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06c L.png"),
		[21] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 07a L.png"),
		[22] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 08a L.png"),
		[23] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 08b L.png"),
		[24] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09a L.png"),
		[25] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09b L.png"),
		[26] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09c L.png"),
		[27] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09d L.png")
							 }

	gfx_ship_table[2] = {
		[1]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01a.png"),
		[2]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01b.png"),
		[3]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01c.png"),
		[4]	 =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01d.png"),
		[5]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01e.png"),
		[6]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01f.png"),
		[7]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 01g.png"),
		[8]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02a.png"),
		[9]  =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02b.png"),
		[10] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02c.png"),
		[11] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02d.png"),
		[12] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02e.png"),
		[13] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 02f.png"),
		[14] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04a.png"),
		[15] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04b.png"),
		[16] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 04c.png"),
		[17] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 05a.png"),
		[18] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06a.png"),
		[19] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06b.png"),
		[20] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 06c.png"),
		[21] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 07a.png"),
		[22] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 08a.png"),
		[23] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 08b.png"),
		[24] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09a.png"),
		[25] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09b.png"),
		[26] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09c.png"),
		[27] =		love.graphics.newImage( "Graphics/Ships/Small/Ship 09d.png")
							}


end

function load_buttons()

end

function load_effects()

	gfx_effect_table = {} -- Effects stored as Table
	
	gfx_effect_table = {
		[1]  = newAnimation(love.graphics.newImage( "Graphics/Effects/01Blast Blue.png"), 16, 16, .15, 6),
		[2]  = newAnimation(love.graphics.newImage( "Graphics/Effects/02Blast Gold.png"), 16, 16, .15, 6),
		[3]  = newAnimation(love.graphics.newImage( "Graphics/Effects/03Blast Green.png"), 16, 16, .15, 6),
		[4]  = newAnimation(love.graphics.newImage( "Graphics/Effects/04Blast Purple.png"), 16, 16, .15, 6),
		[5]  = newAnimation(love.graphics.newImage( "Graphics/Effects/05Blast Red.png"), 16, 16, .15, 6),
		[6]  = newAnimation(love.graphics.newImage( "Graphics/Effects/06Blast Silver.png"), 16, 16, .15, 6),
		[7]  = love.graphics.newImage( "Graphics/Effects/07Disable 1.png"),
		[8]  = love.graphics.newImage( "Graphics/Effects/08Disable 2.png"),
		[9]  = love.graphics.newImage( "Graphics/Effects/09Disable 3.png"),
		[10] = love.graphics.newImage( "Graphics/Effects/10Laser Blue.png"),
		[11] = love.graphics.newImage( "Graphics/Effects/11Laser Gold.png"),
		[12] = love.graphics.newImage( "Graphics/Effects/12Laser Green.png"),
		[13] = love.graphics.newImage( "Graphics/Effects/13Laser Purple.png"),
		[14] = love.graphics.newImage( "Graphics/Effects/14Laser Red.png"),
		[15] = love.graphics.newImage( "Graphics/Effects/15Missle L.png"),
		[16] = love.graphics.newImage( "Graphics/Effects/16Missle R.png")
					  }

end

function load_backgrounds()

	gfx_background_table = {} -- Backgounds stored as Table
	
	gfx_background_table = {
		[1] = love.graphics.newImage( "Graphics/Backgrounds/Background 01.png"),
		[2] = love.graphics.newImage( "Graphics/Backgrounds/Background 02.png"),
		[3] = love.graphics.newImage( "Graphics/Backgrounds/Background 03.png"),
		[4] = love.graphics.newImage( "Graphics/Backgrounds/Background 04.png"),
		[5] = love.graphics.newImage( "Graphics/Backgrounds/Background 05.png"),
		[6] = love.graphics.newImage( "Graphics/Backgrounds/Background 06.png"),
		[7] = love.graphics.newImage( "Graphics/Backgrounds/Background 07.png"),
		[8] = love.graphics.newImage( "Graphics/Backgrounds/Background 08.png"),
		[9] = love.graphics.newImage( "Graphics/Backgrounds/Background 09.png")
						  }

end

function load_huds()
	
	gfx_hud_table = {}
	
	gfx_hud_table = {
		[1] = love.graphics.newImage( "Graphics/Huds/HUD.png")		-- 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	
Thanks in advance (rewrote it from the original)

**EDIT**

I decided to use a different method for loading my graphics viewtopic.php?f=3&t=12338. Making use of this system should prove to use alot less typing. :oops:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests