Author Topic: Parralax Scrolling  (Read 1330 times)

frog29

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Parralax Scrolling
« on: Sun, Dec 4, 2011 »
I'm trying to figure out parralax scrolling with different zoom levels

I want my foreground and main game engine to be running at 2x zoom,
but I also want two really large png files in the background with parralax scrolling at 1x zoom (so they can have more detail) (at different speeds)


Right now I've been trying to figure out multiple camera's, but they don't seem to respect transparency so that doesn't seem to be working.
(I was trying the code from here http://forums.flixel.org/index.php/topic,5094.0.html )

Any suggestions on how to do this?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Parralax Scrolling
« Reply #1 on: Mon, Dec 5, 2011 »
Depending on the scale of your game, and by that I mean how many sprites you've got, levels, etc. I.e. how "big" your game is - you may find it less of a headache to just run the game at x1 zoom, so the backgrounds all work, and simply double the size of your sprites in Photoshop (etc).

If that's not possible then you'll need a transparent camera (they do support transparency btw, as the clearance color value) with the main game one zoomed x2 positioned on-top of the background. Managing scrollfactor values between multiple cameras will be a bit hellish though, more than I would care to mess with!
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

frog29

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parralax Scrolling
« Reply #2 on: Tue, Dec 6, 2011 »
Thanks,

I guess I'll just double the size of my sprites then!

Thanks,
Frog29

frog29

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parralax Scrolling
« Reply #3 on: Tue, Dec 27, 2011 »
Turns out I need to do this still. I have been doubling sprite sizes through just using larger images, but now I am porting my game to android, and I need the efficiency of a zoomed game engine. (it runs smoothly when zoomed with original size gfx, but not when using doubled gfx sizes)
I was thinking about a way to do this without multiple cameras: instead I was thinking about making an instance of an FlxGame and then zooming that. Then i'd write code to display the backgrounds with parallax scrolling behind this FlxGame in AS
Are there any suggestions on how to do this?
I don't want to use cameras because then it means I won't be able to scale my whole game, which is where I think my efficiency is coming from, please correct me If i am wrong on this...

camasthecat

  • Contributor
  • ****
  • Posts: 461
  • Karma: +0/-0
  • WOW! 400+ Posts!? Jeez! Do I have a life!?!?
    • View Profile
    • My site for thermalJS, an HTML5/Javascript engine kinda-like flixel:
Re: Parralax Scrolling
« Reply #4 on: Wed, Dec 28, 2011 »
Can't you scale sprites directly in AS3 with ScaleX or something?