Help with screen blitting and controls!

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
MuffinKing
Posts: 5
Joined: Tue Dec 13, 2005 11:07 am

Help with screen blitting and controls!

Post by MuffinKing »

I'm a bit of a noob I know but hey I'm learning. I'm currently designing a "shell" because im bored and I can't think of a simple game to create. Anyway, I'm trying to work on the start menu, and whereas I can't get it to stay without letting go X. Is there anyway for it to stay when I let go X until I tap X on the start button? Here is my code below:

Code: Select all

ystem.usbDiskModeActivate()
white = Color.new(255,255,255)
black = Color.new(0,0,0)
startbar = Image.load("./images/startbar.png")
wallpaper = Image.load("./images/wallpaper.png")
cursor = Image.load("./images/cursor.png")
taskbar = Image.load("./images/taskbar.png")
startbarlist = Image.load("./images/startbarlist.png")
startbarmouseover = Image.load("./images/startover.png")
startbarpushed = Image.load("./images/startpushed.png")
pointer_x = 480/2
pointer_y = 272/2
timefont = Font.createProportional()
timefont:setPixelSizes(0,10)
while true do
function startbar_()
	screen:blit(0,244,startbarpushed)
	screen:blit(0,1,startbarlist)
return
	end
	
	pad = Controls.read()
	dx = pad:analogX()
	dy = pad:analogY()
	
	if math.abs(dx) > 32 then
		pointer_x = pointer_x + dx / 32
		if pointer_x > 479 then
			pointer_x = 479
		end

		if pointer_x < 0 then
			pointer_x = 0
		end
	end

	if math.abs&#40;dy&#41; > 32 then
		pointer_y = pointer_y + dy / 32
		if pointer_y > 479 then
			pointer_y = 479
		end

		if pointer_y < 0 then
			pointer_y = 0
		end
	end
	

screen&#58;blit&#40;0,0,wallpaper&#41;
screen&#58;blit&#40;0,245,startbar&#41;
screen&#58;blit&#40;368,245,taskbar&#41;
time = os.date&#40;"%I&#58;%M %p"&#41;
screen&#58;fontPrint&#40;timefont,425,263,time&#41;
	if pad&#58;cross&#40;&#41; and pointer_x < 95 and pointer_x >= 0 and pointer_y > 246 and pointer_y < 273 then
	startbar_&#40;&#41;
	end
screen&#58;blit&#40;pointer_x, pointer_y, cursor&#41;
screen.flip&#40;&#41;
	if pad&#58;start&#40;&#41; then break end
	if pad&#58;select&#40;&#41; then screen&#58;save&#40;"screenshot.jpg"&#41; end
	seconds=25
end
I'm nooby so try to explain it as leman as you can get :D.[/code]
Post Reply