Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera #2: Demo #14

Open
BlastWind opened this issue Oct 14, 2021 · 2 comments
Open

Camera #2: Demo #14

BlastWind opened this issue Oct 14, 2021 · 2 comments
Labels
Milestone

Comments

@BlastWind
Copy link
Member

BlastWind commented Oct 14, 2021

Priority: Demo, so only after basic framework has been completed
Produce: A camera class that controls what is rendered and how much is rendered

Watch the first two minutes of this video:

Reasons for a camera class:

  1. We need to follow the main character
  2. We might need to follow other characters, during, for example, dialogues and cut scenes
  3. Camera needs to stop panning and following at times (See in video, camera stops following when main character is in a room)
@BlastWind BlastWind added the code label Oct 16, 2021
@BlastWind BlastWind added this to the Demo milestone Oct 16, 2021
@BlastWind
Copy link
Member Author

Some thoughts on the Camera class's API:

public method: 
 void follow (&Actor toFollow)
 void stopFollow()
 void startMovement(array specifying camera panning pattern, duration of each pan, etc, use during cut scenes) 
private field: 
 Actor* following; 

@BlastWind BlastWind changed the title Camera Camera #2: Demo Oct 16, 2021
@aaronamk
Copy link
Member

For reference, see the following method from user_view.cpp in Parryt, which is to be called after every draw update:

void UserView::viewFollow(const Actor &actor) {
	sf::View view = this->window->getView();

	b2Vec2 actorPosition = actor.getBody()->GetPosition();
	view.setCenter(actorPosition.x, -actorPosition.y);

	this->window->setView(view);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants