Seite 94 von 342 ErsteErste ... 44 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 144 194 ... LetzteLetzte
Zeige Ergebnis 2.791 bis 2.820 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; Zitat von Altair Ok im assuming you understand SG57's explanation of why it moves to the right and then stops ...

  
  1. #2791
    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 Altair
    Ok im assuming you understand SG57's explanation of why it moves to the right and then stops at 450.
    About the boolean thing: a boolean is a variable that can either be "true" or "false".
    So lets say you have a variable called "moveleft". While you move to the right, its false. When you are at 450 you set it to true. So you say:

    if x == 450 then
    moveleft=true
    end

    Then when its true you say:

    if moveleft==true then
    x=x-2
    end

    EDIT: Damn you Grimfate, grrrr!
    lol, ive been damned many times before


    --------------------------------------------------------------------------------------

  2. #2792
    Developer
    Points: 4.006, Level: 40
    Level completed: 28%, Points required for next Level: 144
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Beiträge
    57
    Points
    4.006
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    yeah i understand that i have it in a loop and a bool is very simple so thanks for your help Grimfate126, SG57, Access_Denied and Altair all of your help is greatly appreciated!

  3. #2793
    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 pspsalv2
    yeah i understand that i have it in a loop and a bool is very simple so thanks for your help Grimfate126, SG57, Access_Denied and Altair all of your help is greatly appreciated!
    no prob. im bored anyway so ask if u have any more!
    --------------------------------------------------------------------------------------

  4. #2794
    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

    I see now! I misread the code. At first I thought that you were doing this so that if you press left or right it moves left or right. But now I see you just want the image to move back and forth across the screen. I had problems with this before. What I did was make it so that if the images collided with a side, it would start moving. Something like:

    Code:
    function Bounce()
    if image.x == 450 then
    image.x = image.x - 2
    end
    if image.x == 0 then
    image.x = image.x + 2
    end
    
    while true do
    screen:blit(image you want to blit)
    if image.x >0 and image.x < 450 then
    image.x = image.x + 2
    end
    if image.x == 450 then
    Bounce()
    end
    screen.waitVblankStart()
    screen.flip()
    end
    This would make it so as soon as the loop start it start moving right. But when it hit the 450 mark it starts moving left. Then when it hits 0 it moves right again. It will keep moving until you put in a line that stops it.

    I think I'm on the right track, but if I'm not, disregard everything I say. :)

    EDIT: I spent so much time typing the code I didn't realize that someone already answered your question. Oh well.

  5. #2795
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    hey here is the very basiz starting code for the startmenu of my game:
    Code:
    white = Color.new(255,255,255)
    black = Color.new(0,0,0)
    orange = Color.new(255,102,0)
    menu = Image.load("startmenu.png")
    
    screenwidth = 480
    screenheight = 272
    
    while true do
    screen:clear()
    screen:blit( 0, 0, menu, false)
    screen:print(170,70,"Start",white)
    screen.waitVblankStart()
    screen.flip()
    end
    the main thing is when i run it in lua player for windows all i see is a blank screen. Can you see any reason for this
    Geändert von mark.sparky (07-14-2006 um 07:39 AM Uhr)

  6. #2796
    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 mark.sparky
    hey here is the very basiz starting code for the startmenu of my game:
    Code:
    white = Color.new(255,255,255)
    black = Color.new(0,0,0)
    orange = Color.new(255,102,0)
    menu = Image.load("startmenu.png")
    
    screenwidth = 480
    screenheight = 272
    
    while true do
    screen:clear()
    screen:blit( 0, 0, menu, false)
    screen:print(170,70,"Start",white)
    screen.waitVblankStart()
    screen.flip()
    end
    the main thing is when i run it in lua player for windows all i see is a blank screen. Can you see any reason for this
    when u bilt the menu, dont put "false". try this:

    Code:
    white = Color.new(255,255,255)
    black = Color.new(0,0,0)
    orange = Color.new(255,102,0)
    menu = Image.load("startmenu.png")
    
    screenwidth = 480
    screenheight = 272
    
    while true do
    screen:clear()
    screen:blit( 0, 0, menu)
    screen:print(170,70,"Start",white)
    screen.waitVblankStart()
    screen.flip()
    end
    --------------------------------------------------------------------------------------

  7. #2797
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    no it didnt work it is still blank and the cmd now says:
    Luaplayer's Mikmod has a critical error:
    _mm_critical 1
    _mm_ errno 15
    None of the supported the sound-devices were detected

  8. #2798
    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 mark.sparky
    no it didnt work it is still blank and the cmd now says:
    Luaplayer's Mikmod has a critical error:
    _mm_critical 1
    _mm_ errno 15
    None of the supported the sound-devices were detected
    post your menu pic. what fromat is it?
    --------------------------------------------------------------------------------------

  9. #2799
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    here is my menu (please dont use it anyone). . it is png

  10. #2800
    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 mark.sparky
    here is my menu (please dont use it anyone). . it is png
    hmm, try it on your psp. it doesnt work for me either.
    --------------------------------------------------------------------------------------

  11. #2801
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    k did you mean it doesnt work on luaplayer windows

  12. #2802
    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 mark.sparky
    k did you mean it doesnt work on luaplayer windows
    i guess. does it work on ur psp tho?
    --------------------------------------------------------------------------------------

  13. #2803
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    nope it doesnt work on my psp but my psp is fw 2.6 (coz no-one i know has fw1.5 )

  14. #2804
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    hey is there anything wrong with this code because when i run it it just freezes but everything shows.
    code:
    Code:
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    menu  = Image.load("images/menu.png")
    menuselect = 0
    
    while true do
    screen:clear()
    
    pad = Controls.read()
    
    screen:blit(0,0,menu)
    
    if pad:up() then
    menuselect = menuselect - 1
    end
    if pad:down() then
    menuselect = menuselect + 1
    end
    if menuselect == -1 then
    menuselect = 1
    end
    if menuselect == 2 then
    menuslect = 0
    end
    
    if menuslect == 0 then
    screen:print(240,120,"Start",red)
    screen:print(240,150,"Quit",white)
    end
    if menuselect == 1 then
    screen:print(240,120,"Start",white)
    screen:print(240,150,"Quit",red)
    end
    
    screen.waitVblankStart()
    screen.flip()
    end

  15. #2805
    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

    I don't thikn anything is wrong, it seems like the psp ran out of memory if it froze, but that wouldn't make sense.

  16. #2806
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    no i used it on lua player windows and when i ran it it just wouldnt move and let me change the color of the text (i.e. the selector)

  17. #2807
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Try this:

    Code:
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    menu  = Image.load("images/menu.png")
    menuselect = 0
    
    while true do
    screen:clear()
    
    pad = Controls.read()
    
    screen:blit(0,0,menu)
    
    if pad:up() then
    menuselect = menuselect - 1
    end
    if pad:down() then
    menuselect = menuselect + 1
    end
    if menuselect < 0 then
    menuselect = 1
    end
    if menuselect > 1 then
    menuselect = 0        --you forgot an "e" here
    end
    
    if menuselect == 0 then        -- here aswell
    screen:print(240,120,"Start",red)
    screen:print(240,150,"Quit",white)
    end
    if menuselect == 1 then
    screen:print(240,120,"Start",white)
    screen:print(240,150,"Quit",red)
    end
    
    screen.waitVblankStart()
    screen.flip()
    end
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  18. #2808
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    thnx its works (mostly) lol

  19. #2809
    QJ Gamer Green
    Points: 8.215, Level: 61
    Level completed: 22%, Points required for next Level: 235
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Illinois
    Beiträge
    897
    Points
    8.215
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    http://www.sendspace.com/file/4jg6xl
    Can someone take a look at my code. There is a problem with putting the animation on the screen.
    Geändert von cwirsing (07-15-2006 um 01:28 PM Uhr)

  20. #2810
    QJ Gamer Green
    Points: 7.057, Level: 55
    Level completed: 54%, Points required for next Level: 93
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Scotland, UK
    Beiträge
    571
    Points
    7.057
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Hey does anyone know how to do animation. Like when you are using a sprite sheet
    Geändert von mark.sparky (07-15-2006 um 01:49 PM Uhr)

  21. #2811
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    someone told me to use this code to make a player controlled player pop up but not sure if i can get it too work

    player{}
    player.x
    player = image.load("player.png")
    controls.red()

    If pad:right then
    player.x = player.x + 5
    end

    if pad:left then
    player.x = player.x -5
    end

  22. #2812
    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

    That isn't the entire code, he's just showing you an example. A complete code would be:

    Code:
    blue = Color.new(0,0,255)
    player = Image.createEmpty(20,20) --creates a block 20 pixels by 20 pixels
    player:clear(blue) -- colors the block blue
    Player = {}
    Player = {x = 460, y = 252} -- x and y coordinates of block
    while true do
    pad = Controls.read()
    screen:clear()
    screen:blit(Player.x,Player.y,player) --blits block to the screen
    if pad:left() then
    Player.x = Player.x - 2
    end
    if pad:right() then
    Player.x = Player.x + 2
    end
    screen.waitVblankStart()
    screen.flip()
    end
    You can copy and paste this code it works. But you have to take out the spaces it puts in at line 9.

  23. #2813
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Ok thanks a lot this wil really helpo me out a lot!

    Double Post Merge

    what about up and down/

    Double Post Merge

    i want a specified picture as the blue block also

  24. #2814
    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 Bob Hoil
    Ok thanks a lot this wil really helpo me out a lot!

    Double Post Merge

    what about up and down/

    Double Post Merge

    i want a specified picture as the blue block also
    Ffor up and down add this under right and left:

    Code:
    if pad:up() then
    Player.y = Player.y - 2 
    end
    if pad:down() then
    Player.y = Player.y + 2
    end
    For a picture, just delete these line:

    Code:
    player = Image.createEmpty(20,20) --creates a block 20 pixels by 20 pixels
    player:clear(blue) -- colors the block blue
    and add this line
    Code:
    player = Image.load("YourImage.PNG")

  25. #2815
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    now i need too now how to set boundries and add enemy's the tutorials don't explain very well

  26. #2816
    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

    To ad boundries just put these lines in:

    Code:
    if Player.x > 460 then -- this number will change if your character size is larger                  
    Player.x = 460           --or smaller than 20
    end
    if Player.x < 0 then
    Player.x = 0
    end
    if Player.y > 252 then -- again this number will change
    Player.y = 252
    end
    if Player.y < 0 then
    Player.y = 0
    end
    To add enemies you need to know some Artificial Intelligence, which I don't think you're that far yet. But if you want to know PM me and I can try to help you.
    BTW- Use Evilmana.com for tutorials, they're really easy.

  27. #2817
    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

    adding enemy (that can control them selves a.k.a AI) is very difficult.

  28. #2818
    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

    Depending on how intelligent the enimies are, it can be simple. Like I said you can PM me for help, or just post here and we'll try to help as much as possible.

  29. #2819
    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

    yeah could be as simple as this.

    Code:
    if player.x < enemy.x then
    enemy.x = enemy.x -5
    end
    
    if player.x > enemy.x then
    enemy.x = enemy.x +5
    end
    that way the enemy just follows the character

  30. #2820
    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

    That's how most games do it. Then soon as the enemy touches the character the health drops by 5. But it could be VERY complicated.


 

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 09:02 PM Uhr.

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