Search found 478 matches

by Azhukar
Sun Oct 22, 2017 11:58 pm
Forum: Support and Development
Topic: SpriteSheet Help
Replies: 11
Views: 5989

Re: SpriteSheet Help

Because you do not set 'right = false' when you set 'left = true', so you end up with a situation when both left and right is set to true.

Try completing this tutorial to get a better grasp of the language https://love2d.org/wiki/Tutorial:Baseline_2D_Platformer
by Azhukar
Sun Oct 22, 2017 11:55 pm
Forum: Support and Development
Topic: Lighters pause in midpoints
Replies: 10
Views: 8774

Re: Lighters pause in midpoints

HedgeHog builder wrote: Sun Oct 22, 2017 3:07 amSo if I wanted to do comparison on distance between 2 points from the unit would I do
Distance between 2 points would be

Code: Select all

local distance = math.sqrt((unit.x-k.x)^2 + (unit.y-k.y)^2)
Based on the https://en.wikipedia.org/wiki/Pythagorean_theorem
by Azhukar
Sat Oct 21, 2017 6:14 pm
Forum: Libraries and Tools
Topic: Building a Free Library of Images for Everyone
Replies: 245
Views: 710261

Re: Building a Library of Images for Everyone

Great collection, shame about the license though. Including "youtube community guidelines" as a term of use makes it risky to use, since you can retroactively revoke the license based on some vague guidelines based upon another entity that can change them without notice. Defeats the whole ...
by Azhukar
Sat Oct 21, 2017 12:39 pm
Forum: General
Topic: collision problem
Replies: 6
Views: 4935

Re: collision problem

there was no error message, and fixed that typo already. the yp is the y position of the player That can happen when you use global variables in such a way. It's much more maintainable to keep your variables as localized to their use as possible and avoid globals. You'll run into problems once your...
by Azhukar
Sat Oct 21, 2017 12:03 pm
Forum: Support and Development
Topic: OOP in Love2D
Replies: 5
Views: 5059

Re: OOP in Love2D

Here's how you can implement a class: local classMeta = { __call = function(self,...) --creates a new class instance local new = setmetatable({},self) if (self.init ~= nil) then new:init(...) --constructor end return new end, } local function newClass() --creates a new class local class = setmetatab...
by Azhukar
Sat Oct 21, 2017 11:39 am
Forum: General
Topic: collision problem
Replies: 6
Views: 4935

Re: collision problem

You have a typo on this line, there's a variable 'yp' that should be 'y1'. Your error message must have told you that you're comparing nil with a number, next time read the error message and post it.

Code: Select all

if x1 < x2 + w2 and y1 + h1 > x2 and yp < y2 + h2 and x1 > x2 + w2 - (speed + 1) then
by Azhukar
Fri Oct 20, 2017 4:28 pm
Forum: Support and Development
Topic: SpriteSheet Help
Replies: 11
Views: 5989

Re: SpriteSheet Help

It should be if CF > total then But you're setting the 'total' to 8 for WalkR and WalkL, when it should be 6 in those cases. You can ditch the 'total' variable altogether if you use if CF > #frames then You seem to be struggling with very basic concepts, I recommend you try to go through your code l...
by Azhukar
Fri Oct 20, 2017 8:12 am
Forum: Support and Development
Topic: Lighters pause in midpoints
Replies: 10
Views: 8774

Re: Lighters pause in midpoints

So line by line: For each index and value of opposing pens do; for each index and value of beacons do; if the target of opposing pens is non existent; then target is set to index of a beacon else if the target is not k, then finish the loop Correct? Yes. 'break' always ends only one loop, the one i...
by Azhukar
Thu Oct 19, 2017 2:05 pm
Forum: Support and Development
Topic: SpriteSheet Help
Replies: 11
Views: 5989

Re: SpriteSheet Help

Notice I wrote

Code: Select all

if CF > total then
In your code you have

Code: Select all

if CF < total then
The reason why you're getting that error is that you increment CF but never limit what value it can be, meaning it will be incremented forever and you'll start indexing your table where you did not intend.
by Azhukar
Thu Oct 19, 2017 1:20 pm
Forum: Support and Development
Topic: SpriteSheet Help
Replies: 11
Views: 5989

Re: SpriteSheet Help

ETime = ETime + dt if ETime > 0.1 then CF = CF + 1 if CF > total then CF = 1 end activeF = frames[CF] ETime = 0 end Notice that in your original code you had the variable ETime with a small "t" and with a capital "T", this makes them two completely different variables. Pick a na...