Page 2 of 2

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 5:10 pm
by WolfNinja2
Took out that function and just called the table at the top of the file. It gives me the same exact error. Code now.

Is there any big reason to update to 0.9.0? I just didn't see a reason too...

menu.lua

Code: Select all

buttons = {}
--
buttons["Start"] = {x = 250, y = 350, width = 100, height = 50, pic = img_btnStart, picClick = img_btnStart_click, click = false, state = 0}
--
function DRAW_MENU()
	for k,v in pairs(buttons) do
		g.draw(v.pic, v.x, v.y)
	end
end
--
function UPDATE_MENU(dt)
	
end
main.lua

Code: Select all

require "player"
require "bullet"
require "enemy"
require "menu"
require "powerups"
--
function love.load()
	
	--GLOBAL VARIABLES
	g = love.graphics
	ScreenWidth = g.getWidth()
	ScreenHeight = g.getHeight()
	gameTime = love.timer.getTime()
	mouse_x = love.mouse.getX()
	mouse_y = love.mouse.getY()
	killCount = 0

	--LOADING LIBRARIES
	LOAD_PLAYER()
	LOAD_BULLET()
	LOAD_ENEMY()
	LOAD_POWERUPS()

	--LOADING IMAGES
	bg = g.newImage("Resources/Pictures/background.png")
	
	img_enemy = g.newImage("Resources/Pictures/enemy.png")
	
	img_btnStart = g.newImage("Resources/Pictures/button_start-1.png")
	img_btnStart_click = g.newImage("Resources/Pictures/button_start-2.png")

	img_bullet = g.newImage("Resources/Pictures/bullet.png")
	img_bulletLeft = g.newImage("Resources/Pictures/bulletLeft.png")
	img_bulletRight = g.newImage("Resources/Pictures/bulletRight.png")
	img_bulletDown = g.newImage("Resources/Pictures/bulletDown.png")

	img_healthPickup = g.newImage("Resources/Pictures/healthPickup.png")

	--Gamestates --- 0:Menu -1:In-Game
	gamestate = 0
end
--
function love.keypressed(key)
	player.shoot(key)
end
--
function love.update(dt)
	if gamestate == -1 then
		if player.alive then
			UPDATE_PLAYER(dt)
			UPDATE_BULLET(dt)
			UPDATE_ENEMY(dt)
			UPDATE_POWERUPS(dt)
		end
	elseif gamestate == 0 then
		UPDATE_MENU(dt)
	end
end
--
function love.draw()
	if gamestate == -1 then
		g.setColor(255, 255, 255 ,255)
		g.draw(bg, 0, 0)
		DRAW_PLAYER()
		DRAW_POWERUPS()
		DRAW_BULLET()
		DRAW_ENEMY()
		if player.alive == false then
			GAME_OVER()
		end
	elseif gamestate == 0 then
		DRAW_MENU()
	end
end

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 5:14 pm
by jjmafiae
It's faster, less bugs and much more, I don't see a reason not to upgrade.

another reason is that love-android isn't ported to 0.8.0 but only to 0.9.0

It takes less than 5 minutes to port a small game to 0.9.0

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 5:20 pm
by WolfNinja2
Still, I don't need any of that. Maybe someday but for this little project I'm doing 0.8.0.

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 5:24 pm
by jjmafiae
dude, goto the front page download the installer and change 5 lines of code and BOOOOOM 0.9.0!!!!

The performance improvement is noticeable, trust me.

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 5:29 pm
by veethree
In love.load, just move the loading libraries section below the loading images section.

As for 0.9.0, It's definitely worth updating, For now i think most of us still have 0.8.0 installed, But after some time i bet most of us wont, So if you post your 0.8.0 .loves asking for help we'll have to re-download it to be able to help, Or just not help at all.

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 6:14 pm
by jjmafiae
i migrated to 0.9.0 over 6 months ago, It's amazing.

[]

Posted: Sat Jan 18, 2014 6:29 pm
by bekey
-snip-

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 7:54 pm
by WolfNinja2
veethree : thanks. others : lolidk

Re: Drawing a image from a for loop?

Posted: Sat Jan 18, 2014 9:08 pm
by Roland_Yonaba
WolfNinja2 wrote:Still, I don't need any of that. Maybe someday but for this little project I'm doing 0.8.0.
0.8.0 is still relevant, and is working fine.
0.9.0 fixes some stuff, and provides better performance.
You have the choice, do not ask to people to convince you to move to 0.9.0, just do what you want to do, and use the version you are comfortable with.
Side note, new concepts have been integrated into 0.9.0. If you feel like you need to master those concepts, then you can start using 0.9.0. Maybe not for some on-going project, but to write small demos for yourself.