Search found 74 matches

by RNavega
Wed Apr 28, 2021 10:26 pm
Forum: Support and Development
Topic: Pixilated circle
Replies: 9
Views: 623

Re: Pixilated circle

Make sure you use nearest-neighbor / point filtering so you get those nice sharp pixels. This is done by calling :setFilter() on your canvas once after it's created, setting the 'mag' parameter (the filtering used when the canvas texture is drawn larger than it is) to "nearest". - https://...
by RNavega
Wed Apr 28, 2021 10:03 pm
Forum: Support and Development
Topic: If statement and Goto
Replies: 38
Views: 5487

Re: If statement and Goto

Generic states (instead of "level 1", "level 2", etc) is pretty much what I was talking about and making an example of in my post above. Have a look at the code to see one example of implementation. My UI elements suck, but the game state design & implementation is pretty so...
by RNavega
Wed Apr 28, 2021 4:26 am
Forum: Support and Development
Topic: If statement and Goto
Replies: 38
Views: 5487

Re: If statement and Goto

Pause can be another full state, and inside of the Pause :draw() method, it can call the game :draw() to draw the game objects.... but NOT call the game's :update() to update the position of the game objects. There are stacked state libraries that call the previous events, see https://love2d.org/fo...
by RNavega
Wed Apr 28, 2021 2:41 am
Forum: Support and Development
Topic: Profiling your code
Replies: 5
Views: 923

Re: Profiling your code

The example over at the wiki page for love.timer.getTime() shows how to measure the time taken to run a piece of code. Note that this includes the time taken for everything else being done by the CPU. If you run this profiling code while the CPU is busy doing something else and then run it again whe...
by RNavega
Tue Apr 27, 2021 3:34 pm
Forum: Support and Development
Topic: If statement and Goto
Replies: 38
Views: 5487

Re: If statement and Goto

If I have three states: LevelOne, LevelTwo and Pause, then I need to return from pause to first and second level, isn't that? Or Menu with submenues. I think there are two ways to approach that. Let's imagine the inconvenient scenario of: "Your game is being played, then the player hits P for ...
by RNavega
Thu Apr 08, 2021 11:55 am
Forum: Support and Development
Topic: If statement and Goto
Replies: 38
Views: 5487

Re: If statement and Goto

Ok, good luck. If you plan on having any screen transition effects then you don't need to make a full state just for them, you can do them from within a preexisting state and undo in the next. For example, say you want this: user hits PLAY on the menu, screen fades to black, then fades in into level...
by RNavega
Wed Apr 07, 2021 11:43 am
Forum: Support and Development
Topic: If statement and Goto
Replies: 38
Views: 5487

Re: If statement and Goto

How much have you read on software programming patterns? Specifically the state pattern, it's very cool: https://gameprogrammingpatterns.com/state.html As I understand it, you're encapsulating logic into separate objects, and at one given moment only one of those objects is controlling the game (bot...
by RNavega
Wed Apr 07, 2021 11:04 am
Forum: General
Topic: Looking for algorithm like flood fill
Replies: 7
Views: 1095

Re: Looking for algorithm like flood fill

Will you design the tilemaps manually, with a tile editor? If so then I'd implement a 'tag' attribute so that you can tag tiles that belong to the same room when you're drawing them (ie set tag to "Room 1", start plotting tiles). This way no preprocessing is needed. If the tilemaps are bei...
by RNavega
Thu Apr 01, 2021 1:23 am
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 5872

Re: Enforce just one instance?

It's not even listening. I doubt it consumes CPU. Looking into the source to luasocket, it does seem to be simpler than I was thinking: - https://github.com/diegonehab/luasocket/blob/master/src/wsocket.c#L154 (bind from WinSocket2 on Windows) - https://github.com/diegonehab/luasocket/blob/master/sr...
by RNavega
Wed Mar 31, 2021 2:22 am
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 5872

Re: Enforce just one instance?

My only concern is which method uses less (CPU) resources. I don't know if using a listening socket to behave like a global mutex in this way involves any redundant polling from the OS or not.