TLbind 1.3 - professional controls made easy (now w/ mouse!)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
cattail
Citizen
Posts: 56
Joined: Mon Feb 13, 2012 4:11 pm

Re: TLbind - making professional control schemes easy

Post by cattail »

Hi, every one.
I like to play joystick, and I find the lib TLbind will be useful. But I can't download it from the official link.
The browser give me a error message "The connection to the server was reset while the page was loading."
I guess maybe I'm behind G_ F_W (super_big_firewall) something.
And search wiki and forum, I want to get it from smrq's demo .

But I seen the advice, must use TLbind v1.1

Can someone kind to put TLbind.lua(v1.1) in this forum like a .love demo?
(The most .love in the forum I can download them but old one(s) )

Or put it to github , post here a link? (That also can be download too)

Thanks a lot .
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: TLbind - making professional control schemes easy

Post by Nixola »

Here it is
Attachments
TLbind.lua
(3.36 KiB) Downloaded 319 times
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
cattail
Citizen
Posts: 56
Joined: Mon Feb 13, 2012 4:11 pm

Re: TLbind - making professional control schemes easy

Post by cattail »

by Nixola on Tue Feb 21, 2012 1:13 pm
Here it is
Thank you very much.
I have test it by smrq's demo, love2d V0.7.2 is ok
(Willbe)V0.8.0 (hg clone from bitbucket.org) is fail, but after modify main.lua (smrq's demo)
it will run almost ok , still has some place will be adjust.
The point is

Code: Select all

--change this line 
players[2].controlOptions, players[2].control = makeJoystickControls(0)  --  for love 0.7.x
--to
players[2].controlOptions, players[2].control = makeJoystickControls(1)  -- for  love 0.8
BTW:
That two place I have found TLbind.lua is v1.07 , but still good for my test
https://gist.github.com/1744602 ( smrq's demo , a good sample for joystick coding)

justas_tomkus 's code( TLbind.lua is the same: v1.07)
https://bitbucket.org/justas_tomkus/bit ... /downloads
gfreak
Prole
Posts: 29
Joined: Wed Jan 04, 2012 5:32 pm

Re: TLbind - making professional control schemes easy

Post by gfreak »

how to bind left mouse button?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: TLbind - making professional control schemes easy

Post by TechnoCat »

Wanted to give my thanks for making this.
It is sweet. And so easy to port to 0.8.0

I'd like to know if there is a way to go from action to key.

Code: Select all

print("Press " .. tlbind.controls.Bomb .. " to drop a bomb.")
would output

Code: Select all

>>Press X to drop a bomb.
(joystick)
or

Code: Select all

>>Press Space to drop a bomb.
(keyboard)

EDIT:
I wrote a quick table reverser and key parser. All is dandy. https://gist.github.com/1999019
MiniDemonic
Prole
Posts: 28
Joined: Tue Mar 20, 2012 10:39 am

Re: TLbind - making professional control schemes easy

Post by MiniDemonic »

Hey, how would I do to aim where I point the joystick?
Currently I'm doing this:

Code: Select all

shape:setRotation(math.atan2(player.control["VerticalAim"], player.control["HorisontalAim"]))
Which is working, but everytime I release the joystick the character is aiming towards the right instantly, also this code seems to produce "corners".
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: TLbind - making professional control schemes easy

Post by bartbes »

Well, when you release the joystick the angle becomes 0, which is to the right. You should probably check whether the values are not (close to) 0.
MiniDemonic
Prole
Posts: 28
Joined: Tue Mar 20, 2012 10:39 am

Re: TLbind - making professional control schemes easy

Post by MiniDemonic »

Thanks bartbes, that did fix the auto aiming to right thingy, also noticed that the "corner" problems was due to the TLbind.deadzone setting. Changed the deadzone to 0 and now it works good enough, although the aiming still got "corners" but they are barely noticeable.
gfreak
Prole
Posts: 29
Joined: Wed Jan 04, 2012 5:32 pm

Re: TLbind - making professional control schemes easy

Post by gfreak »

any plans to support multiple controls per button?

[' ']={"jump","airJump"} or (for joysticks)
[1]={"jump","airJump"}

and any plans to add left and right mouse button?

thanks!
kingslovelua
Citizen
Posts: 71
Joined: Mon Sep 26, 2011 7:16 pm

Re: TLbind - making professional control schemes easy

Post by kingslovelua »

Hi I'm trying to make a prototype shooter game , as my first project as I'm still learning programming in general. I found TLbind library on the love2d wiki and tried implementing it into my project but for some reason I can't get it to work for me if you find the time could you explain what i'm doing wrong in my project?


I was also trying to figure out how to use the love.joyStick but it it seems confusing does anyone here know how to use the love.joyStick api

this is how I tried using it but it was a no go for me

Code: Select all


if love.joystick.isDown( joystick, 1 ) then
       player.body:applyForce(10, 0.0)
	   print("moving right")
    elseif love.joystick.isDown( joystick, -1 ) then
        player.body:applyForce(-10, 0.0)
		print("moving left")
    end
    if love.joystick.isDown( joystick, 2 ) then
        player.body:applyForce(0, -500)
    elseif love.joystick.isDown( joystick, -2 ) then
       player.body:applyForce(0, 100)
    end	
	
	as I did with love.keyboard.isDown which worked 


 if love.keyboard.isDown("right") then
       player.body:applyForce(10, 0.0)
	   print("moving right")
    elseif love.keyboard.isDown("left") then
        player.body:applyForce(-10, 0.0)
		print("moving left")
    end
    if love.keyboard.isDown("up") then
        player.body:applyForce(0, -500)
    elseif love.keyboard.isDown("down") then
       player.body:applyForce(0, 100)
    end	
Attachments
player.love.zip
(5.33 KiB) Downloaded 277 times
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests