Have a moon or son that stays stationary in the background while the rest of the background moves

Discussion in 'How Can I...?' started by robert_mcmonagle, Apr 22, 2016.

  1. robert_mcmonagle

    robert_mcmonagle Boxer

    Joined:
    Feb 2, 2016
    Messages:
    10
    Likes Received:
    0
    basically what the title says. Loooking to create planets suns, moon in sky which stays centered in background while the stars/ tress move in the foreground.
     
  2. heathclose

    heathclose Miniboss Boxer

    Joined:
    Jan 28, 2016
    Messages:
    1,810
    Likes Received:
    1,026
    you could just make it a background that has no scroll speed
     
  3. Kadri246

    Kadri246 Avid Boxer

    Joined:
    Mar 1, 2016
    Messages:
    243
    Likes Received:
    77
    In one of my current projects, I created a moon on 2040x1280 png, tile image at about 800 and scroll speed set at 0.02
     
  4. robert_mcmonagle

    robert_mcmonagle Boxer

    Joined:
    Feb 2, 2016
    Messages:
    10
    Likes Received:
    0
    Well if I make it a background it duplicates the sun or moon 50 times.
     
  5. Kadri246

    Kadri246 Avid Boxer

    Joined:
    Mar 1, 2016
    Messages:
    243
    Likes Received:
    77
    tile image at about 800 or 900, set the scroll speed to about 0.02 to have that realistic moon follow
     
  6. trudnai

    trudnai Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,235
    Likes Received:
    701
    • Image needs to be as big as the screen size -- as @Kadri246 suggested that earlier...
    • Alternatively you can add a picture to the game field, but that is more like a hack to be honest.
    • Another hack is when you have constant game speed and at the start screen you have the sun/moon objects traveling to the game direction so that it looks like stationery
    • Ok, last hack: Attack Moon/Sun to the player object -- but that can have really weird effects :)
     
    BossGames likes this.
  7. AppNasty

    AppNasty Miniboss Boxer

    Joined:
    Apr 14, 2016
    Messages:
    1,485
    Likes Received:
    890
    While experimenting with this same idea, What i found was best is keep BG scrolling and add Moon/Sun as an object, make it have no collision, put it high up and adjust its speed and angle to go in the direction you run. Or slow it down ever so slightly so the moon/sun slowly moves to the left as you play. If it a game where you can stop, then they will zoom to the right out of screen. But if its a game where you keep going and when you get hit you die. it will still keep going but all you have to do is make death delay 0 and make sure your game over screen has a background to hide the fact the moon/sun just turbo boosted out of screen lol. Works a charm.
     
  8. Jayant Mall

    Jayant Mall Boxer

    Joined:
    Nov 5, 2018
    Messages:
    32
    Likes Received:
    2
    The Sun just gets repeated in the background.... One way around it would be to play around with the Tiling Offset and Speed to match your level length.
     

Share This Page