Lime and Parallaxing

1 reply [Last post]
Sanity11
User offline. Last seen 3 years 8 weeks ago. Offline
Joined: 16 Feb 2012

Hi All,

I am trying to add parallax scrolling to my level. It's scrolling on the Y axis. But as soon as I set the ParallaxEnabled parameter to true in the Map properties. The level becomes completely grey when I try to scroll it. First I had set up the layers with parallaxFactorY settings and a base layer. But I removed the parameters one by one to test where something might go wrong. But now the only thing left is that ParallaxEnabled is set to tue.

There are no error messages and the game on itself seems to keep running, it doesn't crash.

Does someone have suggestions for me :).

Thanks!

Replies

Sanity11
User offline. Last seen 3 years 8 weeks ago. Offline
Joined: 16 Feb 2012

I have somewhat fixed it for the moment, but it isn't working perfectly:

The map instance should be set to:
map:disableScreenClamping()

And in lime-utils.lua around line 480 in function dragObject I change to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- Drags an object 
-- (something that has an X and Y property).
-- @param object The object to drag.
-- @param event The Touch event.
function dragObject(object, event)
 
        local _object = object
        local _event = event
        
        if not _object then
                return 
        end
        
        if not _object.x or not _object.y then
                return
        end
        
        if(_event.phase=="began") then
 
                _object.touchPosition = {}
        _object.touchPosition.x = _event.x - _object.x
        _object.touchPosition.y = _event.y - _object.y
 
    elseif(_event.phase=="moved") then
 
                if not _object.touchPosition then
                        _object.touchPosition = {}
                _object.touchPosition.x = _event.x - _object.x
                _object.touchPosition.y = _event.y - _object.y
                end
                
                -- ORIGINAL
                --_object.x = _event.x - _object.touchPosition.x
                --_object.y = _event.y - _object.touchPosition.y
 
                -- TEMP FIX
                local resultY = _event.y - _object.touchPosition.y
                print(resultY)
                if(resultY < 0 and resultY > -481)then
                _object.y = resultY
        end
        --end
 
    end
 
end

I think it's a bug, I will submit it to Lime.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.