Version 2.7

Today I will be releasing version 2.7 to all you lucky registered customers, it will include a number of small improvements like localising a lot of external functions which may or may not make some small speed improvements.

I also have Matt’s “setTileAt” function as well as a “removeTileAt” function to go along with it, both on the tileLayers.

I have renamed the “worldToTilePosition” and “screenToTilePosition” to “worldToGridPosition” and “screenToGridPosition” respectively simply as those names make more sense.

Each tile layer now has a “setPosition” function just like map:setPosition()

The map:setTrackingPoint function has been renamed to map:setFocus, however still works the same way.

The LDI has a new property, “ParallaxEnabled” :slight_smile:

By setting the “ParallaxEnabled” on your map all of the regular map movement functions (move, drag, setPosition, slideToPosition, fadeToPosition) will now be parallax enabled as well as the focus object (through map:setFocus)

Control the speed of tileLayers by adding “parallaxFactorX” and/or “parallaxFactorY” properties to them. Default is 1 and the further away the layer is from the camera you will want a lower number and vice versa for closer layers.

I will be writing up all this info into an email update as well to make sure everyone is aware of the new version and changes.

Also, please make your +1s heard in this thread - http://developer.anscamobile.com/forum/2011/02/03/screen-culling

Parallax is still not completely perfect but as with before I want to get it out to you guys so that you can give me some feedback, for instance clamping currently doesn’t work properly.

[import]uid: 5833 topic_id: 5932 reply_id: 305932[/import]

Early support for Atlas (map chaining) is now in and will be included in 2.7

Please understand that as with Parallax I am only releasing it so that I can get some feedback and it is not perfect yet :slight_smile:

And on to 2.7 I am now just checking all the tutorials work and will uploading the new version when done.

At present there are still no tutorials for parallax or atlas but they will be created after some feedback. [import]uid: 5833 topic_id: 5932 reply_id: 20505[/import]

Can’t wait! Keep up the great work! Thanks [import]uid: 11904 topic_id: 5932 reply_id: 20524[/import]

Hopefully will be out tonight. [import]uid: 5833 topic_id: 5932 reply_id: 20583[/import]

2.7 is now up, check your emails :slight_smile: [import]uid: 5833 topic_id: 5932 reply_id: 20601[/import]

Are you sure the file in the download link is the right one ? Files are commented version 2.6…
[import]uid: 29419 topic_id: 5932 reply_id: 20603[/import]

Is the setParallaxPosition call still in there? [import]uid: 11904 topic_id: 5932 reply_id: 20608[/import]

@simpleex

Whoops, good catch :slight_smile: Updated emails have now been sent.

@ksan

Yup it’s still there on the map object however it is now called automagically in the move etc functions.

Feel free to call it yourself though if you wish. [import]uid: 5833 topic_id: 5932 reply_id: 20613[/import]

Still 2.6 in the new email link… :wink:

Try again ! [import]uid: 29419 topic_id: 5932 reply_id: 20615[/import]

Really strange, I have downloaded the file and it is certainly 2.7

Have you tried clearing your cache etc [import]uid: 5833 topic_id: 5932 reply_id: 20622[/import]

It was a cache problem, got it ! Thx [import]uid: 29419 topic_id: 5932 reply_id: 20626[/import]

Awesome! [import]uid: 5833 topic_id: 5932 reply_id: 20628[/import]

Graham,

I’ve only just updated the lime version in my project and it’s breaking. It looks like I can’t read layers from my TMX file. To confirm this I created a new project with just lime in it along with the following code in main.lua:

  
local lime = require("lime")  
  
local map = lime.loadMap("levelOneMap.tmx")  
  
local visual = lime.createVisual(map)  
  
local layer = map:getTileLayer("Player")  
  
print("There are a total of "..#map.layers.." layers in this map")  
  

This code returns the error “attempt to get length of field ‘layers’ (a nil value)”. The same code works fine using the same tmx file with lime 2.0 (the version I was using), there are two layers on the tmx.

I based this on the tutorial code, am I missing something?

Thanks for your help,

Cheers!

Rob

[import]uid: 12431 topic_id: 5932 reply_id: 22798[/import]

Hi Rob, really sorry about that, the property has been renamed to “tileLayers” to better differentiate it from object layers. Must have forgotten to update that bit of the documentation. [import]uid: 5833 topic_id: 5932 reply_id: 22800[/import]

Graham,

Thanks for that, it’s now reporting the correct number of layers. However, the reason why I was testing this is I was getting an error “attempt to call method ‘getTileLayer’ (a nil value)” when I reference a layer:

local layer = map:getTileLayer("Player")  

This statement does work in a test project. I’m wondering if it’s because of the way I’m calling the map?

My load function creates a map object and passes it to my unit class to create a unit object (the player):

function load()  
 local self = {}   
 self.level = "levelOne"  
 self.map = map.new(self.level)  
 local player1 = unit.new(self.map)  

The map class’ new map function is as follows:

function new(mapName)   
 local self = lime.loadMap("levelOneMap.tmx")   
 local visual = lime.createVisual(self)  
 local physical = lime.buildPhysical(self)  
 setmetatable(self, map.mt)  
 return self  
end  

It’s whilst trying to reference a map layer in the unit.new function that I get the “attempt to call method ‘getTileLayer’ (a nil value)”:

function new(map)  
print(#map.tileLayers)  
local layer = map:getTileLayer("Player")  

The print statement is reporting the right amount of layers (2) so why is map:getTieLayer not working? This code works fine with an older version of lime…

Sorry to bother but it’s been stumping me, is it a metatable issue?

Cheers!

Rob
[import]uid: 12431 topic_id: 5932 reply_id: 23029[/import]

Hi Rob,

Not sure why it isn’t working however it could be a metatable issue, I am still away from my main computer however I will be back at it tomorrow. If you wish and are able to can you send me your project and I will have a look at it? support@justaddli.me

[import]uid: 5833 topic_id: 5932 reply_id: 23205[/import]