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 :)



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)

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

end

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
  rectfill(nx,ny,nx+sx,ny+sy,col)
	end

end

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
 cls()

--now you can draw the text scaled.
 scale_text(title_pixels, 24,45,1.5,4,9)

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.


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.


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



[Please log in to post a comment]