Page 1 of 3

Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 1:43 am
by davisdude
Verson 0.3.1 is out! This version includes :adjustScale and :adjustPosition (admittedly, based off of Kikito's gamera). Check out the newest demo to test it out.

Hello all! I've been working hard on a camera library with parallax scrolling, and I think it's finally presentable.
Check it out here.
Please try out the demo and let me know what you think! :)

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 4:14 am
by ivan
At first I thought this was a Computerphile/periodic videos reference... reading the docs I see you meant the Civil war photographer. :)
Not bad, the code seems straight forward.
Regarding point transformations, I usually prefer to use an external module, but your approach is fine.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 8:20 am
by kikito
This is not bad, but I will definitively and absolutely recommend getting rid of the manipulation of _G.

The user already can get the layers when doing newLager and getLayer; it's not that losing the _G would suppose a great sacrifice. On the other hand, there are plenty of drawbacks.

Here's one example: imagine what would happen if another library (say, a sound library) also modified _G. People would have to choose between using your camera system or the sound system, because they are not compatible (or worse, they are compatible but break each other in subtle ways).

The extra "comfort" of being able to use the layer names directly is a very bad tradeoff.

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 10:00 am
by davisdude
@ivan:
Thanks for the kind words! Your coordinate method is very advanced to.
I had not heard of Computerphile Brady, but some of his videos do look interesting...

@kikito:
I had not thought about multiple libraries modifying _G, although I guess I'm not the only person allowed to modify _G :P
You're right, of course- using the returned variables does make a lot more sense. I'll probably push an update some time this afternoon.

In the meanwhile I'll be trying to think of some useful functions that I can add.
So far, I've got:
- screenShake( intensity, duration ) -- or should it be duration, intensity?
- Some function to clamp the camera's scale/rotation/etc. to the map (this would also need you to define "world" size).

Does anyone have any other recommendations?

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 12:53 pm
by kikito
davisdude wrote:Does anyone have any other recommendations?
How many do you want? :rofl:

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 1:24 pm
by adnzzzzZ
lead, lerp, follow styles/deadzones, you can see an example of those here http://haxeflixel.com/demos/FlxCamera/

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 3:30 pm
by qubodup
The demo is fun :)


PS: keypresses displayed by key-mon

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Thu Apr 02, 2015 7:45 pm
by davisdude
Version 0.2.0 has been released:
- Removed metatable from _G
- Updated and edited README.md
qubodup wrote:The demo is fun :)
Thanks! Personally, I like to rotate and make all sorts of loops :D
adnzzzzZ wrote:lead, lerp, follow styles/deadzones, you can see an example of those here http://haxeflixel.com/demos/FlxCamera/
I'll have to check those out!
kikito wrote:How many do you want? :rofl:
Good thing I have a break coming up! That's quite a bit of suggestions... :shock:

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Sun Apr 05, 2015 3:18 am
by davisdude
Update! Version 0.3.1 is released! This includes features such as:
- :setWorld
- :adjustScale
- :adjustPosition
(last two heavily based off of Kikito's work...)

More features are planned, so stay tuned! :)

Re: Brady- A Camera Library with Parallax Scrolling

Posted: Wed Oct 14, 2015 4:34 pm
by Fantos
Hi there, I have a problem with your library. I change from gamera to this library, and after setup the camera I got this:
PICTURE
That blue box ( what I get with cam:getVisible) exactly what I need the camera to see, but for some reason it show the whole map, like adjustScale do nothing, and I don't know anymore whats going on with the camera. Here the lua code where I try to use the camere:LINK