LuckieLordie Posted November 13, 2013 Share Posted November 13, 2013 So guys how do you make a parallax effect in your games?I'm trying to generate one at the minute by using groups as layers and moving the groups in relation to each other and a speed multiplier. Is there an easier/better way you use? Thanks! Edit: title is spelt wrong -.- Link to comment Share on other sites More sharing options...
rich Posted November 13, 2013 Share Posted November 13, 2013 It depends on the effect you're after. I mean I know you want parallax of course, but if it's say for a repeating background image then I would handle it differently than if it's just for a bunch of sprites moving around. If possible make use of the Tiling Sprites. They are really cheap to draw and you can alter the scroll speed using. Overlay a few tile sprites on-top of each other, with different scroll speeds and you could make a lovely easy parallax effect. Otherwise you will need to do it on a sprite speed level really. Link to comment Share on other sites More sharing options...
LuckieLordie Posted November 13, 2013 Author Share Posted November 13, 2013 It depends on the effect you're after. I mean I know you want parallax of course, but if it's say for a repeating background image then I would handle it differently than if it's just for a bunch of sprites moving around. If possible make use of the Tiling Sprites. They are really cheap to draw and you can alter the scroll speed using. Overlay a few tile sprites on-top of each other, with different scroll speeds and you could make a lovely easy parallax effect. Otherwise you will need to do it on a sprite speed level really. Cool the TileSprite way seems like it suits what I'm trying to do a bit better. I'm looking at the TileSprite section in the docs but there doesn't seem to be a property I can change to alter the scroll speed. Do you know what it's called? Thanks a lot for the last few days by the way these forums have been really helpful! Link to comment Share on other sites More sharing options...
rich Posted November 13, 2013 Share Posted November 13, 2013 Sorry my previous message got cut off - crappy laptop keyboard. You want the TileSprite.tilePosition property - it has 2 values, x and y. So you just adjust those to make the texture scroll. The amount you adjust it by is the speed it'll move. Link to comment Share on other sites More sharing options...
jcs Posted November 13, 2013 Share Posted November 13, 2013 the dev branch also now supports tilemap layers that move at different rates, so you can use entire tilemap layers for parallax effects if you should so desire. Link to comment Share on other sites More sharing options...
@99golems Posted December 10, 2013 Share Posted December 10, 2013 For future people searching "parallax" on the forums, the TileMapLayer object has two properties, ScrollFactorX and ScrollFactorY that are worth looking into. from TilemapLayer.js:"speed at which this layer scrolls horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls half as quickly as the 'normal' camera-locked layers do)" BrenX 1 Link to comment Share on other sites More sharing options...
Arlefreak Posted December 10, 2013 Share Posted December 10, 2013 If possible make use of the Tiling Sprites. They are really cheap to draw and you can alter the scroll speed using. Overlay a few tile sprites on-top of each other, with different scroll speeds and you could make a lovely easy parallax effect. This is what I'm using http://www.arlefreak.com/games/ Link to comment Share on other sites More sharing options...
Recommended Posts