Parallax scrolling in direction of movement

Get help using Construct 2

Post » Thu Apr 04, 2013 11:08 pm

Currently, I have a scrolling starfield in my space game that moves from right to left across the screen. This effect is nice, but I want something more immersive: I want the starfield to scroll in the opposite direction of the player movement.

For example, when the player ship moves up on the screen, the starfield will scroll down at some speed (there will be a speed cap for the scrolling).

Does anyone have ideas on how this would be done?
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Thu Apr 04, 2013 11:48 pm

[QUOTE=Excal] Currently, I have a scrolling starfield in my space game that moves from right to left across the screen. This effect is nice, but I want something more immersive: I want the starfield to scroll in the opposite direction of the player movement.

For example, when the player ship moves up on the screen, the starfield will scroll down at some speed (there will be a speed cap for the scrolling).

Does anyone have ideas on how this would be done?[/QUOTE]


I think that would depend on how your scrolling your starfield. Lets say you set your starfield background as a bullet. If its set as a bullet you can change its bullet angle of motion to the direction of the player, then have it respawn in the same angle as the bullet angle of motion.

Honestly, I'm not to sure either but I thought I could pop up some idea in your mind. I may try to figure out how by this weekend unless you get a better response to answer your question
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Fri Apr 05, 2013 12:17 am

I believe the solution is actually really simple. I just had a really long Spring Break and wasn't back into the C2 mindset of things again.

Basically my starfield is currently scrolling in one direction. It's simply a matter of setting the scroll direction to equal the player ship angle - 180 every tick.

However, I'm not sure if every tick is a good way to go about it. There could be performance issues with using that fast of an update.Excal2013-04-05 00:17:53
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Fri Apr 05, 2013 3:31 am

I tried using bullet, but the problem is that behavior causes the starfield to rotate when the angle of motion is changed. I replaced bullet behavior with CustomMovement and now it seems to be working.

Now I need opinions on smoothing this out. You can play the latest version of the game here. Please let me know if the effect is too fast or too slow!
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Fri Apr 05, 2013 8:50 am

Trigger it on the key press that the player uses to change the ship direction, or whatever events are related to the ship changing direction...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Thu Dec 19, 2013 1:05 pm

The background layer, or any layer properties (top left when you select a layer) has parallax values, set them 30,30 and see what happens.
B
6
S
2
Posts: 10
Reputation: 610


Return to How do I....?

Who is online

Users browsing this forum: Vodakman and 20 guests