Several Things

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Several Things

Post by Sparx »

I am missing an Image:getCenter functionality

I allready read something about that the setCenter fucntionality goes "bye-bye" but i like it, like this i don't need to specifiy new variables for this.
Now without the get center i need them both since the following problem is occuring:

The "draws" function doesn't work if the signum of the 2 scaling values differ.

[edit]
The negative scaling has 1 big Problem: If Rotating arround different center and scaling negative the position it is is not logical. It should be scaled arround the center set via Image:setCenter or at it's edge still not too logical. But (for negative values) it seems to be scaling exactly 4 pixels and the set center away out of its right border....... very strange.

Just another question: How can I include files without putting them into my .love file.. i want to make it more easy to design gameskins or levelpacks without touching the love file.
[/EDIT]
User avatar
Gerrit
Prole
Posts: 46
Joined: Wed Mar 25, 2009 7:40 pm

Re: Several Things

Post by Gerrit »

Sparx wrote:I am missing an Image:getCenter functionality

I allready read something about that the setCenter fucntionality goes "bye-bye" but i like it, like this i don't need to specifiy new variables for this.
How about:

lImage.lua

Code: Select all

lImage = { }

function lImage:new ( image_url, x ,y )
      local center_x, center_y, image
      image = love.graphics.newImage( image_url) 
      center_x = x + image:getWidth() / 2
      center_y = y + image:getHeight() / 2
      o = { image = image, x = x, y = y, center_x = center_x, center_y = center_y }
      setmetatable(o, self)
      self.__index = self
      return o
end


function lImage:getCenter ()

      return self.center_x, self.center_y

end

function lImage:setCenter ( x, y )

    self.center_x = x
    self.center_y = y

end
main.lua:

Code: Select all

function load()

love.graphics.setMode( 640, 480, false, true, 0 )
-- load our lib
require("lImage.lua");
-- create a new image
myImage = lImage:new ( "circle.png", 200, 200 )

end


function draw()

-- draw our image
love.graphics.draw( myImage.image, myImage.x, myImage.y)

end
Sparx wrote: Just another question: How can I include files without putting them into my .love file.. i want to make it more easy to design gameskins or levelpacks without touching the love file.
You can still load a file via io.open as long as those functions aren't disabled. But those will be removed from future Löve versions so don't count on it. Also this only applies to text/lua files outside your Löve file. You can't load images that way afaik.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: Several Things

Post by Sparx »

Thanks for the reply.

I think I will stick to the method of just saving the centersettings myself....

Not beeing able to load "external" files as images etc is realy a con.
Is there a kind of workaround, will it follow in future versions?
How do YOU integrate map-editing or even later in the game developement mod abbilities with LÖVE?

Sparx
User avatar
Gerrit
Prole
Posts: 46
Joined: Wed Mar 25, 2009 7:40 pm

Re: Several Things

Post by Gerrit »

Sparx wrote: Not beeing able to load "external" files as images etc is realy a con.
But it makes Löve safer and there are ways to work around. Read on.
Sparx wrote: Is there a kind of workaround, will it follow in future versions?
I guess there won't be a workaround to load external images but maybe they could integrate a "Not safe mode" which enables you to load stuff outside the Löve file.
Sparx wrote: How do YOU integrate map-editing or even later in the game developement mod abbilities with LÖVE?
If you mean map-editing with an external editor that shouldn't be too hard. Just open the zip file up, save your graphics into a new folder inside it, including the map and save it. For a integrated level editor the user can A: Edit/create new maps with the graphics that are provided or B: can integrate own graphics into the Löve file which isn't that big a deal.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Several Things

Post by bartbes »

And do not forget the save dir, if the map editor shares the same name it can save in the same save dir.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: Several Things

Post by Sparx »

I would definately prefer the not save mehtod... How to do?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 51 guests