+ 3

How to make camera in platformer game?

Hello, I am making a platformer game in canvas using js. I have done tile collision and response part but I'm unable to make player's camera. Basically I want to make a camera which follows the player. Here is the code: https://code.sololearn.com/WWO2W5We2L3e/?ref=app If you know how to do it, please help and guide me!

25th Aug 2021, 6:59 AM
Avinash
Avinash - avatar
7 Answers
+ 2
Senku I would've attempted to explain how a camera works, but I don't think that's nessecary anymore when the exact personn I learnt from shared the exact code I learnt from😂❤️ Do check out what 「HAPPY TO HELP」 posted and if don't quite get it, feel free to ask us! We are 「HAPPY TO HELP」xD
25th Aug 2021, 11:58 PM
Vachila64☕
Vachila64☕ - avatar
+ 2
「HAPPY TO HELP」 Was thinking something similar...also...Senku if you want a fixed background, perhaps you could avoid drowning the background tiles (the light blue ones) and instead fill the whole canvas with that color, before translating the canvas then draw just the collidable tiles on top of that
26th Aug 2021, 3:40 PM
Vachila64☕
Vachila64☕ - avatar
27th Aug 2021, 6:54 PM
Avinash
Avinash - avatar
25th Aug 2021, 7:15 AM
Avinash
Avinash - avatar
+ 1
Hey Vachila64☕ 「HAPPY TO HELP」 , I tried it but whenever I move the player, some lines are render in canvas. How can I fix it and How can I improve it. https://code.sololearn.com/W9bsL31CB9Ij/?ref=app
26th Aug 2021, 5:26 AM
Avinash
Avinash - avatar
0
28th Aug 2021, 11:07 AM
Avinash
Avinash - avatar