I am working on a game. And I have been incorporating S4P and I was thinking what is the best to move the player within the world. Currently I keep the player in the middle of the screen and just used S4P.moveWorldBy(). Any better take ons ? Or is this fine ?
I have not seen your game but one problem might be disorientation because the world is always moving.
Another approach you might consider is to allow the player to move within a rectangular area that is smaller than the sketch window box but also centred on the sketch window, then only move the world if the player attempts to leave this area.
The world is large, players can move freely and the sketch window only gets to see a portion of it. So I am looking for a good camera system. As you said shifting the world will be disorientating especially that there are tiles and enemies. Does S4P encorpora! te any camera system ? If not any take on a library that does ?
Also soon I will feature a demo of the game here ! To receive criticism on how to improve it ! As I plan to release it!
S4P is a 2D sprite system so a camera system would simply decide on where the centre of the viewable area is and the display scale. S4P provides several methods to change this view e.g.
plus methods to convert between world and display coordinates.
So although S4P does not have a camera system per se all the core stuff is there to represent a camera. It is unlikely that a 3rd party camera system would integrate as well with S4P.
So I guess I am on the right track ! I guess I am just gonna make a wrap around class for moveWorldBy. Also the .isOnSceeem() works great for only rendering tiles that are seen on the screen I love it. That also fixed the issue from my ControlP5 post!
I am a great fan of object orientated programming so creating a camera class could be good provided there is a real need for the class and its design is based on sound object orientated principles.
There is a need indeed! I will make sure to make a sophisticated one. Before the end of tonight I will showcase what has been done. To receive feedback on improving performance !