"Questions that don't deserve their own thread" thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
User avatar
unixfreak
Citizen
Posts: 82
Joined: Thu Oct 15, 2015 6:25 am
Location: Bristol, UK
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by unixfreak »

I have a question about keyboard shortcuts (desktop specific) and keybinds within a love application.

For instance in a shoot-em-up style game, the player will be holding the fire/shoot key most of the time. If the key to pause the game is "escape", and the key to shoot is "rctrl" (a common control setup)... when they pause the game and "rctrl is held down -- it causes the desktop/os specific shortcut to run. For me, using the KDE desktop, it launches the system task manager (ctrl+escape) and minimizes the game.

Is there a way to give priority to love with these sorts of keybinds, or to ignore the desktop keyboard shortcuts?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: "Questions that don't deserve their own thread" thread

Post by Nixola »

Yup, it slipped my mind ^^`
Edited, thanks
Unixfreak: I don't think there's a way.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by zorg »

Disable os-wide shortcuts, or remap them if the os allows you that, or remap the pause key to p or something if it doesn't.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
adge
Citizen
Posts: 54
Joined: Mon Dec 14, 2015 8:50 pm

Re: "Questions that don't deserve their own thread" thread

Post by adge »

Nixola wrote:Pairs doesn't have a defined order. If you need them to be printed in a specific order, use a sequence and ipairs. Two examples:

Code: Select all

--do this if you need textual indices in listy;
function love.load()
   listy = {first = 1, middle = 2, last = 3}
   order = {"first", "middle", "last"} 

   for i, v in ipairs(order) do
      print(v, listy[v]) 
   end
end


function love.update(dt)
end


function love.draw()
end

Code: Select all

--do this if you don't 
function love.load()
   listy = {1, 2, 3}

   for i, v in ipairs(listy) do
      print(i, v)
   end
end


function love.update(dt)
end


function love.draw()
end
Thank you! Thats it!
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: "Questions that don't deserve their own thread" thread

Post by murks »

murks wrote: I have a game idea that would require lots of small pieces flying around, but physics based or pseudo physics based. Can this also be achieved using a particle system or do I need to use an actual physics engine (or at least collisions and simplified physics) for each tiny thingy?
Any suggestions regarding that? I guess it boils down to the question whether a particle is just drawn or whether physics can be attached to it somehow.

If physics can only be attached to emitters then I guess I could use those, but it probably makes more sense to use a lot of tiny game objects than many emitters, each emitting only a few particles. Right?
I guess both approaches could work, but I guess the performance of 1000 emitters (with collision behaviour * 10 particles is worse than 10000 objects (with collision behaviour). Correct?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: "Questions that don't deserve their own thread" thread

Post by bobbyjones »

You most likely can not get the position of each individual particle so its probably not possible to add physics to them.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: "Questions that don't deserve their own thread" thread

Post by murks »

Thank you. It is something that concerns only a future game project, but how to do it comes up in my mind rather often. At the moment I think many small collision objects is the way to go.

A question concerning my current game (due end of February):
Imagine a top-down view, or slight perspective, and the scene full of coloured clouds (particle effects).
I want the player to only see the particle effects in the immediate vicinity of the player character. Ideally a fading circle would surround it in which the particle effects would be visible. Everything else should be visible all the time.

How to do it?
I imagine the emitters would be active all the time and blend modes could be used to this effect, but I have no experience using those. Or is something else like shaders needed?
User avatar
Tchey
Prole
Posts: 25
Joined: Sun Jan 10, 2016 10:44 am
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Tchey »

Hello,

How can i print a score on my screen ? I can print words, i can print data, but i can't find how to print both, in one line.

I want to print for example :

Score : #, where # is joueur.score
I only manage to print either
Score
or
#
but not
Score : #

Fine :

Code: Select all

 love.graphics.printf(joueur.score, 50, 50, 400, "left")

Code: Select all

 love.graphics.printf("Score : ", 50, 50, 400, "left")
OK but not so nice :

Code: Select all

love.graphics.printf("Score = ", 50, 50, 400, "left")
love.graphics.printf(joueur.score, 110, 50, 400, "left")
Broken :

Code: Select all

 love.graphics.printf("Score : "joueur.score, 50, 50, 400, "left")


Thanks, tell me if my question is unclear !
User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by aloisdeniel »

You want to print two consecutive texts on screen ?

You can simply concatenate your string :

Code: Select all

love.graphics.printf("Score = " .. joueur.score, 50, 50, 400, "left")
You also have more control with Text object (https://love2d.org/wiki/Text) which have methods for measuring the size of your text.
My LÖVE libraries : pixelatlas, pixelmap
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by zorg »

Two ways:

Code: Select all

love.graphics.print("aaaa" .. v .. " bbb ")
love.graphics.print(("aaaa%s bbb"):format(v))
first uses the lua concat operator ..
second uses a string, inside parentheses so we can call string.format on it this way; %s is where v will be substituted, as a string, one can use other specifiers like %d or %f or whatever, %% escapes the % character itself.
These work with both print and printf as well.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests