Search found 650 matches

by airstruck
Sun Apr 23, 2017 6:16 pm
Forum: Libraries and Tools
Topic: clasp - tiny class library
Replies: 29
Views: 20787

Re: clasp - 13 lines of class

Not bad, looks similar to a solution I've used before (particularly "extend"). A few thoughts: - Setting everything to weak keys seems suspicious/unnecessary, why do that? - Calling pairs every time you instantiate a class is slow, can that be moved to declaration from instantiation? - The...
by airstruck
Sun Apr 23, 2017 5:57 pm
Forum: Support and Development
Topic: Avoiding fixed timestep death spiral?
Replies: 42
Views: 23807

Re: Avoiding fixed timestep death spiral?

here's a good article on fixing the timestep. The approach might ease your concerns about devices on the lower end, but like all magic it comes with a cost: interpolating the drawing. http://gafferongames.com/game-physics/fix-your-timestep/ Thanks, but I was really looking for ways to avoid discard...
by airstruck
Wed Apr 19, 2017 3:14 am
Forum: Support and Development
Topic: Visualizing map generation
Replies: 5
Views: 4065

Re: Visualizing map generation

attempt to yield across C-call boundary This means there's a call to a C function somewhere in the call stack between your yield and resume calls. It's most likely a "require" in which case it shouldn't be hard to move outside the coroutine, or possibly a "pcall" which could be ...
by airstruck
Thu Apr 13, 2017 6:32 pm
Forum: Support and Development
Topic: Wrap images around game window
Replies: 20
Views: 15097

Re: Wrap images around game window

Thats why i told the sprite position should be defined by upper left conner Ah, I missed that part. In general I think he has the right idea placing the origin at the center, though. x=((x-spritezise/2)%size)+spritesize/2 Yes, that does work nicely. Not sure if it's an improvement overall; getEdge ...
by airstruck
Thu Apr 13, 2017 5:56 pm
Forum: Support and Development
Topic: Wrap images around game window
Replies: 20
Views: 15097

Re: Wrap images around game window

What if the center of the sprite is at x=10 in your example, though? You won't see it on the right side of the screen, but you should. Test it out.
by airstruck
Thu Apr 13, 2017 3:47 pm
Forum: Support and Development
Topic: Wrap images around game window
Replies: 20
Views: 15097

Re: Wrap images around game window

Why the change to getEdge? It won't wrap from left to right or top to bottom like that, only from right to left and bottom to top.
by airstruck
Thu Apr 13, 2017 6:44 am
Forum: Support and Development
Topic: Wrap images around game window
Replies: 20
Views: 15097

Re: Wrap images around game window

You might want to avoid creating a temporary table every frame and only draw as many times as needed. Something like this should be simpler: local function drawPlayerAt (x, y) love.graphics.draw(p.image, x, y, p.a, 1, 1, p.ox, p.oy) end local function getEdge (pos, rad, max) if pos - rad < 0 then re...
by airstruck
Wed Apr 05, 2017 6:36 pm
Forum: Support and Development
Topic: Does love.graphics.line take in vectors (tables) as parameters? Can't get it to work.
Replies: 3
Views: 3086

Re: Does love.graphics.line take in vectors (tables) as parameters? Can't get it to work.

I don't think it works like that. As far as I know all vertices need to be in a single table, with sequential indices.
by airstruck
Wed Apr 05, 2017 5:18 am
Forum: Support and Development
Topic: Physics/Box2D: prismatic joints?
Replies: 10
Views: 8305

Re: Physics/Box2D: prismatic joints?

Prismatic does have special behavior if you define the axis as 0, 0. It keeps both bodies at the same angle, but does not restrict them to an axis as it normally does. This means moving one body will not affect the position of the other. It's roughly the same behavior as a motor joint with high torq...
by airstruck
Tue Apr 04, 2017 8:55 pm
Forum: Support and Development
Topic: Physics/Box2D: prismatic joints?
Replies: 10
Views: 8305

Re: Physics/Box2D: prismatic joints?

I don't think you can do this with joints alone. You'll probably need to constantly rotate one of the end bodies so that it always faces the other, and then join that end body to the middle body with a prismatic. You might also want to give the middle body a very low mass so its motion doesn't affec...