Can someone help me with my camera? I really only just want it to follow the player, but most tutorials or code that I could get my hands on did not work. https://microstudio.io/Heythat/testrun2/

In microstudio there isn't really a camera, so you have to make the logic yourself. For example, what I came up with is using screen.setTranslation(x, y) What it does is translate all drawing operation after you called it by x and y ( for example if you do screen.setTranslation(10, 10) screen.fillRect(0, 0, 100, 100, "white") the rect will be at coordinates 10, 10 )

knowing that, you can do this:

draw = function()
  screen.setTranslation(-x, -y)
  screen.drawSprite("player", x, y, 100, 100)
  screen.drawSprite("enemy", enx, eny, 100, 100)

The player will move for example up and the setTranslation will move it and all other drawing down, so the player will be in the center and every other thing will move

You can also use the approach used in this tutorial: https://sites.google.com/ed.act.edu.au/games-programming/game-elements/scrolling-camera?authuser=0 It uses logic similar to mine. What is interesting is that it uses the clamp function ( which you have to import from one library, I don't remember which one had that ) which make the camera follow the player more smooth


Holy crap thats so cool tysm

https://microstudio.io/i/Loginus/testrun22/ - It works for me . (after a few corrections)

oops slight problem. my sword thing doesnt work anymore lol

ill see if i can fix it tho

Oh did't see you had your project listed on your account. Like loginus did, you can simply continue with the camera system you did ( with his corrections ). Good luck with your project!

okay thanks for the advice guys :D

Post a reply



Validate your e-mail address to participate in the community