Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Backgrounds and Parallax System #12

Open
Starciad opened this issue Feb 19, 2024 · 0 comments
Open

Add Backgrounds and Parallax System #12

Starciad opened this issue Feb 19, 2024 · 0 comments
Assignees
Labels
Enhancement Represents an enhancement or improvement. New Represents new features or additions.

Comments

@Starciad
Copy link
Owner

Parallax Background Implementation

Introduction

The incorporation of parallax effect backgrounds is a technique that involves the movement of distinct layers at varied speeds, providing an additional sense of depth to the game's environments.

Description

The parallax effect is achieved through the composition of different layers, each containing sprites that move at various speed rates in response to camera movements on the X and Y axes. To intensify this effect, the same background image is rendered three times consecutively and readjusted as the camera reaches certain limits. This creates the illusion of an infinite scenery without significantly overloading the performance of the system in which the game is being executed.

Implementation

The implementation of parallax backgrounds can be carried out following these steps:

  1. Parallax Layers: Define different layers with sprites that will have parallax movements. Each layer should have a unique movement speed.

  2. Repeated Rendering: Render the same background image three times consecutively, aligning them side by side. This forms the basis for the parallax effect.

  3. Dynamic Repositioning: When moving the camera, dynamically adjust the position of the layers according to the defined speeds. This creates the illusion of depth and differentiated movement between the layers.

  4. Boundary Management: Implement logic to reposition the layers when the camera reaches predefined limits, maintaining the continuity of the parallax effect.

@Starciad Starciad self-assigned this Feb 19, 2024
@Starciad Starciad added Enhancement Represents an enhancement or improvement. New Represents new features or additions. labels Feb 19, 2024
@Starciad Starciad added this to the Version v1.0.0 - Alpha milestone Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Represents an enhancement or improvement. New Represents new features or additions.
Development

No branches or pull requests

1 participant