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

hi,I mean camara feauture is camera's follow ,not ordinary's camera #30

Closed
sonygod opened this issue Jul 9, 2012 · 6 comments
Closed

Comments

@sonygod
Copy link

sonygod commented Jul 9, 2012

hi,I try to mean camara feauture is camera's follow ,not ordinary's camera
example ,from some 2d game like Mario,the camera always target mario when him moving ...

@aduros
Copy link
Owner

aduros commented Jul 9, 2012

What you could do is have a Camera component that centers the parent sprite onto the character in its onUpdate. I'm working on a platformer game and doing something similar.

@sonygod
Copy link
Author

sonygod commented Jul 10, 2012

ok,and one more question.how about multiple camera ? such like http://flixel.org/features.html#cameras
and hope flambe will get these feature in coming version..

@aduros
Copy link
Owner

aduros commented Jul 11, 2012

Oh, I see. flambe.platform.DrawVisitor should be moved to the public API to make this possible. I'm planning to do this anyways for issue #11 :)

@aduros
Copy link
Owner

aduros commented Jan 13, 2013

I'm going to mark this as closed, as it's now trivial for users to implement cameras by using Sprite.render() and scissor rectangles.

@aduros aduros closed this as completed Jan 13, 2013
@sonygod
Copy link
Author

sonygod commented Jan 14, 2013

any demo or democode for these feature?

@aduros
Copy link
Owner

aduros commented Jan 14, 2013

I'm pretty sure all you want is something like this (untested):

class ViewSprite extends Sprite
{
    public function new (view :Entity)
    {
        _view = view;
    }

    override public function draw (g :Graphics)
    {
        Sprite.render(_view, g);
    }

    private var _view :Entity;
}

Then you can create multiple ViewSprites that share the same view, and you can position and scissor them individually.

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

No branches or pull requests

2 participants