Search found 3 matches

by HarryCourt
Sun Sep 09, 2018 9:28 am
Forum: Support and Development
Topic: How to call a function from one script to main.lua
Replies: 3
Views: 2488

How to call a function from one script to main.lua

Hello everyone! Sorry if I am repeating a question, but I couldn't find anything. I have a function named item1 in a file named items.lua, and I want to get the item1 function from that script and run it in main.lua. Here is items.lua: items = {} centerX = love.graphics.getWidth() / 2 centerY = love...
by HarryCourt
Sun Sep 02, 2018 12:26 am
Forum: Support and Development
Topic: Best way to make multiple items?
Replies: 3
Views: 3587

Re: Best way to make multiple items?

Hi, welcome to the forums. You can use classes, or not, but either way, knowing how to organize your code in separate files is essential to keep it maintainable, otherwise as your projects grow, you end up with a huge main.lua where you can no longer find the stuff you need. (Edit: And Lua/LuaJIT h...
by HarryCourt
Sat Sep 01, 2018 3:13 am
Forum: Support and Development
Topic: Best way to make multiple items?
Replies: 3
Views: 3587

Best way to make multiple items?

Hello everyone! Newbie here! I am having an issue with my game. I want to have various items, such as a stick, glass bottle and rock. I have it planned out; Give it a sprite, then a health value and a ID. then whenever the player clicks on the screen, decrease the health value. If the health value r...