Search found 559 matches

by MrFariator
Sun Dec 22, 2024 6:21 am
Forum: General
Topic: good OOP libraries?
Replies: 3
Views: 393

Re: good OOP libraries?

Perhaps middleclass might suit your needs. It also has a companion library, stateful , for implementing state machines. For other implementations, check awesome-love2d repo and take your pick. This is the second time I've linked you the repo, I believe. As for the self bit, the only thing you'll hav...
by MrFariator
Tue Dec 10, 2024 12:56 am
Forum: Support and Development
Topic: How to change screenspace origin?
Replies: 14
Views: 2570

Re: How to change screenspace origin?

If you know you are going to be drawing an area of specific size, with an arbitrary zoom, with a moving camera, you can do something like (very crude example): local zoom = 1 local posX = 0 local posY = 0 function love.update ( dt ) if love.keyboard.isDown("z") then zoom = math.min ( zoom ...
by MrFariator
Sun Dec 08, 2024 10:22 pm
Forum: Support and Development
Topic: How to change screenspace origin?
Replies: 14
Views: 2570

Re: How to change screenspace origin?

The origin point (0,0) in löve's API is the top-left corner, with the coordinates incrementing when going towards down-right. This applies to the screen space coordinates, as well as drawing operations involving things like quads or images (at least, can't think of an example where this isn't the ca...
by MrFariator
Sat Dec 07, 2024 11:40 am
Forum: Support and Development
Topic: All Enemies are deleted when one dies
Replies: 8
Views: 1516

Re: All Enemies are deleted when one dies

Looks like you've got a bit of a fundamental misunderstanding regarding the "self" keyword and instances of your enemy class. Lets run through this example: local myTable = { x = 0 } function myTable:myFunction ( ) -- just increment table's x value self.x = self.x + 1 -- self is inferred f...
by MrFariator
Sat Dec 07, 2024 7:32 am
Forum: Support and Development
Topic: All Enemies are deleted when one dies
Replies: 8
Views: 1516

Re: All Enemies are deleted when one dies

In your posted code, the enemy takeDamage function makes every enemy instance take damage at once, so that's likely your issue.
by MrFariator
Thu Dec 05, 2024 7:53 am
Forum: General
Topic: Is my approach for keypressed menu suitable.
Replies: 9
Views: 1773

Re: Is my approach for keypressed menu suitable.

The thing about different approaches to structuring your code is that you don't need to exclusively subscribe to OOP, procedural, data driven practices or the like. At the end of the day, they simply describe how to possibly structure your code to tackle specific problems, and each of them can have ...
by MrFariator
Wed Dec 04, 2024 1:31 pm
Forum: General
Topic: Is my approach for keypressed menu suitable.
Replies: 9
Views: 1773

Re: Is my approach for keypressed menu suitable.

To explain, I don't like to tell a bullet x to move itself at xSpeed. I prefer to tell the bullet manager to move bullet x at xSpeed. Unsure if you're familiar with the concept, but you should perhaps look into ECS, or data driven programming in general. These are pretty popular concepts in game de...
by MrFariator
Tue Dec 03, 2024 12:08 pm
Forum: General
Topic: Is my approach for keypressed menu suitable.
Replies: 9
Views: 1773

Re: Is my approach for keypressed menu suitable.

While something like this works for a small number potential scenes or states, it is not exactly scalable. With every added scene, submenu or thing you'll be creating an ever bigger and bigger if-else tree, which can become rather error prone and hard to maintain or read. What you could look into is...
by MrFariator
Sun Dec 01, 2024 5:18 pm
Forum: Support and Development
Topic: encrypted save
Replies: 6
Views: 1376

Re: encrypted save

You can do some simple obfusctation on save files, sure. It could even be as simple as just taking the table tracking your save data, and dumping it into a file with a serializer like bitser ( awesome-love2d repo has a few other options), which will result in a file that isn't exactly human readable...
by MrFariator
Sat Nov 30, 2024 6:23 pm
Forum: Support and Development
Topic: Usage with luau lang
Replies: 3
Views: 968

Re: Usage with luau lang

You can rebuild LÖVE from source to replace luajit (which is an off-shoot of lua 5.1 with some features from 5.2) with luau (which itself is an off-shoot of 5.1). However, due to the differences between luajit and luau, you may need some elbow grease to do so.