How do I Textscroller

Get help using Construct 2

Post » Mon Nov 28, 2016 1:12 pm

hello,
so i want to enhance the text scroller, that scrolls from right to left on the screen.
At the moment i have:
System | every tick | Text | set X to self.x-2
Text | x < -800 | Text | Set X to 856

how can i have the text make some funky sinus like curve.
B
79
S
28
G
108
Posts: 194
Reputation: 59,906

Post » Mon Nov 28, 2016 6:03 pm

So you want to have the text moving up and down (using sine) while moving it from the right to the left?

Add a "Sine" behaviour to the text, set movement to vertical.
Adjust every other value to your liking.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Nov 28, 2016 8:05 pm

Yes thanks thats working! Any tips for making it scroll on a sinus path. *I MUST learn more...
B
79
S
28
G
108
Posts: 194
Reputation: 59,906

Post » Mon Nov 28, 2016 8:14 pm

Um. Doesn't the events I posted do exactly that?
Or, if not, could you specify what you mean by scroll on a sinus path?
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Tue Nov 29, 2016 2:25 am

Yes its working fine, but i want the words being on the sinus path and not the whole text.
At the moment it looks like that.
http://imgur.com/a/kfFcY
B
79
S
28
G
108
Posts: 194
Reputation: 59,906

Post » Tue Nov 29, 2016 11:12 am

Hi,
I'm kinda new at this and my code style might be off a bit but I think this is what your after :D
Code: Select all
https://drive.google.com/file/d/0B2ztlkoVxR-FNmJnWWYzUlVsVlU/view?usp=sharing
B
12
S
3
G
2
Posts: 38
Reputation: 1,380

Post » Tue Nov 29, 2016 2:54 pm

@WhosWho beautiful sinus scroller ! thanks for sharing! Now i must decode your source and study that stuff.

How can i avoid the double sinus scroller if i change the Text to more words.
Is the best way to do a scroller, to do the Set X to self.X-2 or is there a better way of doing this? Just saw some lags on the scrolling, maybe its my slow PC?!
Why do you do the first two system calls: system | set Length to len(TextToDisplay.Text) and
system | Set TheWord to TextToDisplay.Text?

Also you but all into a loop can you explain a little bit why you do :
WAIT 0.5*loopindex seconds
and
ScrollingBox |Set text tokenat(Word,count,"")
Image
B
79
S
28
G
108
Posts: 194
Reputation: 59,906

Post » Tue Nov 29, 2016 4:28 pm

Hi totoe, glad I could help. I'm just heading to work now but will do a full commentary on it when I get home later tonight or in the morning, remember though I'm very new to this and there may be a better way to do it. :)
B
12
S
3
G
2
Posts: 38
Reputation: 1,380

Post » Tue Nov 29, 2016 5:20 pm

I have a different approach to set the distance between the distance.
I made the distance relative to the word's length, using this:
Image
(Download .capx)

totoe wrote:why you do :
WAIT 0.5*loopindex seconds
and
ScrollingBox |Set text tokenat(Word,count,"")


WAIT 0.5*loopindex seconds:
This sets the distance between the words. If @Whoswho removed that condition, the words would spawn immediately, all at once, all on top of each other. The lower 0.5, the bigger the distance.

ScrollingBox | Set text tokenat(Word,count," ")
To understand this, you first need to understand the expression tokenat.
tokenat separates a string into multiple pieces by using a separator. Here, the separator is " ", because words are separated by a space.
@Whoswho takes the initial sentence and splits it up into the single words by using tokenat.
He then takes the appropriate word by using "count" as an index to find the correct token.

Clear?

If not, just ask @Whoswho again.
Btw: Good job, @Whoswho considering that you are new to C2!
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Tue Nov 29, 2016 9:30 pm

thanks, for this really good explanation! And thanks for your demo and the helping hand too.
At the moment i use this technix to dublicate the scroller as a "preset", any better idea how to better setup a good starting point?
Image
B
79
S
28
G
108
Posts: 194
Reputation: 59,906

Next

Return to How do I....?

Who is online

Users browsing this forum: digitalsoapbox, RetrocadeMedia, tarek2 and 1 guest