Author Topic: Lua help plzzzz!!!!!!  (Read 1524 times)

Offline X-HACKTO

  • Guppy
  • *
  • Posts: 3
  • Post quality +0/-0
  • Gender: Male
  • Acidmods User
Lua help plzzzz!!!!!!
« on: December 30, 2010, 07:58:42 PM »
Good evening everyone. I kept telling myself that one of these days I am going to sit down and learn how to make my own homebrew games for the psp. So I downloaded Lua for windows , notepad++, and some other required program. I taught myself to do the coding a few days ago, but I am having some problems getting the input controls to work and my music keeps getting cut off. It doesn't play the whole song. Here is my code. My apologies if it is a little disorganized. I have commented on most of the code so I hope that should be enough to help. O, and if you know of any websites that can help me with Lua code please share. It will be very much appreciated :hifive:


--Howdy y'all. --This is my first program. --I call it the test run.
System.usbDiskModeActivate()

purple = Color.new(255,0,255)
green = Color.new(0,255,0)
red = Color.new(255,0,0)
blue = Color.new(0,0,255)
white = Color.new(255,255,255)
teal = Color.new(0,255,255)
yellow = Color.new(255,255,0) --These are the list of parameters that designate what color code is assigned to it's specified word.
orange = Color.new(255, 102, 0)
gray = Color.new(153, 153, 153)
pink =    Color.new(255,0,103)
black = Color.new(0,0,0)

background = Image.load"Images/BOOTPIC.PNG" --The setup for the loading image.
loadcircle1 = Image.load"Images/animation/loadimage1.png"
loadcircle2 = Image.load"Images/animation/loadimage2.png"
loadcircle3 = Image.load"Images/animation/loadimage3.png"
loadcircle4 = Image.load"Images/animation/loadimage4.png"
loadcircle5 = Image.load"Images/animation/loadimage5.png"
loadcircle6 = Image.load"Images/animation/loadimage6.png"
loadcircle7 = Image.load"Images/animation/loadimage7.png"
loadcircle8 = Image.load"Images/animation/loadimage8.png"

menu = Image.load"Images/menupic.png" --Main menu background image.

--PSP Input Configuration.
circle = Image.load"Images/buttons/circle_button.png"
cross = Image.load"Images/buttons/cross_button.png"
triangle = Image.load"Images/buttons/triangle_button.png"
square = Image.load"Images/buttons/square_button.png"
ltrigger = Image.load"Images/buttons/left_trigger.png"
rtrigger = Image.load"Images/buttons/right_trigger.png"
left = Image.load"Images/buttons/left_arrow.png"
right = Image.load"Images/buttons/right_arrow.png"
up = Image.load"Images/buttons/up_arrow.png"
down = Image.load"Images/buttons/down_arrow.png"
screen.waitVblankStart(120)

screen:blit(0,0,background)
screen:print(350,262,"Loading 0%", white)--This is the list of code that will display the text with their designated color.
screen:flip()
screen.waitVblankStart(180) --This code and aarguement allows me to pause the screen for a few seconds. -- 180 = 3 seconds
screen:clear()

loadscreen = Image.load"Images/pad.png"

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 10%", white)
screen:flip()
screen.waitVblankStart(180)
screen:clear()
--Font:setPixelSizes(20,20)

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 20%", white)
screen:flip()
screen.waitVblankStart(60)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 36%", white)
screen:flip()
screen.waitVblankStart(120)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 42%", white)
screen:flip()
screen.waitVblankStart(180)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 50%", white)
screen:flip()
screen.waitVblankStart(120)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 57%", white)
screen:flip()
screen.waitVblankStart(120)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 68%", white)
screen:flip()
screen.waitVblankStart(60)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 77%", white)
screen:flip()
screen.waitVblankStart(60)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 84%", white)
screen:flip()
screen.waitVblankStart(90)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 92%", white)
screen:flip()
screen.waitVblankStart(180)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 97%", white)
screen:flip()
screen.waitVblankStart(180)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Loading 100%", white)
screen:flip()
screen.waitVblankStart(30)
screen:clear()

screen:blit(0,0,loadscreen)
screen:print(350,262,"Load Complete", white)
screen:flip()
screen.waitVblankStart(20)
screen:clear()


LUA = Image.load("Images/lua.png")
screen:blit(0,0,LUA) --This is the code for loading and pasting the backgroind image of you program.
screen:flip()
Music.playFile("Music/Lua.it") --This is the splash screen sound effect.
screen.waitVblankStart(150)
screen:clear()

screen:blit(0,0,menu)
Music.playFile("Music/Techno.it",loop) -- This is one of the game menu songs.
Music.volume(128)
if Music.playing() == true then
screen:print(222,262,"Techno", white)
end
if Music.playing() == false then
screen:print(222,262,"No track selected", white)
end


screen:print (210,25,"C", red)
screen:print (220,25,"O", green)
screen:print (230,25,"L", teal)
screen:print (240,25,"O", white)
screen:print (250,25,"R", yellow)
screen:print (260,25,"S", blue)
screen:print (270,25,"!", purple) -- This is the title located at the very top of the screen.

screen:print(10,80,"Choose Your Color!!", red) -- The instructions.

screen:print (10,100,"1. Purple", purple)

--x = Purple

screen:print (10,110,"2. Green", green)

--G = Green

screen:print (10,120,"3. Red", red)

--r = Red

screen:print (10,130,"4. Blue", blue)

--b = blue

screen:print (10,140,"5. White", white)

--w = White

screen:print (10,150,"6. Teal", teal)

--t = Teal

screen:print (10,160,"7. Yellow", yellow)

--y = Yellow

screen:print (10,170,"8. Orange", orange)

--O = Orange

screen:print (10,180,"9. Gray", gray)

--G = Gray

screen:print (10,190,"10. Pink", pink) --These are just a list of options that I am going to have a little later on.
--P = Pink

screen:flip()



--menusound = Sound.load("Music/select.wav",false)

--selector = {image = Image.createEmpty(145,15), x = 147, y = 77}
--selector.image:clear(blue)

pad = Controls.read() --Finally, the controller configurations.


if pad:cross() then --Here is where the magic actually begins.
      screen:blit(0,0,cross)
      screen.flip()
   end
if pad:circle() then
      screen:blit(0,0,circle)
      screen:flip()
   end
   if pad:triangle() then
      screen:blit(200,100,triangle)
      screen.flip()
   end
if pad:square() then
      screen:blit(200,100,square)
      screen:flip()
   end
   if pad:left() then
      screen:blit(0,0,left)
      screen.flip()
   end
if pad:right() then
      screen:blit(0,0,right)
      screen:flip()
   end
   if pad:up() then
      screen:blit(0,0,up)
      screen.flip()
   end
if pad:down() then
      screen:blit(0,0,down)
      screen:flip()
   end
   if pad:l() then
      screen:blit(200,100,ltrigger)
      screen.flip()
   end
if pad:r() then
      screen:blit(200,100,rtrigger)
      screen:flip()
   end
--if pad:select() then
      --music.File("screenshot.tga")
   --end
   
--if pad:start() then
      --music.File()
   --end

   
while true do
screen.waitVblankStart() --This function makes the program stay visible on the desktop.
end



 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal