Page 1 of 1

I'm looking for a tutorial to create a scrolling text

Posted: Sat Sep 15, 2018 3:05 pm
by Bernard51
Hello

I'm looking for a tutorial to create a scrolling text

Thank you

Re: I'm looking for a tutorial to create a scrolling text

Posted: Mon Sep 17, 2018 9:39 am
by ShanePierce
I am also looking for it because i cannot find any proper and good tutorials on youtube and the ones on udemy are not free and i am broke.

Re: I'm looking for a tutorial to create a scrolling text

Posted: Mon Sep 17, 2018 10:09 am
by NotARaptor
Hi Bernard51

Why do you need a tutorial?

Do you know how to write text to the screen? It's love.graphics.print. The second and third parameters are the coordinates - modify them and the text moves... scrolling text.

If you're looking for a specific type of scrolling text (Star Wars crawl, etc) then you could find a tutorial, I'm sure.

But what's wrong with just giving it a go? Here I'll get you started:

Code: Select all

local text = "Bacon ipsum dolor amet reprehenderit pig magna anim in ipsum ex consectetur landjaeger chuck chicken lorem. Shank ut short ribs, pariatur shoulder proident filet mignon labore meatloaf. Shoulder dolore culpa cupidatat pork chop tri-tip minim. Duis voluptate aliquip porchetta, corned beef eiusmod in. Excepteur venison turkey swine mollit id. Eu prosciutto excepteur leberkas."

local text_x_pos
local text_y_pos
local text_scroll_speed = 100

function love.load()
	text_x_pos = love.graphics.getWidth()
	text_y_pos = love.graphics.getHeight() / 2
end

function love.update(dt)
	text_x_pos = text_x_pos - text_scroll_speed * dt
end

function love.draw()
	love.graphics.print(text, text_x_pos, text_y_pos)
end

(Code written directly here, not tested - concept is sound though)

Can you make it scroll the other way? How about vertically? Can you detect when the scrolling has finished (hint: you'll need Font:getWidth)

Can you vary the speed? Vary the size of the text? What about doing it character by character? What about rendering the above to an off-screen buffer and then rendering to the screen with a shader?

Don't look for a tutorial. Start. Code. Play. Enjoy. You can teach yourself far better than a tutorial can.

Re: I'm looking for a tutorial to create a scrolling text

Posted: Mon Sep 17, 2018 1:35 pm
by Bernard51
Thank you

Re: I'm looking for a tutorial to create a scrolling text

Posted: Tue Oct 30, 2018 9:39 am
by Bernard51
how to make the text once of the screen on the left come back by the exit of right?