Search found 155 matches
- Tue Mar 30, 2021 7:38 pm
- Forum: Libraries and Tools
- Topic: A Simple Resource Library
- Replies: 0
- Views: 610
A Simple Resource Library
local function cache_invalidate(cache) for k, v in pairs(cache) do v.unused = true end end local function cache_cleanup(cache) for k, v in pairs(cache) do if v.unused then cache_remove(cache, k) end end end local function cache_remove(cache, k) local cached = cache[k] if cached.release then cached:...
- Mon Mar 29, 2021 11:18 am
- Forum: Libraries and Tools
- Topic: A Simple Class Library
- Replies: 0
- Views: 807
A Simple Class Library
local M local noop = function() end local _deepcopy _deepcopy = function(t, mem) if type(t) ~= 'table' then return t end if mem[t] then return mem[t] end local copy = {} mem[t] = copy local meta = getmetatable(t) for k, v in pairs(t) do copy[_deepcopy(k, mem)] = _deepcopy(v, mem) end setmetatable(c...
- Sun Mar 21, 2021 7:06 pm
- Forum: Games and Creations
- Topic: Platformer Template
- Replies: 0
- Views: 1618
Platformer Template
Purpose:
- Use as a base for platformer
- Create most of the game in Tiled map editor
- With minimal code changes
https://github.com/monolifed/platformer
Work in progress
Unfinished
- Use as a base for platformer
- Create most of the game in Tiled map editor
https://github.com/monolifed/platformer
Unfinished
- Sun Mar 21, 2021 1:05 pm
- Forum: Support and Development
- Topic: Enforce just one instance?
- Replies: 21
- Views: 4797
Re: Enforce just one instance?
You can also run a local server with a fixed port. Then the other instance can't use the same port. (The code is just proof of concept) local socket = require"socket" local s, err = socket.bind("0.0.0.0", "8329") local role = err == "address already in use" an...
- Thu Mar 18, 2021 3:00 pm
- Forum: Games and Creations
- Topic: Point In Polygon algorithm
- Replies: 11
- Views: 2181
Re: Point In Polygon algorithm
Thanks, changed it accordingly
Anyway sorry devdev
Anyway sorry devdev
- Thu Mar 18, 2021 1:39 pm
- Forum: Games and Creations
- Topic: Point In Polygon algorithm
- Replies: 11
- Views: 2181
Re: Point In Polygon algorithm
Your other points are right
- Thu Mar 18, 2021 11:40 am
- Forum: Libraries and Tools
- Topic: Fast 2D point-in-polygon test
- Replies: 5
- Views: 3901
Re: Fast 2D point-in-polygon test
Since you use +1 and -1, wouldn't "return wn ~= 0" be sufficient.
- Thu Mar 18, 2021 11:36 am
- Forum: Games and Creations
- Topic: Point In Polygon algorithm
- Replies: 11
- Views: 2181
Re: Point In Polygon algorithm
pgimeno's code after further simplification -- By Pedro Gimeno, donated to the public domain function isPointInPolygon(x, y, poly) local x1, y1, x2, y2 local len = #poly x2, y2 = poly[len - 1], poly[len] local wn = 0 for idx = 1, len, 2 do x1, y1 = x2, y2 x2, y2 = poly[idx], poly[idx + 1] if (y1 > y...
- Tue Mar 16, 2021 9:11 pm
- Forum: Support and Development
- Topic: Avoiding moving objects going into walls in bump.lua
- Replies: 22
- Views: 2877
Re: Avoiding moving objects going into walls in bump.lua
I recently tried something similar local function shoveItemTo(self, other, x, y) map.world:update(other, x, y) local newx, newy = map.world:check(other, x, y) if newx ~= x or newy ~= y then map.world:update(other, other.x, other.y) else other.x, other.y = x, y end end basically I check if the new po...
- Tue Mar 09, 2021 7:50 pm
- Forum: Libraries and Tools
- Topic: Simple Tiled Implementation - STI v1.2.3.0
- Replies: 851
- Views: 375895
Re: Simple Tiled Implementation - STI v1.2.3.0
Why do every function in graphics.lua check for graphics.isCreated before the actual love.graphics function call? Wouldn't something like this be more optimal? (I mean not this particular code but calling love.graphics functions directly) local lg = _G.love.graphics local graphics = { isCreated = lg...