Re: [kivy-users] Re: Scrolling background horziontally in Kivy.

166 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

skeezix

unread,
Oct 10, 2012, 4:03:06 PM10/10/12
to kivy-...@googlegroups.com
On Wed, 10 Oct 2012, Waffle wrote:

# Anyone know how to do this? Or can it even be done?
#
# Heres another image: http://i514.photobucket.com/albums/t346/PutterWatch/3D_BG_Test2.gif
#
# It scrolls and makes it look like the room lasts forever.

I'm going to be getting into it myself soon, but I've just rather
assumed using some Transforms and order of operation tricks?

--
If everyone would put barbecue sauce on their food, there would be no war.

Gabriel Pettier

unread,
Oct 10, 2012, 6:45:55 PM10/10/12
to kivy-...@googlegroups.com
Ok, i spent some time on this, and i think this is an acceptable
solution,
https://gist.github.com/3868962

used images comes from
http://en.wikipedia.org/wiki/Parallax_scrolling#Example

The only weird stuff about this would be the tex_coords, i'm not a
champion (and got some pretty funny result trying ^^) but i used the
doc here to get something
http://kivy.org/docs/api-kivy.graphics.instructions.html#kivy.graphics.instructions.VertexInstruction.tex_coords.

We tried a bit with tito to come with a solution more kv oriented, but
that required ugly changes to the kv parsing, that tito was able to
make but that he didn't like, and the kv that made possible wasn't as
nice is we'd want, so this is pure python.

However there was probably more than a few, if less efficient, easier
solutions to this, and showing some research on the subject before
asking always help people feel more compeled to help.
Message has been deleted

Gabriel Pettier

unread,
Oct 11, 2012, 4:25:15 AM10/11/12
to kivy-...@googlegroups.com
I did a quick drawing that should make the tex_coords manipulation
easier to understand, and we are thinking about how to make the api doc
more useful on that.

http://pub.tshirtman.fr/tex_coords.png

however, this image can be wrong depending on other parameters
(uvsize/uvpos) and maybe other things, so we can't just put it in the
doc, we need additional explanations with it.

this blog post, even if not about kivy at all, can help you getting the
concepts too,
http://blogs.msdn.com/b/danlehen/archive/2005/11/06/489627.aspx

And yes, you can do rotations, deformations of all kinds and such with
it i had funny results when changing numbers there and there :)


On jeu. 11 oct. 2012 02:14:00 CEST, Waffle wrote:
> Wow thanks t shirt man and tito. You both did a good job. I can make
> infinite type games now. This is really really awesome work.
>
> I only have one question remaining; Is there a way to move the
> background vertically or on an angle? I don't fully understand the
> txupdate function fully to be able to do this myself.
>
> Thanks for your help!
> --
>
>


Reply all
Reply to author
Forward
Message has been deleted
0 new messages