Seite 5 von 342 ErsteErste 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 55 105 ... LetzteLetzte
Zeige Ergebnis 121 bis 150 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; ill try this soon! Zitat von Faint Can lua load .mp3 files? No. Sorry but you should be able to ...

  
  1. #121
    Developer
    Points: 8.545, Level: 62
    Level completed: 32%, Points required for next Level: 205
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Beiträge
    472
    Points
    8.545
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    ill try this soon!

    Zitat Zitat von Faint
    Can lua load .mp3 files?
    No. Sorry but you should be able to load .wav


    Geändert von cools (10-06-2005 um 04:11 PM Uhr)

    PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
    http://www.cools.biaklan.com
    Currently Working on ?????

    Quote of the Week

  2. #122
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Twenty 2
    You might actually want to try
    Code:
    blue = Color.new(0, 0, 225)
    while true do
    pad  = Controls.read()
    dice2 = math.random(6)
    if pad:cross() then
    screen:clear()
    screen:print(90, 50,string.format("%d", dice2), blue)
    screen.flip()
    screen.waitVblankStart()
    end
    end
    I changed the color so you could actualy see the number and I added a screen clear so that it doesnt print over it self so you cant read it.
    There's no space between the comma after 50 and string.format.
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  3. #123
    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

    I tested the program with the exact code i posted so i dont think it matters.
    F.A.L.O?

  4. #124
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Lightbulb

    Zitat Zitat von MagicianFB
    Wow that took me a while...
    Ok put keyboard.lua (rename it to that) in the same file as your main code.
    Then put this in your main code:
    Code:
    dofile("keyboard.lua")
    When you want define a variable or print something you can define the variable or what it's printing as keyboard()
    Code:
    -- Examples
    print(keyboard())
    thetext = keyboard()
    This will allow you to input what it is going to register the value as.

    =================
    Start - Enter Value
    D-pad - select key
    R - Space
    L - Delete
    Select - Like holding down shift
    Control pad - Press the button corresponding with the character on the selected key
    ================

    I've tested it and it seems to work on luaplayer v9 but not v11
    Just upgraded it, so instead use this keyboard.lua file :)
    Angehängte Dateien Angehängte Dateien
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  5. #125
    QJ Gamer Blue
    Points: 5.446, Level: 47
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    330
    Points
    5.446
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Hey, MagicianFB. You probably didn't see it, but back on page 11 I was asking if you could tell a little about your rpg project to kinda' help me and anybody else who wants to do an rpg type project. I also asked a few other questions, but it ended up being kind of a long post so I won't repeat it here. The main thing I guess I want to be able to do is scrolling backgrounds (static bg's would be fine if I wanted to try a king's quest type game, or Myst orqsomething, I guesss). The only mention I've found of a scrolling background was in the forums at www.luaplayer.org but it was a really quick no details thing.

  6. #126
    QJ Gamer Silver
    Points: 6.087, Level: 50
    Level completed: 69%, Points required for next Level: 63
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    script.lua
    Beiträge
    426
    Points
    6.087
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    More RPGs, I cant wait to see what others did. I got a scrolling background working, exacly like in zelda1 on NES. I'de like to see how you guys got it working tho. Got random fights FF style, working on menus and sub menus wich I'm having problems with :icon_sad: .

  7. #127
    Rock Star
    Points: 70.899, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    CT| FW: 4.01 M33-2
    Beiträge
    11.844
    Points
    70.899
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von MagicianFB
    Just upgraded it, so instead use this keyboard.lua file :)
    i wanna test the keyboard, and try and incoporate it into my lua program, but first i have to exchange my bricked psp :icon_sad: :Cry: :Cry: :icon_sad:


  8. #128
    QJ Gamer Blue
    Points: 5.446, Level: 47
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    330
    Points
    5.446
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Perhaps there could be some cooperation on the rpg thing? Not neccesarilly on the games themselves, but on how to code them. Perhaps some sort of template code for certain sections that can be edited for use in ones program. ie: the code for a basic battle setup that can be copied and pasted in place with some modifications for the specific game. I'm still doing research on programming in lua, but I had thought of making templates I could use (like one for each area in a game--paste in the template, assign a background png, make the map and assign other variables, but everything that is the same from area to area need not be redone) and posting them for others to use. If we all did that, we could get on with making the games more quickly.
    At any rate, I would be interested to hear about your scrolling background. You said Zelda style? Could it be used with a .png for final fantasy style?
    Also, what kind of trouble are you having with the menu? I'm not a coder just yet, but maybe someone else would have some insight and it could help others who might run into the same problem.

  9. #129
    QJ Gamer Silver
    Points: 6.087, Level: 50
    Level completed: 69%, Points required for next Level: 63
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    script.lua
    Beiträge
    426
    Points
    6.087
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Snaku, I am using png format files. Kinda wierd, but I'm not using small blocks to draw the field. Instead, I'm using 480x272 pictures, I stack em in an table to create my field (piece positions) so I can have multiple worlds easily. All I have to do is change the table. Example:

    Code:
    Field={BD,AB,AB,BB,
           AD,AD,BA,BC,
           AD,AD,BD,BB,
           BA,AA,AA,BC}
    This is still only a 16 piece field as you can see, but it can be whatever you desire it too be. How it works now, is instead of bliting the whole field at once, witch I found was kinda laggy and jerky, I only blit 2 images at once. The "CurentPiece" and the "Next Piece". Like zelda, if the Hero's position get near either end of the screen, then the next piece is generated. Depending on the position of the Hero once again, the next block's X, Y coords will be set, then the piece will be calculated from the table. Really simple accually. :razz: Here's what a next piece funciton looks like:

    Code:
    function NextPieceDown()
       if Piece==1 then NextPiece=(Field[5]) CurrentPiece=5
       elseif Piece==2 then NextPiece=(Field[6]) CurrentPiece=6
       elseif Piece==3 then NextPiece=(Field[7]) CurrentPiece=7
       elseif Piece==4 then NextPiece=(Field[8]) CurrentPiece=8
       elseif Piece==5 then NextPiece=(Field[9]) CurrentPiece=9
       elseif Piece==6 then NextPiece=(Field[10]) CurrentPiece=10
       elseif Piece==7 then NextPiece=(Field[11]) CurrentPiece=11
       elseif Piece==8 then NextPiece=(Field[12]) CurrentPiece=12
       elseif Piece==9 then NextPiece=(Field[13]) CurrentPiece=13
       elseif Piece==10 then NextPiece=(Field[14]) CurrentPiece=14
       elseif Piece==11 then NextPiece=(Field[15]) CurrentPiece=15
       elseif Piece==12 then NextPiece=(Field[16]) CurrentPiece=16
       elseif Piece==13 then NextPiece=(Field[1]) CurrentPiece=1
       elseif Piece==14 then NextPiece=(Field[2]) CurrentPiece=2
       elseif Piece==15 then NextPiece=(Field[3]) CurrentPiece=3
       elseif Piece==16 then NextPiece=(Field[4]) CurrentPiece=4
       end
       PieceY=0
       repeat
          screen:blit(PieceX,PieceY,Field[Piece])
          NextPieceX=0
          NextPieceY=PieceY+272
          screen:blit(NextPieceX,NextPieceY,NextPiece)
          screen:blit(HeroX,HeroY,Heroimg)
          PieceX=0
          PieceY=PieceY-4
          HeroY=HeroY-3.5
          screen.waitVblankStart()
          screen.flip()
       until NextPieceY==0
    Piece=CurrentPiece
    end
    I know its kinda ugly with all the "elseif Piece==16" but its only because I'm testing soem stuff. I need to make limits for each piece type. Then all that's left is to add anims here and there, water, birds, trees, etc. Then one can make diferent piece pictures for different world, and stack em in a different order so on.

    About my menus, I think I got it fixed for now. I was having trouble calling the submenus inside the main menu since I was creating a loop inside another loop. Found a wa around it.

    Hope this inspires some of you. :icon_smil

  10. #130
    Developer
    Points: 8.545, Level: 62
    Level completed: 32%, Points required for next Level: 205
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Beiträge
    472
    Points
    8.545
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Is there a Way to Clear only a part of the screen?

    Could you do something like this:
    Code:
    screen:clear(100, 100)

    PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
    http://www.cools.biaklan.com
    Currently Working on ?????

    Quote of the Week

  11. #131
    Points: 4.700, Level: 43
    Level completed: 75%, Points required for next Level: 50
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    32
    Points
    4.700
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    System.usbDiskModeActivat e()
    yellow = Color.new(255, 255, 0)
    blue = Color.new(0, 0, 255)
    orange = Color.new(223, 88, 6)
    grey = Color.new(94, 97, 111)
    black = Color.new(0, 0, 0)
    red = Color.new(255, 0, 0)
    white = Color.new (255, 255, 255)
    brun = Image.load ("Images/brun.png")
    crun = Image.load ("Images/crun.png")
    drun = Image.load ("Images/drun.png")
    erun = Image.load ("Images/erun.png")
    frun = Image.load ("Images/frun.png")
    grun = Image.load ("Images/grun.png")
    hrun = Image.load ("Images/hrun.png")
    ajump = Image.load ("Images/ajump.png")
    istand = Image.load ("Images/istand.png")
    Image:clear (white)
    screen:blit (100, 150, istand)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(60 )
    pad = Controls.read()
    if pad:right() then
    screen:blit (140, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (180, 150, brun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (220, 150, crun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (260, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (290, 150, erun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (340, 150, frun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (380, 150, grun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (420, 150, hrun)
    screen.flip()
    Image:clear (white)
    end
    if pad:cross() then
    screen:blit (100, 150, istand)
    screen.flip()
    screen.waitVblankStart(10 )
    Image:clear (white)
    screen:blit (130, 150, ajump)
    screen.flip()
    screen.waitVblankStart(20 )
    Image:clear (white)
    screen:blit (140, 150, istand)
    screen.flip()
    screen.waitVblankStart()
    end

    This is kind of ugly code but I am trying to learn
    anyway, it always will come up then it will stay on for about 2 seconds the it will say press start to restart, so if someone could help me I would appreciate it :)

  12. #132
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Does any one know what "loop in gettable" means, because it keeps on shoeing it as an error.

    Edit: I added a loop around the controls part...
    Code:
    System.usbDiskModeActivate()
    yellow = Color.new(255, 255, 0)
    blue = Color.new(0, 0, 255)
    orange = Color.new(223, 88, 6)
    grey = Color.new(94, 97, 111)
    black = Color.new(0, 0, 0)
    red = Color.new(255, 0, 0)
    white = Color.new (255, 255, 255)
    brun = Image.load ("Images/brun.png")
    crun = Image.load ("Images/crun.png")
    drun = Image.load ("Images/drun.png")
    erun = Image.load ("Images/erun.png")
    frun = Image.load ("Images/frun.png")
    grun = Image.load ("Images/grun.png")
    hrun = Image.load ("Images/hrun.png")
    ajump = Image.load ("Images/ajump.png")
    istand = Image.load ("Images/istand.png")
    Image:clear (white)
    screen:blit (100, 150, istand)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(60 )
    
    end
    pad = Controls.read()
    if pad:right() then
    screen:blit (140, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (180, 150, brun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (220, 150, crun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (260, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (290, 150, erun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (340, 150, frun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (380, 150, grun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (420, 150, hrun)
    screen.flip()
    Image:clear (white)
    end
    if pad:cross() then
    screen:blit (100, 150, istand)
    screen.flip()
    screen.waitVblankStart(10 )
    Image:clear (white)
    screen:blit (130, 150, ajump)
    screen.flip()
    screen.waitVblankStart(20 )
    Image:clear (white)
    screen:blit (140, 150, istand)
    screen.flip()
    screen.waitVblankStart()
    end
    end
    Geändert von MagicianFB (10-07-2005 um 03:38 PM Uhr)
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  13. #133
    Points: 4.700, Level: 43
    Level completed: 75%, Points required for next Level: 50
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    32
    Points
    4.700
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    k, thanks but it says '=' expected near 'e'

  14. #134
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dack Chaar
    k, thanks but it says '=' expected near 'e'
    That's because, due to a forum glitch, spaces are put in paces they shouldn't be.
    So just look through the code and find spaces that look like the shouldn't be there. For example, the System.usbDiskModeActivat e() has a space in it that shouldn't be there, so just delete it.
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  15. #135
    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 MagicianFB
    Does any one know what "loop in gettable" means, because it keeps on shoeing it as an error.

    Edit: I added a loop around the controls part...
    Code:
    System.usbDiskModeActivate()
    yellow = Color.new(255, 255, 0)
    blue = Color.new(0, 0, 255)
    orange = Color.new(223, 88, 6)
    grey = Color.new(94, 97, 111)
    black = Color.new(0, 0, 0)
    red = Color.new(255, 0, 0)
    white = Color.new (255, 255, 255)
    brun = Image.load ("Images/brun.png")
    crun = Image.load ("Images/crun.png")
    drun = Image.load ("Images/drun.png")
    erun = Image.load ("Images/erun.png")
    frun = Image.load ("Images/frun.png")
    grun = Image.load ("Images/grun.png")
    hrun = Image.load ("Images/hrun.png")
    ajump = Image.load ("Images/ajump.png")
    istand = Image.load ("Images/istand.png")
    Image:clear (white)
    screen:blit (100, 150, istand)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(60 )
    
    end
    pad = Controls.read()
    if pad:right() then
    screen:blit (140, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (180, 150, brun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (220, 150, crun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (260, 150, drun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (290, 150, erun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (340, 150, frun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (380, 150, grun)
    screen.flip()
    Image:clear (white)
    screen.waitVblankStart(10 )
    screen:blit (420, 150, hrun)
    screen.flip()
    Image:clear (white)
    end
    if pad:cross() then
    screen:blit (100, 150, istand)
    screen.flip()
    screen.waitVblankStart(10 )
    Image:clear (white)
    screen:blit (130, 150, ajump)
    screen.flip()
    screen.waitVblankStart(20 )
    Image:clear (white)
    screen:blit (140, 150, istand)
    screen.flip()
    screen.waitVblankStart()
    end
    end
    Im not to sure but i dont think you have a while loop and you have a "end"
    before your pad = Controls.read() that shouldn't be there. Im not the best coder though to im not quite sure.
    F.A.L.O?

  16. #136
    Points: 4.700, Level: 43
    Level completed: 75%, Points required for next Level: 50
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    32
    Points
    4.700
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    K, thanks for your help guys, and sorry to be such a noob, but it says <eof> expected near end.

  17. #137
    QJ Gamer Blue
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    USA
    Beiträge
    214
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    im trying to make a slow moving cursor, but it moves too much by just tapping the dpad. any one know how to fix this
    Code:
    black = Color.new(0, 0, 0)
    
    x = 139
    y = 86
    
    cursor = Image.load("cursor.png")
    background = Image.load("background.png")
    
    while true do
    screen:blit(0, 0, background, false)
    screen:blit(x, y, cursor)
    screen.flip()
    
    pad = Controls.read()
    
    if pad:up() then
    y = y - 1
    screen.flip()
    end
    
    if pad:down() then
    y = y + 1
    screen.flip()
    end
    
    if pad:left() then
    x = x - 1
    screen.flip()
    end
    
    if pad:right() then
    x = x + 1
    screen.flip()
    end
    
    end

  18. #138
    QJ Gamer Blue
    Points: 4.648, Level: 43
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    In your garage
    Beiträge
    73
    Points
    4.648
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sofa king dumb
    im trying to make a slow moving cursor, but it moves too much by just tapping the dpad. any one know how to fix this
    Code:
    black = Color.new(0, 0, 0)
    
    x = 139
    y = 86
    
    cursor = Image.load("cursor.png")
    background = Image.load("background.png")
    
    while true do
    screen:blit(0, 0, background, false)
    screen:blit(x, y, cursor)
    screen.flip()
    
    pad = Controls.read()
    
    if pad:up() then
    y = y - 1
    screen.flip()
    end
    
    if pad:down() then
    y = y + 1
    screen.flip()
    end
    
    if pad:left() then
    x = x - 1
    screen.flip()
    end
    
    if pad:right() then
    x = x + 1
    screen.flip()
    end
    
    end

    Change the values in your x and y's. Each time a buttons pressed the X and Y are told to move in some way. The value determins how far the cursor moves each time. Thus if it's a high value then the cursor moves faster.. lower value.. moves slower.

    :)
    Geändert von Bilo (10-07-2005 um 05:29 PM Uhr)

  19. #139
    QJ Gamer Blue
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    USA
    Beiträge
    214
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    if pad:right() then
    x = x + 0.25
    screen.flip()
    end

    would this work then? thanks in advance

  20. #140
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    What do all the second pair of numbers when yo blit an objects mean?

    example:
    Code:
    -------------these two:  v  v ----------------------
    screen:blit(0, 0, image, 0, 0, width, height, false)
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  21. #141
    QJ Gamer Blue
    Points: 4.648, Level: 43
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    In your garage
    Beiträge
    73
    Points
    4.648
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    I think so.

    I'm not sure how lua handles values.. Not too sure if it would see the value 0.00
    but in theory, yes.

    Try it and see.

  22. #142
    QJ Gamer Blue
    Points: 4.648, Level: 43
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    In your garage
    Beiträge
    73
    Points
    4.648
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von MagicianFB
    What do all the second pair of numbers when yo blit an objects mean?

    example:
    Code:
    -------------these two:  v  v ----------------------
    screen:blit(0, 0, image, 0, 0, width, height, false)

    Isn't it the rotation point?

  23. #143
    QJ Gamer Blue
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    USA
    Beiträge
    214
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    what am i doing wrong, im trying to make a paint in lua using the dpad, but it ends up like an ect-a-sketch and by that i mean the line that is being drawn cannot be turn on/off using x like its supposed to. (attached is the cursor pic its just a red dot, and that im using and that's the script) thanks in advance
    Code:
    black = Color.new(0, 0, 0)
    white = Color.new(255, 255, 255)
    
    x = 139
    y = 86
    
    cursor = Image.load("cursor.png")
    
    canvas = Image.createEmpty(480, 272)
    canvas:clear(white)
    
    while true do
    screen:blit(x, y, cursor)
    screen.flip()
    
    pad = Controls.read()
    
    if pad:up() then
    y = y - 1
    screen.flip()
    end
    
    if pad:down() then
    y = y + 1
    screen.flip()
    end
    
    if pad:left() then
    x = x - 1
    screen.flip()
    end
    
    if pad:right() then
    x = x + 1
    screen.flip()
    end
    
    if pad:cross() then
    canvas:drawLine(x, y, 1, 1, black)
    screen.flip()
    end
    
    end
    Angehängte Grafiken Angehängte Grafiken  

  24. #144
    QJ Gamer Blue
    Points: 5.446, Level: 47
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    330
    Points
    5.446
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    XteticX, that sounds interesting. I had thought to have one image maybe 2 to 3 times the size of the screen that could be scrolled around, but the tiles are probably better. Any reason they have to be the size of the screen, or could you have smaller tiles? Then if you had a small animation going on somewhere, a much smaller section of the screen would be getting refreshed over and over. Also, would it mess things up to have different size tiles? Meaning the whole map could be made of 420x278 tiles (or whatever size) and then one tile could actually be made of 4 smaller tiles... just as an example. Also, just a side thought, smaller tiles would mean less offscreen stuff is being loaded and causing lag.
    I have to go to work now, but tomorrow I will begin studying the coding thing in ernest. Thanks for posting some of your stuff. I'm sure it'll help.

  25. #145
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys! Here's a quick demo of how to load RPG Maker XP charsets in lua. Just use the replace charset.png, with the one you want.

    Code:
    function loadcharset(charset)
    	down = {}
    	left = {}
    	right = {}
    	up = {}
    
    	for i=1,4 do
    		down[i] = Image.createEmpty(charset:width()/4, charset:height()/4)
    	end
    	for i=1,4 do
    		left[i] = Image.createEmpty(charset:width()/4, charset:height()/4)
    	end
    	for i=1,4 do
    		right[i] = Image.createEmpty(charset:width()/4, charset:height()/4)
    	end
    	for i=1,4 do
    		up[i] = Image.createEmpty(charset:width()/4, charset:height()/4)
    	end
    	for i=0,3 do
    		down[i+1]:blit(0, 0, charset, (i*charset:width()/4), 0, charset:width()/4, charset:height()/4)
    	end
    	for i=0,3 do
    		left[i+1]:blit(0, 0, charset, (i*charset:width()/4), charset:height()/4, charset:width()/4, charset:height()/4)
    	end
    	for i=0,3 do
    		right[i+1]:blit(0, 0, charset, (i*charset:width()/4), 2*charset:height()/4, charset:width()/4, charset:height()/4)
    	end
    	for i=0,3 do
    		up[i+1]:blit(0, 0, charset, (i*charset:width()/4), 3*charset:height()/4, charset:width()/4, charset:height()/4)
    	end
    end
    
    charset = Image.load("charset.png")
    
    loadcharset(charset)
    screen:blit(0, 0, down[1])
    screen:flip()
    pos = 0
    while true do
    
    	screen.waitVblankStart(8)
    	pad = Controls.read()
    	
    	if pad:up() then
    		if pos==4 then
    			pos = 1
    		else
    			pos = pos+1
    		end
    		screen:clear()
    		screen:blit(100, 100, up[pos])
    		screen:flip()
    	elseif pad:down() then
    		if pos==4 then
    			pos = 1
    		else
    			pos = pos+1
    		end
    		screen:clear()
    		screen:blit(100, 100, down[pos])
    		screen:flip()
    	elseif pad:left() then
    		if pos==4 then
    			pos = 1
    		else
    			pos = pos+1
    		end
    		screen:clear()
    		screen:blit(100, 100, left[pos])
    		screen:flip()
    	elseif pad:right() then
    		if pos==4 then
    			pos = 1
    		else
    			pos = pos+1
    		end
    		screen:clear()
    		screen:blit(100, 100, right[pos])
    		screen:flip()
    	elseif pad:r() then
    		break
    	end
    end
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

  26. #146
    QJ Gamer Blue
    Points: 5.446, Level: 47
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    330
    Points
    5.446
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Ok, stupid question: what are rpg maker char sets? I've never used an rpg maker, being unsatisfied with the level of graphics and all. I haven't been following them since rpg maker 2 came out for ps2. Is the XP one pretty good?
    XteticX, I read through your post again (with slightly less tired eyes so it made more sense this time). Seems to be an effective method. So is the position of the Hero always in the center and the background scrolls, or does he move around the screen and the background starts scrolling when he nears the edge of the screen? The latter is the result I'd like to go for. I'm wanting to do environments very similarly to ff vii-ix. Either hand drawn, or snatched from another source, like an anime or something. As I've said, I don't expect to be able to make a final fantasy quality game, but I do want to go for that kind of feel. I've always hated the more traditional rpgs, with repeated tiles for a patch of grass or identical looking trees and huts.
    Also I noticed "Hero" was capitalized in your post. Is that his name, and if so, is that a clue as to what your project is?
    Geändert von Snaku (10-08-2005 um 08:28 AM Uhr)

  27. #147
    QJ Gamer Silver
    Points: 6.087, Level: 50
    Level completed: 69%, Points required for next Level: 63
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    script.lua
    Beiträge
    426
    Points
    6.087
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Snaku
    Ok, stupid question: what are rpg maker char sets? I've never used an rpg maker, being unsatisfied with the level of graphics and all. I haven't been following them since rpg maker 2 came out for ps2. Is the XP one pretty good?
    XteticX, I read through your post again (with slightly less tired eyes so it made more sense this time). Seems to be an effective method. So is the position of the Hero always in the center and the background scrolls, or does he move around the screen and the background starts scrolling when he nears the edge of the screen? The latter is the result I'd like to go for. I'm wanting to do environments very similarly to ff vii-ix. Either hand drawn, or snatched from another source, like an anime or something. As I've said, I don't expect to be able to make a final fantasy quality game, but I do want to go for that kind of feel. I've always hated the more traditional rpgs, with repeated tiles for a patch of grass or identical looking trees and huts.
    Also I noticed "Hero" was capitalized in your post. Is that his name, and if so, is that a clue as to what your project is?

    A clue. lol. No, Its just the name of the variable. And yes, caracter moves around freely, once he reaches the edge of the screen, then the anim moves the next piece. I'm just saying, PROBABLY, you could do it like FF as you say if you had maybe 5 pieces of the background at once. Having the next piece for all four direction ready, but flikering issues could arise. Anyway I'm just saying it IS possible, just it ain't gonna be easy. I could prob do it but my free time is limited right now. :icon_sad:

    I had thought to have one image maybe 2 to 3 times the size of the screen that could be scrolled around
    This would indeed make our lifes easier, but I think the current luaplayer still cant blit big enought images. Something like 512pix max I'm not sure. Anyway I hope you get your game into gear soon. I wanna see some RPGs come out before ours. Good luck.

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

    What is wrong with this code? It says i have a error on line 19 with "then".

    Code:
    m = 1
    ran = math.random(100)
    blue = Color.new(0, 0, 225)
    
    while true do
    
    pad = Controls.read()
    
    if pad:up() then
    screen:clear()
    screen:print(132, 230, string.format("d", m + 1), blue)
    screen:flip() end
    
    if pad:down() then
    screen:clear()
    screen:print(132, 230, string.format("d", m - 1), blue)
    screen:flip() end
    
    if pad:cross() and m = ran then
    screen:clear()
    screen:print(132, 230, string.format("d", m), blue)
    screen:print(122, 230, "You guessed correctly!", blue)
    screen:flip() end
    
    if pad:start() then
    break end
    
    end
    F.A.L.O?

  29. #149
    NDS Mod
    Points: 18.386, Level: 86
    Level completed: 8%, Points required for next Level: 464
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    w00+land
    Beiträge
    645
    Points
    18.386
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Twenty 2
    What is wrong with this code? It says i have a error on line 19 with "then".

    Code:
    m = 1
    ran = math.random(100)
    blue = Color.new(0, 0, 225)
    
    while true do
    
    pad = Controls.read()
    
    if pad:up() then
    screen:clear()
    screen:print(132, 230, string.format("d", m + 1), blue)
    screen:flip() end
    
    if pad:down() then
    screen:clear()
    screen:print(132, 230, string.format("d", m - 1), blue)
    screen:flip() end
    
    if pad:cross() and m = ran then
    screen:clear()
    screen:print(132, 230, string.format("d", m), blue)
    screen:print(122, 230, "You guessed correctly!", blue)
    screen:flip() end
    
    if pad:start() then
    break end
    
    end
    ypu have to use == when asking if something is true.
    "15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
    [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]

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

    Ok i fixed the == part and I forgot to put a % in front of d. No when I test the program and when i press up it goes straight to 2 and wont go higher. When i press down it goes straight to zero.

    Code:
    m = 1
    ran = math.random(100)
    blue = Color.new(0, 0, 225)
    
    while true do
    
    pad = Controls.read()
    
    if pad:up() then
    screen:clear()
    screen:print(230, 136, string.format("%d", m + 1), blue)
    screen:flip() end
    
    if pad:down() then
    screen:clear()
    screen:print(230, 136, string.format("%d", m - 1), blue)
    screen:flip() end
    
    if pad:cross() and m == ran then
    screen:clear()
    screen:print(230, 136, string.format("%d", m), blue)
    screen:print(230, 136, "You guessed correctly!", blue)
    screen:flip() end
    
    if pad:start() then
    break end
    
    end
    F.A.L.O?


 
Seite 5 von 342 ErsteErste 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 55 105 ... LetzteLetzte

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

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