How do I Set My Hud With Parallax Correctly!!! HELP!!!

  • Hi everyone I am having quite hard time with my "HUD".

    1-My first levels in my game were only one screen and had no scroll but now I wanted to add some scrolling effect for advancement.

    3-My Game is only going to right & left so no jumping involved.

    4-I created a seperate sprite with scrolling behaviour and set my player's X &Y position to that created sprite. I set the new sprite to invisible.

    5-I set my HUD in a different layer with Parallax 0,0 it stays where its at during scroll.

    6-BUT in my game event I have a thing.

    -When the player collects a coin, it is destroyed and a new coin is created which has a bullet behaviour and flies straight to the position of the COIN sprite in my HUD.

    -When the spawned coin touces the Coin in Hud 1 COIN is added to the COIN Value. And the spawned COIN is obivously destroyed.

    So there are three COINS for this example.

    1-Coin Collected inside Stage.

    2-Coin Spawned.

    3-Coin Icon in HUD.

    This is my event for coin flying towards Coin in HUD.

    angle(goldcoin_collect.X, goldcoin_collect.Y, goldcoin_GUI.X, goldcoin_GUI.Y)

    Check the picture. (Mario and Coin is only reference I am not using them in my main game)

    Ok this was working fine until I started to scroll my Game Area.

    Like I said I set my HUD to Parallax 0,0 and arranged its position so it always stays on screen when there is a scroll.

    BUT the problem is when the player goes the far right of the screen as scrolling the game area I guess the image point of the COIN in HUD stays on the far left side. (where it is originally in my editing screen)

    So when the player is at the far right side the swapned COIN flies to the far left of the Game Area instead of going up to the COIN in HUD to touch it.

    To mention I also have a game area 1280x720 and at the beggining I set scroll to X-640 and Y-360 to center the screen.

    I also tried the Anchor behaviour instead of Parallax but that is really lacking and slow (in mobile looks more awful) and seems unproffesional . Or maybe I am doing something wrong.

    I really would appreciate the help on this and hope there is a solution.

  • You could spawn the new coin on the 0,0 paralax.

    Or you can set the bullet's angle to go towards the X and Y where the score is, not to go directly to the scores.X and .Y because that gets altered since it's on a 0,0 paralax. Considering they never move, you could probably use the static X and Y.

  • Je Fawk Thank you so much! I will give it a go and tell you the results!!!

  • Je Fawk Hi I tried spawning it on the 0,0 paralax (you meant the same layer as my GUI right or should I create it in another new layer) Now my sprites go to the GUI correctly but are not spawned where my player is. It spawns like at the far right of my main player and this distance changes depending on where my player is at while scrolling.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Have a look at this:

  • ramones Thank You So Much!!!! It worked. I just adapted your capx file to my game in a different way but I made it work!!! I was really becoming desperate about this so thank you once again and happy gaming!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)