Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: 4ppleseed on May 27, 2014, 07:28:58 AM
-
Hi all, I'm surprised this hasn't been asked (I did a search - maybe it's under a different name?)
I want a background image to constantly scroll (al la Flappy Bird) - is there an easy way to do this in Playmaker?
Thanks 8)
-
If your background graphic tiles horizontally, you can simply combine a "Float Interpolate" with a "Set Texture Offset" action every frame.
-
Thanks! I've given it a go and it doesn't seem to be working quite right. Here's the Float Interpolate and the background texture...
(http://imgur.com/po4jlqF.jpg)
and here's the Texture Offset but it's just distorting the texture and it remains static...
(http://imgur.com/WC9waoW.jpg)
Any idea where I'm going wrong?
:D
-
I can't offer any help on Graham's solution, but I can maybe offer a second method for you to try:
1.Create a new empty game object, call it "texture animator" or anything you like.
2.Create an FSM on this object, and add a global float variable called "bg texture offset" or whatever you'd like.
3.Use a "set property" action, targeting the material that you have applied to your background. The "property" variable should be set to "mainTextureOffset.X" (or possibly ".z"). The "X" variable should be set to the global variable you created earlier. Check the box "every frame".
4.In a new FSM (can be a second FSM on the same object, or a new object entirely), modify the global variable using float add every frame, or use the iTween actions. There are lots of ways to icnrease the value of a float, pick you favorite and make sure it's happening every frame to ensure constant motion.
Hope this helps!!
-
That worked. I followed your instructions and then I just needed to add Every Second to the Float Add as well and it started scrolling.
Thanks guys :)