Seite 116 von 342 ErsteErste ... 16 66 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 166 216 ... LetzteLetzte
Zeige Ergebnis 3.451 bis 3.480 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; OK, I know how to access the music folder on the PSP. blank = Sound.load(ms0:/PSP/MUSIC) But, how would I make ...

  
  1. #3451
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    OK, I know how to access the music folder on the PSP.

    blank = Sound.load(ms0:/PSP/MUSIC)

    But, how would I make it so it loads the first song, then plays it, when it's over, load the second song, then plays it. etc.?



  2. #3452
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Im not sure what the play music function is so Im gonna make it up for this purpose
    Code:
    blank = Sound.load(ms0:/PSP/MUSIC)
    blank1 = Sound.load(ms0:/PSP/MUSIC1)
    if blank = nil then
    music.play(blank1)
    end
    I believe that would work...

  3. #3453
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Nevermind. I'm thing totally wrong.
    -= Double Post =-
    How would you detect if a person is holding a button or not? If I put:

    if pad:cross() then
    player.speed = player.speed + 1
    end

    It will add 1 only once. But I want to continue adding 1 as long as the x button is held. How would I do this?
    And how would I detect if you let go of the X button?
    Geändert von ARza (09-09-2006 um 05:30 PM Uhr) Grund: Automerged Doublepost

  4. #3454
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ARza
    Nevermind. I'm thing totally wrong.
    -= Double Post =-
    How would you detect if a person is holding a button or not? If I put:

    if pad:cross() then
    player.speed = player.speed + 1
    end

    It will add 1 only once. But I want to continue adding 1 as long as the x button is held. How would I do this?
    And how would I detect if you let go of the X button?
    actually, if you put that in your main loop, it will add 1 for every frame you press it. on the contary if you want it so that you have to let go each time before it adds one do this:


    Code:
    buttonPressed = false
    
    while true do
    
    pad = Controls.read()
    
    if pad:up() then
         if not buttonPressed then
               y = y-1
         end
         buttonPressed = true
    else
         buttonPressed = false
    end
    --------------------------------------------------------------------------------------

  5. #3455
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    hi guys. okay so i went to this tutorial thing and it told me to make a text file and rename it script.lua then i put the code in it (this is hello world) and its like

    blue = Color.new(0, 0, 255)
    screenrint(200, 130, "Hello World!", blue)
    screen.flip()
    while true do
    screen.waitVblankStart()
    end

    but when i start up lua player its not script.lua anymore its script.lua.text and it says there is nothing we can do to this file. what do i do?
    -= Double Post =-
    okay so im looking at the other lua things and they are all strictly lua files not script.lua in a text file. so do i have to convert my script.lua to a lua file?
    Geändert von GuitarGod1134 (09-10-2006 um 04:16 AM Uhr) Grund: Automerged Doublepost
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  6. #3456
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Read the thread you already made, it clarifies in there.

  7. #3457
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    ya thanks man.
    -= Double Post =-
    need some help. how do i make lets say start exit the program. all i can find is how to restart the program.
    Geändert von GuitarGod1134 (09-10-2006 um 06:12 AM Uhr) Grund: Automerged Doublepost
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  8. #3458
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GuitarGod1134
    ya thanks man.
    -= Double Post =-
    need some help. how do i make lets say start exit the program. all i can find is how to restart the program.
    i think its like
    Code:
    Controls.read()
      if pad:start() and Select == 1 then
      break
    end

  9. #3459
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    ill try it. cause if its wrong then we both learn something LOL.
    -= Double Post =-
    nope thats not it. when u instert that code it gives u an error
    Geändert von GuitarGod1134 (09-10-2006 um 06:24 AM Uhr) Grund: Automerged Doublepost
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  10. #3460
    QJ Gamer Bronze
    Points: 5.924, Level: 49
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Earth, UK
    Beiträge
    457
    Points
    5.924
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    ok try this
    Code:
    blue = Color.new(0, 0, 255)
    while true do
    pad=Controls.read()
    screen:print(200, 130, "Hello World!", blue)
    if pad:start() then
    break
    end
    screen.flip()
    screen.waitVblankStart()
    end
    <<Put A message Here>>
    <<Just made another rubbish website visit it here.>>

  11. #3461
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    thats the entire hello world code isnt it?
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  12. #3462
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    ok im making a side scrolling game and i got most of the code done but i was at a stopping point and wanted to look at my work , but when i loaded it the screen just stayed black and then shuts off my psp heres my code:

    System.usbDiskModeActivat e()

    pink = Color.new(255, 0 , 153)
    GameStatus = "Loading"
    LoadingTimer = Timer.new()
    playera = Image.load("playera.png")
    sscgb1 = Image.load("sscgb1.png")
    sscgb2 = Image.load("sscgb2.png")
    sscgb3 = Image.load("sscgb3.png")
    slide = {}

    slide[1] = { x = 0, y = 0, pic = Image.sscb1(480, 272) }
    slide[2] = { x = -480, y = 0, pic = Image.sscbg2(480, 272) }
    slide[3] = { x = -960, y = 0, pic = Image.sscgb3(480, 272) }
    playera = {}
    playera = {x = 200, y = 50}
    screenwidth = 480 - player.width()
    screenheight = 272 - player.width()
    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 2
    end
    if pad:right() and Player[1].x < screenwidth then
    Playera.x = Player[1].x + 2
    end
    if pad:up() and Player[1].y > 0 then
    Playera.y = Player[1].y - 2
    end
    if pad:down() and Player[1].y < screenheight then
    Playera.y = Player[1].y + 2
    end
    move = true

    while true do

    pad = Controls.read()

    LoadingTimer:start()

    if GameStatus == "Loading" and LoadingTimer:time() >= 1 and LoadingTimer:time() < 50 then
    screen:clear()
    screenrint(194, 136, "Loading: 0%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 50 and LoadingTimer:time() > 100 then
    screen:clear()
    screenrint(194, 136, "Loading: 20%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 100 and LoadingTimer:time() > 150 then
    screen:clear()
    screenrint(194, 136, "Loading: 40%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 150 and LoadingTimer:time() > 200 then
    screen:clear()
    screenrint(194, 136, "Loading: 60%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 200 and LoadingTimer:time() > 250 then
    screen:clear()
    screenrint(194, 136, "Loading: 80%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 250 and LoadingTimer:time() > 300 then
    screen:clear()
    screenrint(194, 136, "Loading: 90%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 300 and LoadingTimer:time() > 350 then
    screen:clear()
    screenrint(194, 136, "Loading: 100%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() > 351 then
    LoadingTimer:stop()
    LoadingTimer:reset()
    GameStatus = "Menu"
    end

    for blit_slides = 1, 3 do
    screen:blit(slide[blit_slides].x, slide[blit_slides].y, slide[blit_slides].pic)
    end
    for move_slides = 1, 3 do
    if move == true then
    slide[move_slides].x = slide[move_slides].x + 2
    end
    end
    for repeat_slides = 1, 3 do
    if slide[repeat_slides].x > 480 then
    slide[repeat_slides].x = -960
    end
    end
    if pad:start() and move == true then
    move = false
    elseif pad:start() and move == false then
    move = true
    end
    screen.waitVblankStart()
    screen.flip()
    end

    i have been trying for months to get it to work ive started over from scratch 2 now andam hoping one you all can get it working

  13. #3463
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    i think you are starting to much thing @ one time and thats not good for the ram
    -= Double Post =-
    and the timer is not good
    i dont kwo exactualy but it shows it to fast so you cant see it
    Geändert von hallo007 (09-10-2006 um 07:15 AM Uhr) Grund: Automerged Doublepost

  14. #3464
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    does anyone know how to make it so u exit out of the program by pressing start or something?
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  15. #3465
    Look at my user title :p
    Points: 14.103, Level: 77
    Level completed: 14%, Points required for next Level: 347
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Texas
    Beiträge
    1.183
    Points
    14.103
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    yeah thats what i thought but if i take out the timer and add
    If background = nill
    will that fix it?

  16. #3466
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GuitarGod1134
    does anyone know how to make it so u exit out of the program by pressing start or something?
    Yes, but you have to know how to do button input. Check out ProgramLua, tutorial 3 for that. Then just do something like:

    if pad:start() then
    os.exit()
    end

    I have been told this works, but haven't tested it.

  17. #3467
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    okay guys im working on a simple application here. while in lua player starting this will access the memstick with the usb so u dont have to quit into the xmb. and so far this is what i have

    System.usbDiskModeActivat e()
    red = Color.new(255, 0, 0)
    orange = Color.new(255, 102, 0)
    screenrint(90, 60, "usb being accessed! Program by GuitarGod1134", red)
    screen.flip()
    while true do
    screen.waitVblankStart()
    end

    and what im stuck on is how to make it so like when i press start or something it will stop accessing the memory stick and go back to lua player.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  18. #3468
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    just showing my progress
    Code:
    --kirE v0.1
    --Coded by psphacker12.
    white = Color.new(255, 255, 255)
    black = Color.new(0,0,0)
    red = Color.new(255,0,0)
    green = Color.new(0,255,0)
    blue = Color.new(0,0,255)
    tiles = Image.load("data/new.png")
    cyan = Color.new(0,255,255)
    figure = Image.load("data/playerone.png")
    white = Color.new(255, 255, 255)
    font = Font.load("data/font/eighttrack.ttf")
    font:setPixelSizes(0, 20)
    bigfont = Font.load("data/font/eighttrack.ttf")
    bigfont:setPixelSizes(0, 48)
    gameover = Font.load("data/font/eighttrack.ttf")
    gameover:setPixelSizes(0, 64)
    range={60,100}
    System.usbDiskModeActivate()
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 10%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 20%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 30%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 40%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 50%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 60%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 70%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 80%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 90%", white)
    screen.flip()
    screen.waitVblankStart(30)
    screen:clear(blue)
    screen:fontPrint(bigfont,130, 150, "Loading - 100%",white)
    screen.flip()
    screen.waitVblankStart(60)
    
    screen:clear(blue)
    Select = 1
    maxSelect = 1
    oldpad = Controls.read()
    while true do
    pad = Controls.read()
    screen:clear()
    if pad:up() and oldpad:up() ~= pad:up() then
    Select = Select - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    Select = Select + 1
    end
    if Select > maxSelect then
    Select = 1
    elseif Select <= 0 then
    Select = maxSelect
    end
    screen:clear(blue)
    if Select == 1 then
    screen:fontPrint(bigfont,150,150," kire v0.1", white)
    screen:fontPrint(font,150,180, "coded by psphacker12", white)
    end
    if pad:cross() and Select == 1 then
    break
    end
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
        
          counter = Timer.new()
            level = 1
                mapSource = {
      "ffffffffffffffffffffffffffffff",
      "fnnnononononononononononononnf",
      "fnnnnononononononononononononf",
      "fonnonbaaaaaaaaaaaaaaaaaaaaaaa",
      "fnonnobonnnonnnonnnonnnonnbonf",
      "fonbbnbnonononononononononbnof",
      "fnobnobononnnonnnonnnonnnononf",
      "fonbonbnnncccccccccccccccccccc",
      "fnobnobnondnononononononononnf",
      "fonbonbnnodonononononononononf",
      "fnobnobnondnonnondddddnonnnnof",
      "cccbnnbonndnnonononondnonnnonf",
      "fnobbnbnondnononononodonononnf",
      "fnnnnnbnnoddddddddddddononnonf",
      "fnnnnnonononononononononononof",
      "fonnnnnnnnnnnnnnnnnnoooonnnnnf",
      "ffffffffffffffffffffffffffffff"
    }
    board = Image.createEmpty(480, 272)
    
    function drawTile(tile, x, y)
      tile = string.byte(tile, 1) - string.byte("a")
      local tileX = math.mod(tile, 4)
      local tileY = math.floor(tile / 4)
      
    
    board:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
      
    end
    
    map = {}
    for y = 1, 17 do
      line = mapSource[y]
      map[y] = {}
      for x = 1, 30 do
        tile = string.sub(line, x, x)
        map[y][x] = tile
        drawTile(tile, x - 1, y - 1)
      end
    end
    
    playerX = 6
    playerY = 14
    
    animation = 0
    
    animationDirection = 1
    
    animationSlowDown = 0
    
    speedStep = 0
    
    dx = 0
    dy = 0
    
    score = 0
    
    
    
    while true do
     counter:start()
     currentTime = counter:time()
     if currentTime >= 50000  then
        screen:clear(blue)
        screen:fontPrint(font,180,150,"Game Over",white)
        screen:fontPrint(font,180,180,"press start", white)
        if pad:start() and Select == 1 then
        break
      end
        screen.flip()
        screen.waitVblankStart(60)
    end
    
      pad = Controls.read()
      
      if pad:select() then
      screen:save("screenshot.png")
      end
      if pad:start() and Select == 1 then
      break
      end
    
      
        if speedStep == 0 then
        oldPlayerX = playerX
        oldPlayerY = playerY
    
        playerX = playerX + dx
        playerY = playerY + dy
    
        newTile = map[playerY][playerX]
    
        if newTile ~= "n" and newTile ~= "p" and newTile ~= "o" then
          playerX = oldPlayerX
          playerY = oldPlayerY
        end
    
        if newTile == "p" then score = score + 5 end
        if newTile == "o" then score = score + 1 end
        if newTile == "p" or newTile == "o" then
    
          map[playerY][playerX] = "n"
    
    
          drawTile("n", playerX - 1, playerY - 1)
        end
    
    
        dx = 0
        dy = 0
      else
    
        if pad:up() then
          dy = -1
        elseif pad:down() then
          dy = 1
        elseif pad:left() then
          dx = -1
        elseif pad:right() then
          dx = 1
        end
      end
    
    
      speedStep = speedStep + 1
      if speedStep == 5 then
        speedStep = -1
      end
    
    
      screen:blit(0, 0, board, 0, 0, board:width(), board:height(), false)
    
    
      screen:blit((playerX - 1) * 16 - 4, (playerY - 1) * 16 - 4, figure, 1 + 25 * animation, 1, 24, 24)
    
    
      animationSlowDown = animationSlowDown + 1
      if animationSlowDown == 3 then
        animationSlowDown = 0
        animation = animation + animationDirection
        if animation == 4 then
          animationDirection = -1
        elseif animation == 0 then
          animationDirection = 1
        end
      end
    
      screen:fontPrint(font,15, 20, "Current Score: " .. score, white)
    
      screen.waitVblankStart()
      screen:flip()
      oldpad = pad
    end

  19. #3469
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    i usuallly define all the colors just in case i use them
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  20. #3470
    Developer
    Points: 8.360, Level: 61
    Level completed: 70%, Points required for next Level: 90
    Overall activity: 16,0%

    Registriert seit
    Jun 2005
    Ort
    At my house...
    Beiträge
    886
    Points
    8.360
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ARza
    Yes, but you have to know how to do button input. Check out ProgramLua, tutorial 3 for that. Then just do something like:

    if pad:start() then
    os.exit()
    end

    I have been told this works, but haven't tested it.
    or

    if pad:start() then
    break
    end
    F.A.L.O?

  21. #3471
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    hey i know how to exit using the start button, but now pause the game how can i do this???

  22. #3472
    QJ Gamer Bronze
    Points: 5.924, Level: 49
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Earth, UK
    Beiträge
    457
    Points
    5.924
    Level
    49
    Downloads
    0
    Uploads
    0

    Wink

    at the start of the code somewhere put
    Code:
    function paused()
    resumeok=0
    while true do
    pad=Controls.read()
    resumeok=resumeok+1
    screen:clear()
    screen:print(180,160,"Game Paused", anycolour)
    screen:print(180,150,"Press Start to Continue",anycolour)
    if resumeok>100 and pad:start() then
    resumeok=0
    break
    end
    screen.waitVblankStart()
    screen.flip()
    end
    end
    in your main loop put
    Code:
    if pad:start() then
    paused()
    end
    Now i need some help, I got this
    Code:
    --Before the main loop
    file=io.open("highscore.txt","r")
    highscore=file:read()
    file:close()
    --In the main loop
    if score<=highscore then
    file=io.open("highscore.txt","w")
    file:write(score)
    file:close()
    end
    i get the message cant compare a number to a string. I completely understand why, but how can i get around this?
    <<Put A message Here>>
    <<Just made another rubbish website visit it here.>>

  23. #3473
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von JoeDaStudd
    Now i need some help, I got this
    Code:
    --Before the main loop
    file=io.open("highscore.txt","r")
    highscore=file:read()
    file:close()
    --In the main loop
    if score<=highscore then
    file=io.open("highscore.txt","w")
    file:write(score)
    file:close()
    end
    i get the message cant compare a number to a string. I completely understand why, but how can i get around this?
    Use file:read(*n), which returns a number instead of a string.

  24. #3474
    QJ Gamer Bronze
    Points: 5.924, Level: 49
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Earth, UK
    Beiträge
    457
    Points
    5.924
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Thanks I tried that before, but forgot the speech marks around the *n, lol. Great help thanks
    <<Put A message Here>>
    <<Just made another rubbish website visit it here.>>

  25. #3475
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Thumbs up

    Zitat Zitat von %chrono trigger%
    ok im making a side scrolling game and i got most of the code done but i was at a stopping point and wanted to look at my work , but when i loaded it the screen just stayed black and then shuts off my psp heres my code:

    System.usbDiskModeActivat e()

    pink = Color.new(255, 0 , 153)
    GameStatus = "Loading"
    LoadingTimer = Timer.new()
    playera = Image.load("playera.png")
    sscgb1 = Image.load("sscgb1.png")
    sscgb2 = Image.load("sscgb2.png")
    sscgb3 = Image.load("sscgb3.png")
    slide = {}

    slide[1] = { x = 0, y = 0, pic = Image.sscb1(480, 272) }
    slide[2] = { x = -480, y = 0, pic = Image.sscbg2(480, 272) }
    slide[3] = { x = -960, y = 0, pic = Image.sscgb3(480, 272) }
    playera = {}
    playera = {x = 200, y = 50}
    screenwidth = 480 - player.width()
    screenheight = 272 - player.width()
    if pad:left() and Player[1].x > 0 then
    Player[1].x = Player[1].x - 2
    end
    if pad:right() and Player[1].x < screenwidth then
    Playera.x = Player[1].x + 2
    end
    if pad:up() and Player[1].y > 0 then
    Playera.y = Player[1].y - 2
    end
    if pad:down() and Player[1].y < screenheight then
    Playera.y = Player[1].y + 2
    end
    move = true

    while true do

    pad = Controls.read()

    LoadingTimer:start()

    if GameStatus == "Loading" and LoadingTimer:time() >= 1 and LoadingTimer:time() < 50 then
    screen:clear()
    screenrint(194, 136, "Loading: 0%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 50 and LoadingTimer:time() > 100 then
    screen:clear()
    screenrint(194, 136, "Loading: 20%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 100 and LoadingTimer:time() > 150 then
    screen:clear()
    screenrint(194, 136, "Loading: 40%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 150 and LoadingTimer:time() > 200 then
    screen:clear()
    screenrint(194, 136, "Loading: 60%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 200 and LoadingTimer:time() > 250 then
    screen:clear()
    screenrint(194, 136, "Loading: 80%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 250 and LoadingTimer:time() > 300 then
    screen:clear()
    screenrint(194, 136, "Loading: 90%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() >= 300 and LoadingTimer:time() > 350 then
    screen:clear()
    screenrint(194, 136, "Loading: 100%", pink)
    screen.flip()
    end
    if GameStatus == "Loading" and LoadingTimer:time() > 351 then
    LoadingTimer:stop()
    LoadingTimer:reset()
    GameStatus = "Menu"
    end

    for blit_slides = 1, 3 do
    screen:blit(slide[blit_slides].x, slide[blit_slides].y, slide[blit_slides].pic)
    end
    for move_slides = 1, 3 do
    if move == true then
    slide[move_slides].x = slide[move_slides].x + 2
    end
    end
    for repeat_slides = 1, 3 do
    if slide[repeat_slides].x > 480 then
    slide[repeat_slides].x = -960
    end
    end
    if pad:start() and move == true then
    move = false
    elseif pad:start() and move == false then
    move = true
    end
    screen.waitVblankStart()
    screen.flip()
    end

    i have been trying for months to get it to work ive started over from scratch 2 now andam hoping one you all can get it working
    dude. u can optimize that code like 10x better: here is a optimized version if ur code:

    Code:
    Spoiler for Optimized Code:
    System.usbDiskModeActivate() pink = Color.new(255, 0 , 153) GameStatus = "Loading" LoadingTimer = Timer.new() playera = Image.load("playera.png") sscbg = {} for a = 1, 3 do sscgb[a] = Image.load("sscgb"..a..".png") end slide = {} slide[1] = { x = 0, y = 0, pic = sscbg[1]} slide[2] = { x = -480, y = 0, pic = sscbg[2]} slide[3] = { x = -960, y = 0, pic = sscgb[3]} playera = {} playera = {x = 200, y = 50} screenwidth = 480 - player.width() screenheight = 272 - player.width() function playeraControls() if pad:left() and Player[1].x > 0 then playera.x = playera.x - 2 elseif pad:right() and Player[1].x < screenwidth then playera.x = playera.x + 2 elseif pad:up() and Player[1].y > 0 then playera.y = playera.y - 2 elseif pad:down() and Player[1].y < screenheight then playera.y = playera.y + 2 end end function loadGame() LoadingTimer:start() if GameStatus == "Loading" and LoadingTimer:time() >=and LoadingTimer:time() < 50 then screen:clear() screen:print(194, 136, "Loading: 0%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 50 and LoadingTimer:time() > 100 then screen:clear() screen:print(194, 136, "Loading: 20%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 100 and LoadingTimer:time() > 150 then screen:clear() screen:print(194, 136, "Loading: 40%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 150 and LoadingTimer:time() > 200 then screen:clear() screen:print(194, 136, "Loading: 60%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 200 and LoadingTimer:time() > 250 then screen:clear() screen:print(194, 136, "Loading: 80%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 250 and LoadingTimer:time() > 300 then screen:clear() screen:print(194, 136, "Loading: 90%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() >= 300 and LoadingTimer:time() > 350 then screen:clear() screen:print(194, 136, "Loading: 100%", pink) elseif GameStatus == "Loading" and LoadingTimer:time() > 351 then LoadingTimer:stop() LoadingTimer:reset() GameStatus = "Menu" end end move = true while true do pad = Controls.read() if GameStatus == "Loading" then loadGame() end for blit_slides = 1, 3 do screen:blit(slide[blit_slides].x, slide[blit_slides].y, slide[blit_slides].pic) end for move_slides = 1, 3 do if move == true then slide[move_slides].x = slide[move_slides].x + 2 end end for repeat_slides = 1, 3 do if slide[repeat_slides].x > 480 then slide[repeat_slides].x = -960 end end if pad:start() and move == true then move = false elseif pad:start() and move == false then move = true end playeraControls() screen.waitVblankStart() screen.flip() end
    try that. if it gives errors, try to fix them, otherwise tell me.

    BTW, thx for using my tut!!
    --------------------------------------------------------------------------------------

  26. #3476
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard dSAF

    okay,i have a highscore menu like this
    Code:
    if pad:cross() and Select == 2 then
    screen:blit(0, 0, background)
    screen:fontPrint(bigfont,150,150, "highscore:" .. highscore, white)
    screen.waitVblankStart()
    if pad:circle() then
    return
    end
    BUT you have to HOLD the X button just to view the highscore.
    how can i make it like if u press circle then it returns you to the menu???
    plz reply

  27. #3477
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    make a variable

    Code:
    if pad:cross() then
    variable = 1
    elseif pad:circle() then variable= 2 end
    
    if variable == 1 then
    -- view highscore
    end
    
    if variable == 2 then
    -- menu
    end
    there is other ways, but that should do

  28. #3478
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Posted in error.

  29. #3479
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    ok but now if you are viewing the highscore what function do i use to make it return to the menu?

  30. #3480
    Developer
    Points: 8.360, Level: 61
    Level completed: 70%, Points required for next Level: 90
    Overall activity: 16,0%

    Registriert seit
    Jun 2005
    Ort
    At my house...
    Beiträge
    886
    Points
    8.360
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    You just make another variable...
    if screen == 1 then....
    F.A.L.O?


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 07:53 AM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .