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

Get help using Construct 2

Post » Thu Feb 12, 2015 10:36 am

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)

Image

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.
B
19
S
6
Posts: 179
Reputation: 2,202

Post » Thu Feb 12, 2015 1:50 pm

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.
Black Bobby The Hole Greenlit with 303 votes.
B
36
S
8
G
1
Posts: 163
Reputation: 3,029

Post » Thu Feb 12, 2015 2:00 pm

@Je Fawk Thank you so much! I will give it a go and tell you the results!!! :D
B
19
S
6
Posts: 179
Reputation: 2,202

Post » Thu Feb 12, 2015 2:09 pm

@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.
B
19
S
6
Posts: 179
Reputation: 2,202

Post » Thu Feb 12, 2015 2:35 pm

B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Thu Feb 12, 2015 8:03 pm

@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!! :D
B
19
S
6
Posts: 179
Reputation: 2,202


Return to How do I....?

Who is online

Users browsing this forum: amazingdream, Exabot [Bot], Google [Bot], lordsas, mekonbekon, tarek2 and 56 guests