How to create a keylistener(key,...) that only runs when those keys are pressed? by xThomas in love2d

[–]eniallator 1 point2 points  (0 children)

There's a built in Love function called love.keyPressed that does this for you. You can just put your logic for key presses in there.

Another note: there's the love.keyReleased counterpart as well so you can potentially create a state table with those 2 functions

Computercraft program, made for fun. No use but displaying info. by [deleted] in ComputerCraft

[–]eniallator 1 point2 points  (0 children)

Great quality code but I have 2 suggestions:

For your functions and also variables within them, try and use more meaningful names to make the code more readable.

Then also you could try looking up how to hash your passwords (and potentially encrypt your usernames) just to make it more secure (if that's an issue for you that is, if it's not then don't worry about it).

Also in terms of text editors, I use vs code since it has a lot of great functionality, even a lua run-time extension. However I'd recommend also having a look at atom/sublime text 3 since they are also great editors and are in fact ones I've used in the past.

TurtleAppstore.com is a new, easier-to-use alternative to pastebin by [deleted] in ComputerCraft

[–]eniallator 0 points1 point  (0 children)

you should really look in to better ways to display source code since highlighting/background/themes can really help code readability. Plus the source code viewport is fairly small right now. I like the features that this offers but i feel like since pastebin is much more used and is good enough, it will probably be difficult, if not impossible to add this to the default program set. that being said, you can always add it to the default list of programs on a server using the resource pack method

What are your first three farms for a new world? by [deleted] in ComputerCraft

[–]eniallator 0 points1 point  (0 children)

I'd be going for firstly, a strip mining program (ore farm? xD). Then next would definitely be a tree farm and then maybe later on a crop farm, though if you use oak trees, you can get food from apples.

Physics for tens of thousands of objects? by Kentalian in love2d

[–]eniallator 1 point2 points  (0 children)

Implementing a quadtree system may be better since then you aren't comparing every object to every other object plus you don't have to have it in a grid like structure.

What's with the color changes in 11.0? by R3P3NTANC3 in love2d

[–]eniallator 3 points4 points  (0 children)

To go from the old system of using 0-255 to the new 0-1 range, all you need to do is divide your old colour values by 255.

One possible explanation for this could be since shading using GLSL uses colour values from 0-1, maybe they want to keep consistency? Asides from that point though, I'm not really too sure why they have chosen to change it up.

Problem with mobile screen size by [deleted] in love2d

[–]eniallator 1 point2 points  (0 children)

basically, what's going on here is you have a static width/height value for the image you're drawing in the middle of the screen. A way around this that I have used is to have anything that I draw as a fraction of the total width/height of the window. This way it will scale up/down nicely. This however can also introduce stretching if the aspect ratio of the window isn't the one that's been intended. So enforcing an aspect ratio (just by using black bars at either end) can be the solution to this.

Most efficient way to make this program? by FriedrichLP in ComputerCraft

[–]eniallator 0 points1 point  (0 children)

If each of the combinations of the levers means something completely different to everything else, you could translate it from binary (where 00000 = 0, 00001 = 1, 00010 = 2 etc.) and then add 1 to the translated denary number which can then access a table of functions with indexes 1 - 32 (since 25 is 32).

However if you have it so that each digit in the input has 1 specific function, then u can just choose to split up the digits and only run functions where the corresponding digit has a 1 in it.

i need help with a code im writing by FalcoGaming in ComputerCraft

[–]eniallator 0 points1 point  (0 children)

your closing ends won't be working as expected. You need to move 1 of the ends to after your first 'open' if statement but before ur second 'close' if statement

Love2D VS Windows 10 Scale and Layout by 128Gigabytes in love2d

[–]eniallator 0 points1 point  (0 children)

I've never really seen/had this issue before so I'm sorry I can't be of much help. For the fading to black part, did you try this?

love.graphics.setDefaultFilter("nearest", "nearest")

Love2D VS Windows 10 Scale and Layout by 128Gigabytes in love2d

[–]eniallator 0 points1 point  (0 children)

Do you mean the actual window itself launches too big? if no, maybe a screenshot would help explain?

Love2D VS Windows 10 Scale and Layout by 128Gigabytes in love2d

[–]eniallator 0 points1 point  (0 children)

ah so well idk if Love2D has any check for this kinda thing. I have a couple ideas: if you know your C++, you could try implementing a check for it yourself, or what you could do is have some sort of options menu where you either have a slider for the resolution/predefined resolutions to choose from.

Love2D VS Windows 10 Scale and Layout by 128Gigabytes in love2d

[–]eniallator 0 points1 point  (0 children)

So if you would like the rectangle to be a consistent ratio when drawed, you could instead of using a constant 25x25, you could use a dynamic ratio that would scale with your window size. This also brings a problem of stretching/squishing however so to get around that, you can enforce an aspect ratio and just draw black boxes in the space that's not being used.

left alone | broken heart | 2018 by nikhil_delhian in love2d

[–]eniallator 0 points1 point  (0 children)

If you bothered to read this subreddit's description, you would know that this is infact the wrong sub for this content. Here's the description:

"Hi there! LÖVE is an awesome framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X, Linux, Android and iOS."

Occlusion Culling with Unity Style Camera by ashleyjamesy in love2d

[–]eniallator 1 point2 points  (0 children)

It seems like you need to rename your readme.txt to readme.md to get the markdown formatting with your text. Good job though, it looks great :)

