Search found 3098 matches

by kikito
Tue Nov 10, 2009 3:36 pm
Forum: Support and Development
Topic: sprite look to cursor
Replies: 9
Views: 8509

Re: sprite look to cursor

No need to ask for forgiveness, no worries. Give this a try. I can't use it on my computer since I don't have 0.5 any more, so I haven't tested. I've included comments with "kikito: " in order to explain the changes I made. -- include files -- love.filesystem.include( math ) -- kikito: I t...
by kikito
Tue Nov 10, 2009 2:13 pm
Forum: Support and Development
Topic: sprite look to cursor
Replies: 9
Views: 8509

Re: sprite look to cursor

hi again, I didn't understand your question correctly at the beginning - I thought you wanted to move the image, not to orientate it. You have to calculate the angle - this involves some trigonometry . Mine is a bit rusty, but let me try to help you. The very least you need is arctanget - wich in lu...
by kikito
Tue Nov 10, 2009 11:51 am
Forum: Support and Development
Topic: sprite look to cursor
Replies: 9
Views: 8509

Re: sprite look to cursor

You could use the update function to update mousex before each frame is drawn: function update(dt) mousex = love.mouse.getX( ) end Another (possibly less correct) way is to set mousex inside your draw function: function draw() mousex = love.mouse.getX( ) love.graphics.setBackgroundColor( 50, 50, 50 ...
by kikito
Tue Nov 10, 2009 10:43 am
Forum: Support and Development
Topic: lua objects?
Replies: 7
Views: 3805

Re: lua objects?

Hi Carl, Lua is so flexible that by using metatables and metamethods it is possible to replicate C#/Java classes and instances functionality (also inheritance, mixins...) I've done so in my PÄSSION lib ( http://love2d.org/forum/viewtopic.php?f=5&t=1039 ). Concretely, the part that implements Obj...
by kikito
Tue Nov 10, 2009 10:28 am
Forum: Support and Development
Topic: Simple Collision
Replies: 3
Views: 3077

Re: Simple Collision

I've done a quick google search and found this: http://silentmatt.com/computers/playground/intersection.php According to this page, it is easier if your rectangles are specified as four points (without heights and widths): If we call them A.x1, A.y1, A.x2, A.y2, B.x1, B.y1, B.x2, B.y2, we end up wit...
by kikito
Tue Nov 10, 2009 9:40 am
Forum: Support and Development
Topic: Question regarding table.insert()
Replies: 9
Views: 5010

Re: Question regarding table.insert()

Candall, your code is a bit difficult to understand, but if I understood it correctly, I think there are more efficient ways of doing it. It seems that you want to: Create one character Parse lua code for him, from another file (extension *.act) The problem with this approach is that it is reading t...
by kikito
Tue Nov 10, 2009 8:39 am
Forum: Libraries and Tools
Topic: PÄSSION: object-oriented LÖVE
Replies: 90
Views: 50062

Re: PÄSSION: object-oriented LÖVE

Hi Technocat,

I deactivated the rotation in order to debug the centering more easily. I've activated it again. Thanks for the testing!

I don't know why the bodies stop colliding - I may do more tests when 0.6 is more advanced.
by kikito
Mon Nov 09, 2009 11:20 pm
Forum: Libraries and Tools
Topic: PÄSSION: object-oriented LÖVE
Replies: 90
Views: 50062

Re: PÄSSION: object-oriented LÖVE

Ok I got it working with 0.6! A couple notes: Since images are not "centered" any more on 0.6, I had to add some setCenter and getCenter helper methods. I'm still not satisfied with the results (the borders are not exactly "pixel-perfect" with the images), but I believe I'll leav...
by kikito
Mon Nov 09, 2009 11:06 pm
Forum: General
Topic: 0.6.0 Update
Replies: 221
Views: 104762

Re: 0.6.0 Update

Ok now I think I got one missing thing on 0.6.0

I tried calling body:setVelocity(0,0) on a pysics body and I got a "tried to call a non-existing (nil) function" error.

Regards!
by kikito
Mon Nov 09, 2009 12:01 am
Forum: General
Topic: 0.6.0 Update
Replies: 221
Views: 104762

Re: 0.6.0 Update

Hi again

newRectangleShape does seem to have the same syntax as before. My problem was somewhere else in my code - apologies.