Log In  

Hi all!

I have almost tears in my eyes thinking that I've almost completed a very basic and lame implementation of Pong.

I'd need to draw a very simple intro screen (with game name and settings).

I would like to make a big image (128x128) that will cover the whole screen.

What is the suggested method for this?

Thanks :)

P#42645 2017-07-20 08:11 ( Edited 2017-08-29 15:08)

Here's some functions I wrote to scale text for titles and such. You are welcome to use them.

--prints some text, then returns
--a table of pixel coords that
--can be used later for scaling
function get_text_pixels(text)

    for y=0,7 do
     for x=0,#text*8-1 do
      local col=pget(x,y)
      if col!=0 then
 return pixels


function scale_text(pixels,tlx,tly,sx,sy,col)

    for pixel in all(pixels) do
     local x=pixel[1]
     local y=pixel[2]
  local nx=x*sx+tlx
  local ny=y*sy+tly


You can use them like this (probably somewhere in your _draw() function)

 --store locations of pixels for the text you want to print
 local title_pixels=get_text_pixels("my title text")

 --clear the screen so you don't see the text that was printed to obtain the pixels table above

--now you can draw the text scaled.
 scale_text(title_pixels, 24,45,1.5,4,9)
P#42647 2017-07-20 10:33 ( Edited 2017-07-20 14:33)

If you haven't used much of the sprite table, you can draw the entire title screen in the sprite sheet and draw it like a sprite.

That's probably the most straightforward way to have a graphical title screen. It uses a lot of your sprite-sheet, though.

P#42676 2017-07-21 10:34 ( Edited 2017-07-21 14:34)
:: enargy

To piggyback on what @apLundell and @gradualgames suggested, you can try making use of your existing sprites to make an interesting title screen.

Or you can make use of primitives (circ/circfill, rect/rectfill, line) to draw it out. You can even try combining that with some interpolation if you want to get really fancy.

P#42677 2017-07-21 11:28 ( Edited 2017-07-21 15:28)
:: ltpitt

Woh that interpolation looks SICK, @enargy!
How can you do that?

Lovely tips, from all of you, guys!

Also super thanks for great code, @gradualgames

P#43729 2017-08-29 11:08 ( Edited 2017-08-29 15:08)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-04-05 12:55 | 0.046s | 4194k | Q:21