Page 4 of 5
Re: Inventory help in an RPG game
Posted: Mon Oct 21, 2013 3:49 pm
by Azhukar
Pigeon wrote:Basically, where am I gonna put all of that code. That's what I want to know. Enough with me de-railing a thread I made.
Where do I put all of the code?
It wont help you if you don't know where to put it.
Pigeon wrote:I can't help the issues I have with my head. That's why when you said 'it might be all in your head' it really hurt me basically, because I have a severe anger disorder. So yeah. I am sorry, but I might not be in the next post, then I will be in the next. It is in my head, but I can't help it. Just don't openly abuse people anymore. It is probably just me who gives two shits. Now I'm sorry but I don't understand the code, because it has yet to have worked.
Your head is you. They are not 2 separate entities. If you are aggressive, then that's how you are. You control what you write, you choose to write letter after letter.
Anger is not a disorder.
Re: Inventory help in an RPG game
Posted: Mon Oct 21, 2013 4:58 pm
by Davidobot
Azhukar wrote:Pigeon wrote:Basically, where am I gonna put all of that code. That's what I want to know. Enough with me de-railing a thread I made.
Where do I put all of the code?
It wont help you if you don't know where to put it.
You need to put the code in main.lua
And load all the variables in love.load.
Azhukar wrote:
Pigeon wrote:I can't help the issues I have with my head. That's why when you said 'it might be all in your head' it really hurt me basically, because I have a severe anger disorder. So yeah. I am sorry, but I might not be in the next post, then I will be in the next. It is in my head, but I can't help it. Just don't openly abuse people anymore. It is probably just me who gives two shits. Now I'm sorry but I don't understand the code, because it has yet to have worked.
Your head is you. They are not 2 separate entities. If you are aggressive, then that's how you are. You control what you write, you choose to write letter after letter.
Anger is not a disorder.
Well, ever heard of the term Anger Issues? Well, that is referring to an anger disorder, when a person is very proven to getting angry. Sorry Pigeon, Azhukar should think before posting.
Re: Inventory help in an RPG game
Posted: Mon Oct 21, 2013 5:07 pm
by Azhukar
Davidobot wrote:Well, ever heard of the term Anger Issues? Well, that is referring to an anger disorder, when a person is very proven to getting angry. Sorry Pigeon, Azhukar should think before posting.
Sorry I have a disorder that causes me to point out when someone is making excuses to act like an ass. Like when he said he has anger issues that are not his fault. Oops there I go again, sorry not my fault can't help it!
It's not my fault, it's a mental disorder that I have no control over.
/sarcasm
Re: Inventory help in an RPG game
Posted: Mon Oct 21, 2013 5:21 pm
by Davidobot
Azhukar wrote:Davidobot wrote:Well, ever heard of the term Anger Issues? Well, that is referring to an anger disorder, when a person is very proven to getting angry. Sorry Pigeon, Azhukar should think before posting.
Sorry I have a disorder that causes me to point out when someone is making excuses to act like an ass. Like when he said he has anger issues that are not his fault. Oops there I go again, sorry not my fault can't help it!
It's not my fault, it's a mental disorder that I have no control over.
/sarcasm
Do you want to make people feel bad?
Also: You can enable console in conf.lua, I think it is t.console = true or t.modules.console = true.
Re: Inventory help in an RPG game
Posted: Mon Oct 21, 2013 5:30 pm
by jjmafiae
Everybody calm down we are all in danger now, some mod will come here and give us all board issue warnings, Pigeon instead of asking for help then you should learn lua and try to experiment some more.
---End of Thread---
Re: Inventory help in an RPG game
Posted: Tue Oct 22, 2013 4:29 am
by Davidobot
I took the liberty of putting Azhukar code into a .love file:
Re: Inventory help in an RPG game
Posted: Tue Oct 22, 2013 7:36 am
by Pigeon
Davidobot wrote:I took the liberty of putting Azhukar code into a .love file:
Thank you so much Davidobot for telling me where to put it. And thanks to Azhukar for the code! Sorry about my Issues, but I hope to get some form of counselling soon! Thank you all a lot!
Re: Inventory help in an RPG game
Posted: Thu Oct 24, 2013 11:18 pm
by Gravy
Here's a link to a drag and drop RPG inventory I made a while back. It's not quite finished, but it demonstrates how something like this can be done.
http://love2d.org/forums/viewtopic.php? ... 54&p=62510
Re: Inventory help in an RPG game
Posted: Sun Oct 22, 2017 8:20 am
by GameDummy
Davidobot wrote: ↑Tue Oct 22, 2013 4:29 am
I took the liberty of putting Azhukar code into a .love file:
Thank you for that, but can you guys tell me a way to draw this on the actual game screen ? İ have been struggling with that for quite a while now.
Re: Inventory help in an RPG game
Posted: Mon Oct 23, 2017 2:01 pm
by Azhukar
GameDummy wrote: ↑Sun Oct 22, 2017 8:20 amThank you for that, but can you guys tell me a way to draw this on the actual game screen ?
Code: Select all
local myInventory = {food = 10,sword = 4,coin = 50,axe = 2,shield = 1,armor = 40}
local function drawItem(item,itemWidth,itemHeight)
if (item == "food") then
love.graphics.setColor(0,128,0,255)
elseif (item == "coin") then
love.graphics.setColor(0,128,128,255)
else
love.graphics.setColor(128,0,0,255)
end
love.graphics.rectangle("fill",0,0,itemWidth,itemHeight)
end
local function drawInventory(inventory,itemWidth,itemHeight,itemSpacing,horizontalSlots)
local slot_x,slot_y = 0,0
for item,amount in pairs(myInventory) do
local x,y = slot_x*(itemWidth+itemSpacing),slot_y*(itemHeight+itemSpacing)
love.graphics.push()
love.graphics.translate(x,y)
drawItem(item,itemWidth,itemHeight)
love.graphics.pop()
love.graphics.setColor(255,255,255,255)
love.graphics.print(item.."\n"..amount.."x",x,y)
slot_x = slot_x + 1
if (slot_x >= horizontalSlots) then
slot_x = 0
slot_y = slot_y + 1
end
end
end
function love.draw()
drawInventory(myInventory,50,50,4,3)
end