Search found 61 matches

by TheHUG
Sat Jul 20, 2019 9:11 am
Forum: Support and Development
Topic: Trace a curve which pass through all of the points.
Replies: 8
Views: 6113

Re: Trace a curve which pass through all of the points.

Whatever my girlfriend's svg editing software used for it's curves ( which it did call bezier) does pass through all the points, so I was also surprised by this. I spent some time looking for this, and I didn't find anything. I think you'll need to come up with it yourself. I was thinking of doing i...
by TheHUG
Sat Jul 13, 2019 6:22 pm
Forum: Support and Development
Topic: Object inheritance
Replies: 26
Views: 12093

Re: Object inheritance

That's a pretty good idea
by TheHUG
Sat Jul 13, 2019 5:47 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 24
Views: 9485

Re: What is setUserData and why do I need it?

But then you have to modify the table every time a body is created or destroyed. As for creation, in the other method you have to setUserData anyway, so there's no significant advantage - both methods require an action at creation time. As for destruction, weak tables take care of that automaticall...
by TheHUG
Sat Jul 13, 2019 5:29 pm
Forum: Support and Development
Topic: Object inheritance
Replies: 26
Views: 12093

Re: Object inheritance

Yes that's true about self.__index, you could set A.__index = A, and then do the same whenever you define a new class, or if you prefer to keep the metatable and the superclass separate you could define local metaA = {__index=A} and set that to be the metatable of subclasses. It's an additional thin...
by TheHUG
Sat Jul 13, 2019 2:44 pm
Forum: Support and Development
Topic: Object inheritance
Replies: 26
Views: 12093

Re: Object inheritance

An example of more levels of inheritance would be: Object = {} function Object:new(x, y) local o = {x=x, y=y} setmetatable(o, self) self.__index = self return o end Collider = Object:new() -- Collider inherits Object's :new method function Collider:collide(...) ... end a_collider = Collider:new() --...
by TheHUG
Sat Jul 13, 2019 6:06 am
Forum: Support and Development
Topic: [SOLVED] Math + Spread bullets
Replies: 10
Views: 5988

Re: Math + Spread bullets

First thanks again all of you. Both aproach gave interesting result. After post my last reply I found what I was searching with just adding two var that I may have to random: table.insert(b, {x = startX, y = startY, dx = bulletDx, dy = bulletDy,r=size,vx=15,vy=15}) -- and v.x = v.x + ((v.dx+v.vx) *...
by TheHUG
Fri Jul 12, 2019 4:15 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 24
Views: 9485

Re: What is setUserData and why do I need it?

When you have some collision callback that only sees two fixtures (to which last I checked you can't assign any attributes as they are not tables), you may want some way to reference the object they came from to e.g. change its health without requiring a global variable. The simplest way is to store...
by TheHUG
Fri Jul 12, 2019 4:09 pm
Forum: Support and Development
Topic: Object inheritance
Replies: 26
Views: 12093

Re: Object inheritance

I'll put it to you this way, if your examples managed to confuse both myself and pgimeno - it doesn't speak good for the code. Basically you're doing a simple __index fallback to another table. It won't work for more than one level of inheritance, so you can't make a subclass of "subclass"...
by TheHUG
Thu Jul 11, 2019 4:37 am
Forum: Support and Development
Topic: [SOLVED] Math + Spread bullets
Replies: 10
Views: 5988

Re: Math + Spread bullets

If you don't want any specific shape you can just add love.math.random() * spread_factor to `angle` to get the angle for the bullet, as pgimeno explained. Since I saw you were adding/subtracting specific (non-random) amounts from the bullet's position in your code: table.insert(b, {x = startX, y = s...
by TheHUG
Thu Jul 11, 2019 4:34 am
Forum: Support and Development
Topic: This release is not compliant with the Google Play 64-bit requirement
Replies: 7
Views: 12099

Re: This release is not compliant with the Google Play 64-bit requirement

I tried to compile love2d for arm64-v8a and finally I've done it. I haven't tested it yet, but here is the link: https://github.com/rozenmad/love2d-android-admob Put the game (game.love) in the directory (project)/app/src/main/assets (if this directory doesn't exist then create it). Without it the ...