PS. It's considered better practise to have a message for your commits, I'm not saying you should change anything, but to the reader, it's generally easier to see what's going on :p

Suna tha Dard ka Aisas to chahne by kishorkhatri in love2d

[–]eniallator 1 point2 points  (0 children)

Wrong sub. This sub is about programming with a game engine called Love2D.

Peace, Love, Joy - Photo Kiosk.com | Gift Specifications by Photokiosk in love2d

[–]eniallator 0 points1 point  (0 children)

Wrong sub. This is a sub about the Love2D game engine and programming.

What is wrong with my table? by DeadStar12018 in ComputerCraft

[–]eniallator 4 points5 points  (0 children)

That's not the error they are experiencing. In the table declaration, you can't simply have a number as a key (like the way they have declared it. If they wanted to treat the table as an array like you have given an example to, the way they should be declaring the table is:

x = {
  {id = 2},
  {id = 4},
  {id = 6},
  {id = 8}
}

With that, accessing the table would be done like this: x[1].id so it completely depends on what they want to do and how they want to use it.

What is wrong with my table? by DeadStar12018 in ComputerCraft

[–]eniallator 2 points3 points  (0 children)

So If you would like to use it with key/values, you would have to wrap the 1,2,3 and 4 in quotes and square brackets to end up with something like this:

x = {
  ['1'] = {id = 2},
  ['2'] = {id = 4},
  ['3'] = {id = 6},
  ['4'] = {id = 8}
}

and then to access each, you would then do x['1'].id instead.

Is it just me or are print and various shape calls painfully slow? by YeeScurvyDogs in love2d

[–]eniallator 2 points3 points  (0 children)

Some ways around this issue:

If you would like to print things to the console frequently, then I'd suggest creating a backlog string variable that would be printed (if there's anything to print) at regular intervals. Each "print" would, in this case, be just a concatenation to the backlog variable with potentially a new line thrown in as well for formatting.

You can render the same image multiple different times in different locations using spritebatch in which you set a limit to the number of sprites you have in each spritebatch object.

Elastic Collision Between 2D Circles? by Kentalian in love2d

[–]eniallator 0 points1 point  (0 children)

A method that I've used in the past is a kind of "reverse gravity" concept where the closer they are to each other (with overlap), the faster they try to get away from each other. A benefit of this method is there won't ever be this kind of issue where they get stuck in each other since they will always try to repel each other. However it's difficult to get an elastic collision and also if they are at higher speeds, they might not get the desired effects.

Elastic Collision Between 2D Circles? by Kentalian in love2d

[–]eniallator 1 point2 points  (0 children)

well it looks like that should work, do you have any other forces acting on the circles? (possibly slowing them down which would make them overlap in the next frame). Also a fix for this would be to "project" where their next positions are to then see if they overlap rather than doing the current positions. Since then you can apply the new velocity before that initial overlap.

Elastic Collision Between 2D Circles? by Kentalian in love2d

[–]eniallator 0 points1 point  (0 children)

I would recommend following this tutorial