Page 3 of 6

Re: Camera

Posted: Thu Jun 01, 2017 3:46 pm
by yetneverdone
KyleFlores1014 wrote: Thu Jun 01, 2017 6:08 am I rewrote my code but now i cant add the on screen controls like before. because of the local ={}
Please send the code so that i can see whats the error

Re: Camera

Posted: Fri Jun 02, 2017 10:20 am
by KyleFlores1014
nevermind that error i fixed it but i made 2 fonts but when i try to make a new one it makes an error

Re: Camera

Posted: Fri Jun 02, 2017 1:14 pm
by yetneverdone
KyleFlores1014 wrote: Fri Jun 02, 2017 10:20 am nevermind that error i fixed it but i made 2 fonts but when i try to make a new one it makes an error
Use fontName = love.graphics.newFont("pathToFont")

Re: Camera

Posted: Fri Jun 02, 2017 2:09 pm
by KyleFlores1014
Thats the code i use but when I apply it using love.graphics.setFont(font) it makes an error but i already made 2 fonts the same way

Re: Camera

Posted: Fri Jun 02, 2017 2:26 pm
by yetneverdone
KyleFlores1014 wrote: Fri Jun 02, 2017 2:09 pm Thats the code i use but when I apply it using love.graphics.setFont(font) it makes an error but i already made 2 fonts the same way
Always post the error you get. We can't guess whats the problem.

Re: Camera

Posted: Sat Jun 03, 2017 5:20 am
by KyleFlores1014
game.love
(505.34 KiB) Downloaded 178 times
Here is my code sorry if i didnt implement the switch function i dont get it

Re: Camera

Posted: Sat Jun 03, 2017 6:36 am
by yetneverdone
KyleFlores1014 wrote: Sat Jun 03, 2017 5:20 am game.love Here is my code sorry if i didnt implement the switch function i dont get it
As ive commented and explained in the template, the switch function is necessary. Because love.load is only run once, so if you change your gamestate, that new gamestate's load function will not be called. Therefore, you will get a lot of errors.

I will check your code later

Re: Camera

Posted: Sat Jun 03, 2017 9:27 am
by KyleFlores1014
Oh ok but the switch state, state = newState its gonna switch the state but wont that cause an error?

Re: Camera

Posted: Sat Jun 03, 2017 9:32 am
by yetneverdone
Ofcourse not, thats why before we actually switch to the new state, we call the current state's exit function (useful for a lot of stuffs, but if you don't need it, just let it be). Then switch the state, then call the new state's load function

Re: Camera

Posted: Sat Jun 03, 2017 9:43 am
by KyleFlores1014
game.love
(505.4 KiB) Downloaded 175 times
here is the code i already wrote the switch function but it still makes an error because of the font when you click about