Search found 417 matches

by darkfrei
Thu Sep 30, 2021 12:10 pm
Forum: Support and Development
Topic: Love2d game questions
Replies: 4
Views: 1322

Re: Love2d game questions

1) How to finalize my title screen: I have made a screen display on the start it looks good I have a play button but the button does not work. You are need to check it the player clicks the button: function is_in_area (mx, my, x, y, w, h) -- mouse position and rectangle if (mx > x) and (mx < (x + w...
by darkfrei
Mon Sep 27, 2021 8:02 am
Forum: General
Topic: love.timer.sleep resolution test
Replies: 15
Views: 4024

Re: love.timer.sleep resolution test

I have doubts about the use of love.timer.sleep(0.001) in the default love.run, especially after reading this . The uncertainty is killing me, but I don't have an up-to-date Windows installation to verify this, so I would like to ask you guys to run this small test and report your results and your ...
by darkfrei
Sun Sep 26, 2021 9:27 pm
Forum: Libraries and Tools
Topic: love-steam - Steamworks integration for LÖVE
Replies: 9
Views: 14695

Re: love-steam - Steamworks integration for LÖVE

Btw. there is also a project called lua-steam and they provide already precompiled binaries: https://github.com/uspgamedev/luasteam Thanks! Could you please explain how to make steam stats, achievements and leaderboards? For example with as-small-as-possible-example. For example stats: "stat_1...
by darkfrei
Sun Sep 26, 2021 12:45 pm
Forum: Support and Development
Topic: Building with my own LuaJIT
Replies: 3
Views: 1775

Re: Building with my own LuaJIT

Not sure bur maybe the replacing of lua51.dll
by darkfrei
Mon Sep 20, 2021 2:20 pm
Forum: Support and Development
Topic: [Fixed] Simple sine/radians problem - I think
Replies: 5
Views: 2406

Re: [Fixed] Simple sine/radians problem - I think

pgimeno wrote: Mon Sep 20, 2021 1:31 pm That's more like engine power anyway, not speed, since it applies to the force. Naming the variables appropriately can protect you from some bugs.
It can be something like specific impulse, that is like-a-speed and has unit as m/s (or just in seconds in other notation).
by darkfrei
Sun Sep 19, 2021 4:05 pm
Forum: Games and Creations
Topic: Railway Track
Replies: 7
Views: 3626

Re: Railway Track

You can always add another canvas for order and instead of painting you can erase pixels too. A quick hack in of my approach: main.lua.zip Nice! Didn't know that you can erase by writing with the color {0,0,0,0} with color replacing. -- new canvas tmp = love.graphics.newCanvas() love.graphics.setCa...
by darkfrei
Sun Sep 19, 2021 10:19 am
Forum: Games and Creations
Topic: Railway Track
Replies: 7
Views: 3626

Re: Railway Track

Is it necessary to get this offset? You could just draw two lines of different width on top of each other i would say. For the ties it is also possible to draw them short and thick, may be faster. This would have been a use case for stipple lines, but that setting was removed. But rails must be abo...
by darkfrei
Sat Sep 18, 2021 8:59 pm
Forum: Games and Creations
Topic: Railway Track
Replies: 7
Views: 3626

Railway Track

Hi all! There is my try to make railway track, where it's path is defined as love.graphics's line. Used functions: Get offset polyline - the right and left rails are just the same line as defined, but with offset :) Get Points Along Line - every tie must be on the same distance, but the defined poly...
by darkfrei
Sat Sep 18, 2021 11:25 am
Forum: Support and Development
Topic: [SOLVED] Math: Shortest distance from point to line (EDITED)
Replies: 18
Views: 6923

Re: [SOLVED] Math: Shortest distance from point to line (EDITED)

So, if the drawn line has different colors along the it's length, we can set to every point in window the color of the nearest sector of this line: The gradient function: function get_red_blue_gradient_color (t) -- t is between 0 as red to 1 as blue local r = 2-4*t local g = t < 1/2 and 4*t or 4-4*t...
by darkfrei
Fri Sep 17, 2021 11:16 pm
Forum: Support and Development
Topic: [SOLVED] Math: Shortest distance from point to line (EDITED)
Replies: 18
Views: 6923

Re: [SOLVED] Math: Shortest distance from point to line (EDITED)

I've googled it a lot of times, my solution: local function distPointToLine(px,py,x1,y1,x2,y2) -- point, start and end of the segment local dx,dy = x2-x1,y2-y1 local length = math.sqrt(dx*dx+dy*dy) dx,dy = dx/length,dy/length local p = dx*(px-x1)+dy*(py-y1) if p < 0 then dx,dy = px-x1,py-y1 return m...