|
Hello world,
Finally Friday! Today I have been tweeking the clouds paralax function by making them slowly move to the left. When I gametested it I realized that when the camera started to move to the right (again – I have attached the paralax functions to the camera movement rather than the player movement) the clouds just took off in a high speed to the left – not very realistic. So I added two if-functions saying that if the camera moves to the right it would add to the cloud speed (which is on minus since it is moving to the left) and therefore making it slow down instead of speeding away like a racer car, and the same (but the opposite) if the camera moves to the left – adding minus to the cloud movement instead of plus. If that makes sense. I would not get it if it was not my code.
I also added an additional gamearea-sprite that will spawn when the player (yes the player this time, not the camera) hits a certain x-coordinate, simulating how we will spawn more of the game as the player moves rather than drawing it all at once. It also despawns when the player moves back from it again, simulating how the game-area we do not see will be deleted and therefore not taking up space in our game.
An in-game look of what I am writing about. The small dot is the center of the camera (the center of what we see), the big dot is the player, the light-grey area + the dark(er) grey area is the first game-area sprite (the light-grey is where you can actually walk), the darkest grey area behind that is an horizon-paralax, the clouds are…well, the clouds, and the blue area is the next game-area with the exact same function as the previous one except from the fact that the blue will appear or be removed depending on what position on the X-axis the player has.
As I am writing this I started to wonder why I made the clouds blow from the right to the left and not the opposite. Maybe I should ask the group for a bigger reflection since the direction of the cloud movement can be interpreted in different ways and either add to the mood were striving for in the game or reduce it. Or maybe I am over analyzing things as a former art student. But I will probably ask the group anyway.

|