+ 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
9 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 ć€Œļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ 3O ļ¼Øļ¼„ļ¼¬ļ¼°ć€ posted and if don't quite get it, feel free to ask us! We are ć€Œļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ 3O ļ¼Øļ¼„ļ¼¬ļ¼°ć€xD
25th Aug 2021, 11:58 PM
Vachila64ā˜•
Vachila64ā˜• - avatar
+ 2
ć€Œļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ 3O ļ¼Øļ¼„ļ¼¬ļ¼°ć€ 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ā˜• ć€Œļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ 3O ļ¼Øļ¼„ļ¼¬ļ¼°ć€ , 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
Runtime Terror SurešŸ˜€
28th Aug 2021, 11:07 AM
Avinash
Avinash - avatar