This is my first post, sadly it must be one asking for help.... Anyway, my problem is that clicking the "New Game" button on the menu causes a problem with loading the background. I don't see a problem, as I defined the background correctly (background = love.graphics.newImage("<filename.extension>"), and called it correctly (to my knowledge) with:
function love.draw()
love.graphics.draw(background)
love.graphics.draw(Llama, x, y)
end
end
I would appreciate help, thanks in advance.
Fixing An Incorrectly Coded Drawing Function
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Fixing An Incorrectly Coded Drawing Function
- Attachments
-
- TestMenu.love
- Here is the .LOVE file.
- (8.22 MiB) Downloaded 243 times
Re: Fixing An Incorrectly Coded Drawing Function
Hello and welcome! I very new myself but I took the liberty to look through your code. There is no problem with your draw function but it appears to break when your on-click event leads to the function TITLE.newGame(button) which is already running. Maybe if you change the on-click, you will fix the issues.
Re: Fixing An Incorrectly Coded Drawing Function
I couldn't exactly grasp what you were trying to say, but I moved the TITLE.newGame block to below the block that defines it as a variable. I also changed some variables and such, but doing that made it so the song plays, but the background and player character aren't drawn at all. It just stays at the main menu whilst playing the audio.
Re: Fixing An Incorrectly Coded Drawing Function
Could you post the current state of the project? Would like to have another look at it for you.
Re: Fixing An Incorrectly Coded Drawing Function
Sure, here it is:
- Attachments
-
- TestMenu2.love
- (7.79 MiB) Downloaded 255 times
Re: Fixing An Incorrectly Coded Drawing Function
I looked at the OP, so I don't know if anything changed but:
I think that should fix it?
Code: Select all
function love.draw()
love.graphics.draw(background, 0, 0)
love.graphics.draw(Llama, x, y)
end
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Fixing An Incorrectly Coded Drawing Function
The X and Y coordinates default to 0, so that is equal.Davidobot wrote: I think that should fix it?
Re: Fixing An Incorrectly Coded Drawing Function
Well, his Load callback was in another function so the extra 'end' was not the problem.Davidobot wrote:I looked at the OP, so I don't know if anything changed but:I think that should fix it?Code: Select all
function love.draw() love.graphics.draw(background, 0, 0) love.graphics.draw(Llama, x, y) end
Re: Fixing An Incorrectly Coded Drawing Function
I am driving on a large road trip, so my replies have been scarce... But, I tried using the code Davidobot sent (even though it seems redundant) and it caused no difference whatsoever. I still haven't found the source of the problem still, however.
Re: Fixing An Incorrectly Coded Drawing Function
My coding style is very different from yours, so I might have not understood your code, but you can't have multiple love.loads, love.updates and love.draw.Rehnrald wrote:I am driving on a large road trip, so my replies have been scarce... But, I tried using the code Davidobot sent (even though it seems redundant) and it caused no difference whatsoever. I still haven't found the source of the problem still, however.
Here is the fixed .love: https://dl.dropboxusercontent.com/u/354 ... Menu2.love
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Who is online
Users browsing this forum: No registered users and 8 guests