How do I Textscroller

0 favourites
  • 14 posts
  • 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.

  • 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.

  • Yes thanks thats working! Any tips for making it scroll on a sinus path. *I MUST learn more...

  • 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?

  • 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

  • Hi,

    I'm kinda new at this and my code style might be off a bit but I think this is what your after

    https://drive.google.com/file/d/0B2ztlkoVxR-FNmJnWWYzUlVsVlU/view?usp=sharing[/code:11skvi27]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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,"")

  • 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.

  • I have a different approach to set the distance between the distance.

    I made the distance relative to the word's length, using this:

    (Download .capx)

    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!

  • 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?

  • Sorry, but what exactly are you using Word2 for?

    And what do you mean by "preset"? Do you mean the possibility to create scrollers whenever you want?

  • yes, if i have a good state with different behaviors. i want to spawn another scroller, where i can fiddle more.

  • totoe This is the commented version, with a modification or two...

    https://drive.google.com/file/d/0B2ztlkoVxR-FbzRGclBxMUItOXc/view?usp=sharing[/code:3t99qded]
    
    I have handled the double scroll over, I think, and the comments should hopefully answer most of your questions.
    Take note of what @randomly says, he has more experience and his code modification looks good, I have about 3 weeks experience with Construct 2 and I'm determined to buy myself a license as an xmas present.
    
    Btw @randomly, thanks for the confidence boost, back at ya
  • Yall rock my world! big thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)