Page 1 of 1

[Solved] Need Help Loading Images

Posted: Mon May 18, 2015 7:05 am
by .InsertNameHere
Hello, I am quite new to both Love and Lua, and I am trying to make a little game. In this game, I tried to load the scope image from the assets folder, and I want it so that the black parts of the scope cover up everything else in the image. This way, the player has to "hunt" around for their target. Right now, even though the .png is completely black, when loaded onto the game, the scope is partially see-through.

What am I doing wrong?

NOTE: I am using someone else's menu library (w/minor changes), and my Multiplayer is not done yet, I am still working on singleplayer.

Love file is attached.

Thanks in advance.

Re: Need Help Loading Images

Posted: Mon May 18, 2015 9:31 am
by Guard13007
I didn't look for very long, but I guessed correctly from the start what your problem is. Somewhere the color of the game is being set with transparency. Take a look at love.graphics.setColor to see. The quick and dirty solution is as follows in your main.lua:

Image

BUT that is a quick fix which could lead to future bugs.

Like I said, I didn't look at everything in your game for very long, but I'm guessing you'll find a call to love.graphics.setColor somewhere in the menu.lua 's code. This call has a transparency value, and then everything after that point is drawn with some transparency.

Re: Need Help Loading Images

Posted: Mon May 18, 2015 1:57 pm
by .InsertNameHere
Thank You!

Re: Need Help Loading Images

Posted: Mon May 18, 2015 3:15 pm
by Guard13007
No problem. ^^ Just glad to actually be able to help someone instead of just asking for help.

(On an unrelated note, perhaps edit the thread title to include [Solved] so people know the issue has been resolved?)

Re: Need Help Loading Images

Posted: Mon May 18, 2015 4:27 pm
by Robin
BTW:

1. [wiki]love.draw[/wiki] doesn't take dt as an argument
2. You don't need to call love.graphics.clear() yourself. It's already called in the default [wiki]love.run[/wiki].