I started a clone of oregon trail to familiar myself with love. I have not gotten very far. It takes an hour+ for each screen. trail_setup_screen_three took the longest, several hours just adding the switcher between questions. There are unused/redundant variables everywhere, I don't consistently use what I do have, often I'll do things two different ways as I get more familiar with LOVE2d, etc.. At first I thought it'd be best to just finish the game and then figure out what I can do better afterward but i am wasting so much time on menus that I will ask for advice
Here is the full code so far. 743 lines long
https://pastebin.com/Ap5Vdkxe
How can I get better at programming menus, textinput, keypressed, and other ui stuff?
- BruceTheGoose
- Citizen
- Posts: 76
- Joined: Sat Sep 20, 2014 2:54 pm
Re: How can I get better at programming menus, textinput, keypressed, and other ui stuff?
I would start by separating the contents of that file into different separate files. Very hard to read.
The way I would structure a menu (for example) would look like this:
The way I would structure a menu (for example) would look like this:
Code: Select all
-- Menu.lua
Menu = {}
Menu.load = function(self)
-- Load anything that will be in this menu
end
Menu.update = function(self,dt)
-- Update anything that will be in this menu
end
Menu.draw = function(self)
-- Draw anything that will be in this menu
end
-- main.lua
function love.load()
require("Menu")
Menu:load()
end
function love.update(dt)
Menu:update(dt)
end
function love.draw()
Menu:draw()
end
"I don't know."
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest