<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: How to scroll the background screen continuously from top to bottom</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/713</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:17:50 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/713" rel="self" type="application/rss+xml" />

		<item>
			<title>CoopToons on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/3#post-62415</link>
			<pubDate>Mon, 08 Nov 2010 17:50:36 +0000</pubDate>
			<dc:creator>CoopToons</dc:creator>
			<guid isPermaLink="false">62415@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am in the process of learning Cocos2d and this is a great thread. I have one question. If you do a repeat forever for the background, how can you stop if from moving when the character stop walking and then start it up again when he starts walking again?
</p></description>
		</item>
		<item>
			<title>finklebottom on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/3#post-34628</link>
			<pubDate>Mon, 19 Apr 2010 18:46:03 +0000</pubDate>
			<dc:creator>finklebottom</dc:creator>
			<guid isPermaLink="false">34628@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
Thanks very much for the response and the help.</p>
<p>I played around with your suggestion and think it is working. In your sample code, I altered the init/actions area to be:</p>
<p>// run an action for TTexture @see TTexture.h for info<br />
CCAction *action_1 = [CCRepeat actionWithAction:[CCTextureMoveBy actionWithDuration:2.0f position:ccp(ttexture_.contentSize.height-1,0)] times:1];</p>
<p>CCAction *action_2 = [CCTextureMoveTo actionWithDuration:0.f position:CGPointZero];</p>
<p>CCAction *action = [CCRepeatForever  actionWithAction:[CCSequence actions:action_1,action_2,nil]];</p>
<p>action.tag = kTextureAction;</p>
<p>[ttexture_ runAction:action];</p>
<p>I am not sure if it is there is a more efficient solution, but it looks good to me. I let the sucker run for about 5 minutes and don't see any pixelating like before.  :)</p>
<p>Thanks!!
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/3#post-34617</link>
			<pubDate>Mon, 19 Apr 2010 17:08:24 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">34617@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/7654'>finklebottom</a><br />
I've checked the issue and yeah that does seem to happen for larger values when we repeat. </p>
<p>Since we're using a moveby we can see that the position of the texture will probably be extremely large and those large operations tend to pixelate the texture.</p>
<p>How you can combat this is to reset the actual texture position to the origin position after some number of repeats. For every cycle of the texture (0.f.. 1.f) we'll really repeat the same texture from the beginning so we can use TextureMoveTo to reset the position or just manually reset to a CGPointZero.
</p></description>
		</item>
		<item>
			<title>finklebottom on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/3#post-34411</link>
			<pubDate>Sat, 17 Apr 2010 15:44:13 +0000</pubDate>
			<dc:creator>finklebottom</dc:creator>
			<guid isPermaLink="false">34411@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
First off thank you very much for the help. To your code I added the CCRepeatForever:<br />
CCAction *action = [CCRepeatForever actionWithAction:[CCTextureMoveBy actionWithDuration:20.f position:ccp(10,0)]];</p>
<p>And I commented out the ccTouchesBegan.</p>
<p>When I run the code on my iPod and leave it for 2 or 3 minutes the image gets distorted/pixelated and it gets worst and worst over time.</p>
<p>Does this happen for you? </p>
<p>Thanks again for the help!
</p></description>
		</item>
		<item>
			<title>Shafijami on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/3#post-30480</link>
			<pubDate>Wed, 17 Mar 2010 14:54:47 +0000</pubDate>
			<dc:creator>Shafijami</dc:creator>
			<guid isPermaLink="false">30480@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>First this is my apologies to all whom my last question caused any inconvenience!</p>
<p>Now @<a href='http://www.cocos2d-iphone.org/forum/profile/51'>jd</a><br />
If I stuck at some point... I'll try to do things in other ways... and once got the expected result I'll move for next. If result is unexpected after few trials even then I'll prefer to move towards rest of the things need to be done to maintain the process. But all time I'll be keen to know how those things can be done in smarter ways... not just for getting the result by hook or by crook. Any way this my way of occupation concern. And I'm sure every programmer has his/her own way of occupations concern. Also I never heard such definitions for a programmer and developer!</p>
<p>Thus far I've been part of this blog, for 3 times for asking any help. First 4 months ago, 2 days back and last on yesterday. My first time asked questions was not been answered and so I moved to other blogs where several times I asked almost same questions. A few people have tried to helped me out in the ways I've already tried and not been satisfied by the result. So I moved back to this blog and once agin asked the question. So the ANNOYED was not for you people or others (from other blogs) but for SITUATION I was facing. Thats it.</p>
<p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1222'>abitofcode</a><br />
Thanks for help. I'm sure this will work fro me in some way.... thanks</p>
<p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
I'm really sorry for all from my side that cause any inconvenience to you people. You and riq are the lives of this blog. I really don't meant that for you people. I'm just sharing my experience for other blogs and the situation I was struggling with.</p>
<p>And lastly I withdraw with my questions asked 1 day back.
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-30328</link>
			<pubDate>Tue, 16 Mar 2010 18:07:04 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">30328@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/3305'>Shafijami</a><br />
I'm sorry that I've annoyed you. I did not intend any harm, it was probably me misunderstanding your question =/</p>
<p>I feel as though I still don't quite understand what you are still asking, so I'm not too comfortable in responding again.</p>
<p>If you are having so many problems it may be that you can't actually easily use actions but may have to implement your own routine in a scheduled method. With some math, you can specify scale and position directly.
</p></description>
		</item>
		<item>
			<title>abitofcode on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-30327</link>
			<pubDate>Tue, 16 Mar 2010 17:59:45 +0000</pubDate>
			<dc:creator>abitofcode</dc:creator>
			<guid isPermaLink="false">30327@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Scrolling's a bit of an open ended question, there are numerous ways of achieving the result you want. I find planning the effect I want on paper in some detail and then setting out to achieve that effect is far more productive than picking up various code snippets. </p>
<p>Some questions I'd be asking before I got near any code;<br />
1. Are you simply scrolling top to bottom or are you trying to simulate a vanishing point<br />
2. Can everything appear in one atlasSpriteManager or are you going to want particle effects to appear underneath your objects? (better planned out at the beginning than having to incorporate mid way through)<br />
3. Will the Z of the sprite change over time i.e if you are in some sort of perspective mode you may have some sprites going faster than others in whhich case you will need to manage the depth of each sprite.<br />
4. If using a perspective effect, how big are the Sprites when they come on the screen at the bottom, how big will they be when the go off the top, is the initial size going to limit the number of sprites you can move slowly.<br />
5. Are you repeating the background or will you be changing it at intervals</p>
<p>This post may help with the scaling part <a href="http://www.cocos2d-iphone.org/forum/topic/1813#post-11343" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/1813#post-11343</a></p>
<p>Sorry for the vague reply but the question is a bit generic.
</p></description>
		</item>
		<item>
			<title>jd on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-30321</link>
			<pubDate>Tue, 16 Mar 2010 17:04:14 +0000</pubDate>
			<dc:creator>jd</dc:creator>
			<guid isPermaLink="false">30321@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Are you a programmer like your occupation mentions?  Maybe there is a difference between programmer and a developer.  A developer would not be stuck for 2 weeks waiting for the code solution to be given to them.  A developer would write code to address the issue and then maybe if they had trouble with one part they would post that code for help.</p>
<p>It's very rude to tell people that are attempting to help you that you are ANNOYED just because they aren't giving you the exact answer you are looking for.
</p></description>
		</item>
		<item>
			<title>Shafijami on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-30288</link>
			<pubDate>Tue, 16 Mar 2010 10:41:04 +0000</pubDate>
			<dc:creator>Shafijami</dc:creator>
			<guid isPermaLink="false">30288@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>For me its  really not expecting for Cocos2D that it doesn't have any example on continuous scrolling a few sprites (say: from top to bottom). There are examples on sprites, sprite managers, textures, tile maps etc. which demonstrate scaling and scrolling of stuffs. But I'm unable to find any example which can show continuous scrolling few sprites one by one and scaling them accordingly. </p>
<p>For help I would request here to provide me with some code snippet which can demonstrate: how to scroll two sprites one behind another and scale them properly. Spawn helps us combining several action, moveby, moveto, scaleby etc. but if there are more than one sprites coming from top to bottom (like the moving road in the above question), then how to update their speeds, scale factor etc.</p>
<p>For example: we have<br />
A:-<br />
sprite1 and sprite2 each of height 40<br />
sprite1 pos is (240, 80)<br />
sprite2 pos is (240, 60) --(is just behind sprite1)<br />
sprite1 y scale is set to 0.30   (size changed)<br />
sprite2 y scale is set to 0.20 (size changed)</p>
<p>both sprites start moving from top to bottom<br />
a scheduler function "update" (provided in spawn method) is invoked. (my own way, if there is a better way help me out plz)</p>
<p>B:-<br />
in update function we got the changes like:<br />
sprite1 pos is (240, 100)<br />
sprite2 pos is (240, 80)</p>
<p>Now i changed the y scale of sprite1 to 0.35 (sprite1 size changed, it stretched a few pixel bottom as well top)<br />
NOW HERE I'M UNABLE TO DETERMINE THE REQUIRED SCALE FACTOR for sprite2 so that it can be positioned just behind the sprite1 and also can have some change in y towards bottom.</p>
<p>Well, sprite was moving with certain speed say: 10 pixels in 1 sec<br />
I want to change it to 15 pixels in 1 sec.<br />
-------------------------------</p>
<p>I'm sorry for asking like this... a layman style. I've asked few times the same questions... people here suggested to use GL_REPEAT or repeatForEver, sclaeBy etc. like that with Spawn. So I just get annoyed. There are a few posts about continuous scrolling of sprites but nothing for scale and speed controls and of course sprite moving behind another.<br />
So I'm not going to scroll clouds (right to left or vice versa) where we may not have to maintain scale factors. I need to move few sprites from top to bottom where changes in the positions of each sprite directly associated with changes in scales.</p>
<p>Please reply with a few code snippet. I've stuck at this point for last few weeks.</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-30016</link>
			<pubDate>Sun, 14 Mar 2010 02:12:28 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">30016@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/3305'>Shafijami</a></p>
<p><em><br />
Can we use scaleBy and MoveTo to work simultaneously instead of the fashion like: finishing one action then starting next?<br />
</em></p>
<p>A CCSpawn will allow you to run simultaneous actions together so yeah you can run scaleBy and MoveTo.  </p>
<p>If you're talking about the actions for the Transform Texture then they should work as well so TextureScaleBy and TextureMoveBy is very similar to ScaleBy and MoveBy but read the header comments which explains all that.</p>
<p><em><br />
Also is there any callback function where I can watch and control current position &#38; speed for each moving sprite?</em></p>
<p>I'm not sure what that means but you can have finer control over the Transformable Texture by accessing the transform texture struct directly. This does mean that you won't be using the actions I created.</p>
<p><em><br />
Actually I've to clone the moving road (background) of this game<br />
</em></p>
<p>Oh I see. Well that game brings up an idea. Since the road is stretched to simulate a 3D perspective, you can get the same effect, I believe, by taking advantage of texture mapping. Rather than map onto a quad why not try a trapezoid?
</p></description>
		</item>
		<item>
			<title>Shafijami on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-29931</link>
			<pubDate>Sat, 13 Mar 2010 11:38:55 +0000</pubDate>
			<dc:creator>Shafijami</dc:creator>
			<guid isPermaLink="false">29931@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a>... I've tried out your code snippet (POSTED 7 MONTHS AGO #) and it works fine for me. This is what I've asked here (few months back) plus how to scale moving sprite simultaneously. So that sprites sizes become bigger &#38; bigger while they come closer &#38; closer.</p>
<p>Can we use scaleBy and MoveTo to work simultaneously instead of the fashion like: finishing one action then starting next?<br />
Also is there any callback function where I can watch and control current position &#38; speed for each moving sprite?</p>
<p>Actually I've to clone the moving road (background) of this game: <a href="http://www.mindjolt.com/games/crazy-cabbie" rel="nofollow">http://www.mindjolt.com/games/crazy-cabbie</a></p>
<p>Any code snippet please! I'm avidly waiting of your reply.<br />
_Thanks
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-29581</link>
			<pubDate>Wed, 10 Mar 2010 21:01:27 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">29581@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yeah but remember that there is an upper limit depending on the device. It's either 1024 or 2048.</p>
<p>Other than that, all you need to remember is to keep the texture a power of 2 (2,4,8,16,32,...,256,512,1024).
</p></description>
		</item>
		<item>
			<title>bytex on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-29575</link>
			<pubDate>Wed, 10 Mar 2010 20:40:49 +0000</pubDate>
			<dc:creator>bytex</dc:creator>
			<guid isPermaLink="false">29575@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a>,</p>
<p>Is it possible to use texture which is more than 512 pixels ? For example I have repetitive texture which is 1024 pixels.w
</p></description>
		</item>
		<item>
			<title>hugocosta on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-27631</link>
			<pubDate>Mon, 22 Feb 2010 16:51:04 +0000</pubDate>
			<dc:creator>hugocosta</dc:creator>
			<guid isPermaLink="false">27631@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a></p>
<p>Thank you for your answer, it pointed me to CCRepeatForever and use it with CCTextureMoveBy. I guess i need to study a little more about coco2d. :)</p>
<p>This did the trick, and provides an endless vertical scrolling sprite/background:</p>
<p>CCAction *action = [CCRepeatForever actionWithAction:[CCTextureMoveBy actionWithDuration:20.f position:ccp(0,-10)]];
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-27620</link>
			<pubDate>Mon, 22 Feb 2010 16:15:04 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">27620@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/7113'>hugocosta</a><br />
Yeah you can add a forever action to scroll forever. They're set up so that all actions in cocos2d work so you can repeat them, sequence them, spawn them and ease them. They work like standard MoveBy, RotateBy, etc, actions.</p>
<p>Sometimes you don't want to just scroll forever and have more detailed control by accessing the textureTransform property. For example the background may scroll depending on the movement of the player.</p>
<p>Hmm... I guess the demo doesn't explain all the things I can do with texture transformations. Maybe i'll make a post about it sometime this week to give a little more insight into the CCTransformTexture class.
</p></description>
		</item>
		<item>
			<title>hugocosta on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-27616</link>
			<pubDate>Mon, 22 Feb 2010 15:58:18 +0000</pubDate>
			<dc:creator>hugocosta</dc:creator>
			<guid isPermaLink="false">27616@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>By your question i probably misunderstood how your code works .<br />
In your demo the scrolling, rotate and scale do not repeat forever. Is this as it is supposed to work?<br />
I need to scroll a background "forever", can i do that?</p>
<p>I've tried it both on the simulator and iphone.
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-27615</link>
			<pubDate>Mon, 22 Feb 2010 15:31:43 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">27615@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/7113'>hugocosta</a><br />
That is really strange. Do you mean it actually stops at a certain amount even though you specify more? What can I do to replicate the problem?
</p></description>
		</item>
		<item>
			<title>hugocosta on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-27613</link>
			<pubDate>Mon, 22 Feb 2010 15:16:46 +0000</pubDate>
			<dc:creator>hugocosta</dc:creator>
			<guid isPermaLink="false">27613@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a> Excelente job!</p>
<p>After testing it the background only loops for x amount of times. Even on your last code. Is this normal?</p>
<p>I'm using coco2d 0.99.0 Final and Xcode 3.1.2
</p></description>
		</item>
		<item>
			<title>adpro on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-26479</link>
			<pubDate>Fri, 12 Feb 2010 15:46:39 +0000</pubDate>
			<dc:creator>adpro</dc:creator>
			<guid isPermaLink="false">26479@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>LAM!!!</p>
<p>Thank you so much for that!!</p>
<p>Just wondering, though.  Is there a way to get two images in there and scroll one after the other?</p>
<p>I'm going to poke around to see what I can figure out, but I thought I would ask to see if you have a good way of doing this.</p>
<p>Thank you so much for sharing that!  It's exactly what I needed and it works really well!
</p></description>
		</item>
		<item>
			<title>gnusma on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-26099</link>
			<pubDate>Tue, 09 Feb 2010 16:01:39 +0000</pubDate>
			<dc:creator>gnusma</dc:creator>
			<guid isPermaLink="false">26099@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
Thank you!!! Works fine!</p>
<p>@riq<br />
Such an easy way for endless background scrolling should be included in the next cocos version ;-)<br />
i know in the texture2d demo is an approach for repetitive textures, but i like Lam's code...it's so simple to use
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-25899</link>
			<pubDate>Mon, 08 Feb 2010 00:00:57 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">25899@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm on it!</p>
<p>I've now fixed up the class for cocos 0.99.0-rc and made some changes to it's name. The demo will sort out all your issues I hope.</p>
<p><a href="http://dl.dropbox.com/u/271717/TransformTextureDemo.zip">Transform Texture Demo</a>
</p></description>
		</item>
		<item>
			<title>gnusma on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-25874</link>
			<pubDate>Sun, 07 Feb 2010 18:45:50 +0000</pubDate>
			<dc:creator>gnusma</dc:creator>
			<guid isPermaLink="false">25874@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
An update would be necessary for cocos 0.99.0-rc ;-)
</p></description>
		</item>
		<item>
			<title>blablablu on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-19255</link>
			<pubDate>Sun, 22 Nov 2009 22:20:30 +0000</pubDate>
			<dc:creator>blablablu</dc:creator>
			<guid isPermaLink="false">19255@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a> &#38; riq<br />
Thanks for the support! both of you helped me a lot!
</p></description>
		</item>
		<item>
			<title>riq on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-19151</link>
			<pubDate>Sat, 21 Nov 2009 00:36:41 +0000</pubDate>
			<dc:creator>riq</dc:creator>
			<guid isPermaLink="false">19151@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/3577'>blablablu</a>: also check the <code>tests/Texture2dTest.m</code> that comes with cocos2d.<br />
It shows how to use repetitive textures.
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-19149</link>
			<pubDate>Sat, 21 Nov 2009 00:00:04 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">19149@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/3577'>blablablu</a><br />
Ok I've recreated it for 0.9 but I also improved it a bit. Some things are changed but the example shows its usage.</p>
<p><a href="http://www.mediafire.com/?xjnnwznxw21" rel="nofollow">http://www.mediafire.com/?xjnnwznxw21</a>
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-19143</link>
			<pubDate>Fri, 20 Nov 2009 21:00:46 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">19143@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/3577'>blablablu</a><br />
Oh hmm... i guess yeah I could do that. Didn't know if anyone was really using it
</p></description>
		</item>
		<item>
			<title>blablablu on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-19127</link>
			<pubDate>Fri, 20 Nov 2009 16:43:05 +0000</pubDate>
			<dc:creator>blablablu</dc:creator>
			<guid isPermaLink="false">19127@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1700'>Lam</a><br />
Will you customize your code for cocos 0.9.x?</p>
<p>There are some warnings and the scrolling doesn't work any more.</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>Shafijami on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-17691</link>
			<pubDate>Sat, 07 Nov 2009 13:32:02 +0000</pubDate>
			<dc:creator>Shafijami</dc:creator>
			<guid isPermaLink="false">17691@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for this valuable support. I need help regarding few things.<br />
How could we scroll images repeatedly in such a way that it looks like being closer when an image comes to the bottom of the screen while another one which is at the top of the screen looks farther. For example if we need a road looks moving towards us continuously. The big problem is I'm facing problem in scaling and positioning the images of road.</p>
<p>Also how could we trap the position of each image added to the SpriteManager. I want to control the scrolling object with its position and its speed (scale factor and position).</p>
<p>The thing is that I want to run a car on the road ( with its separator sign). So I want to move the road while the car will remain in the same position (in the middle of the screen).</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>QcMat on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-16100</link>
			<pubDate>Wed, 21 Oct 2009 04:36:52 +0000</pubDate>
			<dc:creator>QcMat</dc:creator>
			<guid isPermaLink="false">16100@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>That's what I've been doing. The last column of pixels on an image is the same as the first column of the next image. An image is placed every 479 pixels.
</p></description>
		</item>
		<item>
			<title>Lam on "How to scroll the background screen continuously from top to bottom"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/713/page/2#post-16098</link>
			<pubDate>Wed, 21 Oct 2009 04:27:45 +0000</pubDate>
			<dc:creator>Lam</dc:creator>
			<guid isPermaLink="false">16098@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Another way to implement this would be rewriting the TextureNode class a bit with of calls to transform the Texture itself.</p>
<p>I wrote a class that will scroll backgrounds using cocos2d actions so it may be more easier to setup quickly. It actually rotates and scales images inside the sprite as well!. You can use it without needing to credit me but I hope it makes scrolling backgrounds and other funky texture transforms easier.</p>
<p>What you do is set the texture you want to GL_REPEAT in the tex params. Then you call some actions like:<br />
<pre><code>// Create a TTextureNode which is an extension of TextureNode (pretty much like a sprite)
TTextureNode *node = [TTextureNode node];

// add a texture image it&#39;s nicer if it&#39;s a square sized image that&#39;s a power of 2.
node.texture = [[TextureMgr sharedTextureMgr]addImage:@&#34;RepeatingClouds.png&#34;];

// Smooth texturing with GL_LINEAR if you scroll, and GL_REPEAT continously repeats image
ccTexParams texParams = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT };
[node.texture setTexParameters:&#38;texParams];

// run a scroll action, if you notice that the position moved by is (1.f,0.0f). That is because a texture positioning is always normalized to [0.0..1.0] so moving 1.f is moving through an entire texture image.

// This moves the texture inside the node leftwards to the end in 1 minute but then repeats forever
[node runAction:[RepeatForever actionWithAction:[TextureMoveBy actionWithDuration:60.f position:ccp(1.f,0.f)]]];

// OR

// This moves the texture inside the node leftwards &#39;looping 5 times&#39; in a minute
[node runAction:[TextureMoveBy actionWithDuration:60.f position:ccp(5.f,0.f)];</code></pre>
<p>I placed the code @ this section if anyone is interested in checking it out.</p>
<p><a href="http://code.google.com/p/cocos2d-iphone/issues/detail?id=543&#038;colspec=ID%20Type%20Status%20Priority%20Milestone%20Component%20Owner%20Summary" rel="nofollow">http://code.google.com/p/cocos2d-iphone/issues/detail?id=543&#038;colspec=ID%20Type%20Status%20Priority%20Milestone%20Component%20Owner%20Summary</a></p>
<p>The TTextureNodeTest hopefully will explain and make everything clear. The main class is called TTextureNode.
</p></description>
		</item>

	</channel>
</rss>

