Wiki Requests
Re: Wiki Requests
Perhaps a tutorial on proper usage of multiple .lua files would be nice. All my knowledge comes from trial and error, and asking people on the forums here, and every once in a while I notice large gaps in my knowledge
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Wiki Requests
It's basically do whatever you want, all there is is convention and personal preference. Lua itself doesn't care where you define your functions or your classes.T-Bone wrote:Perhaps a tutorial on proper usage of multiple .lua files would be nice. All my knowledge comes from trial and error, and asking people on the forums here, and every once in a while I notice large gaps in my knowledge
Re: Wiki Requests
I think a good system for both newbies and experienced users would be a sort of request system.
Users who think they are 100% proficient in a subject can put their name in one of the sections. When users hit a "request example" button, the experienced user will get an email or something saying that so-and-so has requested an example for this section. If nobody has applied for one section, if something is requested then all experienced users will get the email.
With this system, newbies can get the examples they need, and experienced members don't have to make an example for every section right off the bat.
Just an idea ;D
Users who think they are 100% proficient in a subject can put their name in one of the sections. When users hit a "request example" button, the experienced user will get an email or something saying that so-and-so has requested an example for this section. If nobody has applied for one section, if something is requested then all experienced users will get the email.
With this system, newbies can get the examples they need, and experienced members don't have to make an example for every section right off the bat.
Just an idea ;D
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Wiki Requests
Request: joystick examples.
Here is the joystick class from my game Kurosuke:
It pains me to post such inelegant code. Does anyone have some good code that they could put up as examples on the wiki?
Here is the joystick class from my game Kurosuke:
Code: Select all
joystick = class:new()
function joystick:init()
self.pressed = {}
self.password = 1
end
function joystick:update(dt)
self.password = (self.password % 2) + 1 -- change the password each update, for use in cleaning
for j=0, love.joystick.getNumJoysticks() do
for h=0, love.joystick.getNumHats(j) do
local direction = love.joystick.getHat(j, h)
if direction ~= "" and direction ~= "c" then
local key = "j"..j.."_h"..h.."_d"..direction
self:check(key)
end
end
for a=0, love.joystick.getNumAxes(j) do
local direction = love.joystick.getAxis(j, a)
if direction > .5 or direction < -.5 then
direction = round(direction) -- to keep it even between sticks and buttons
local key = "j"..j.."_a"..a.."_d"..direction
self:check(key)
end
end
end
for key, value in pairs(self.pressed) do -- clean out hats that aren't being pressed any more
if self.pressed[key] ~= self.password then
self.pressed[key] = nil
end
end
end
function joystick:check(key)
if self.pressed[key] == nil then
scene:keypressed(key)
end
self.pressed[key] = self.password
end
Kurosuke needs beta testers
Re: Wiki Requests
Imho if you want to handle Input correctly, then you should keep it more abstract, ie. handle keyboard, mouse and gamepad input in one separate class which can be accessed independently from you main loop/input function. Something like if InputManager:isActionButtonPressed() then and so on.tentus wrote:It pains me to post such inelegant code. Does anyone have some good code that they could put up as examples on the wiki?
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Wiki Requests
Input is handled based on which scene (gamestate) you're in. For example, the character select screen has a very different set of bindings than the main game, which is very different from the nogame screen. Within the scenes some of the input is passed on to specific objects based on relevance (for example, if a key or joystick is bound to a player control, the input is passed onto that player object).XQYZ wrote:Imho if you want to handle Input correctly, then you should keep it more abstract, ie. handle keyboard, mouse and gamepad input in one separate class which can be accessed independently from you main loop/input function. Something like if InputManager:isActionButtonPressed() then and so on.tentus wrote:It pains me to post such inelegant code. Does anyone have some good code that they could put up as examples on the wiki?
Kurosuke needs beta testers
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Wiki Requests
Question: What is the proper way to note that a function is getting renamed? I'm thinking specifically about threads, since send will become set and receive will become get in 0.8.0.
Kurosuke needs beta testers
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Wiki Requests
Using the oldin template in the old one and the newin in the new one.
Another option might be moving the page to the new one, leaving a link in place then list both (with oldin and newin).
Another option might be moving the page to the new one, leaving a link in place then list both (with oldin and newin).
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Wiki Requests
Hello, thread necromancy, how have you been?
Since I noticed that love.update had no examples, I've been going through some of the more commonly used functions on the wiki and adding more practical examples (not just the function being called, but it being called in a quasi-useful way). I've also been adding more See Also links, such as love.mouse.isVisible to love.mouse.setVisible.
My point is, if anyone wants to pitch in, please do. My example-writing skills are pretty poor, and there are plenty of functions I've never even used (love.thread, I'm not looking at you). Having some more experienced Lovers than me working on the wiki would be a good thing.
Since I noticed that love.update had no examples, I've been going through some of the more commonly used functions on the wiki and adding more practical examples (not just the function being called, but it being called in a quasi-useful way). I've also been adding more See Also links, such as love.mouse.isVisible to love.mouse.setVisible.
My point is, if anyone wants to pitch in, please do. My example-writing skills are pretty poor, and there are plenty of functions I've never even used (love.thread, I'm not looking at you). Having some more experienced Lovers than me working on the wiki would be a good thing.
Kurosuke needs beta testers
Who is online
Users browsing this forum: Google [Bot] and 7 guests