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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Bernard51
Prole
Posts: 38
Joined: Fri Jan 20, 2017 5:51 pm

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

Post by Bernard51 » Sat Sep 15, 2018 3:05 pm

Hello

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

Thank you

ShanePierce
Prole
Posts: 2
Joined: Sun Sep 16, 2018 4:26 pm

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

Post by ShanePierce » Mon Sep 17, 2018 9:39 am

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.

NotARaptor
Prole
Posts: 44
Joined: Thu Feb 22, 2018 3:15 pm

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

Post by NotARaptor » Mon Sep 17, 2018 10:09 am

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.

Bernard51
Prole
Posts: 38
Joined: Fri Jan 20, 2017 5:51 pm

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

Post by Bernard51 » Mon Sep 17, 2018 1:35 pm

Thank you

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests