Seite 219 von 342 ErsteErste ... 119 169 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 269 319 ... LetzteLetzte
Zeige Ergebnis 6.541 bis 6.570 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; LuaPlayer print text function doesn't support linebreaks. No other reason really....

  
  1. #6541
    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

    LuaPlayer print text function doesn't support linebreaks. No other reason really.



  2. #6542
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    I have a image with a player on it and I was able to get it on the screen and move it. My problem is that I don't know how to remove the background from the player image (blue).

  3. #6543
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    LuaPlayer print text function doesn't support linebreaks. No other reason really.
    Well if this is true, then how will you print half of a string on one line and half on the next? Man this is starting to frustrate me. And if Lua does not support this, why is it included in the lua dev kit snippets?

  4. #6544
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    remove the line that says clear:image blue or something like that. I havent done lua in a while.

    romulator move onto C OR C++ if you are getting frustrated.

  5. #6545
    Points: 3.873, Level: 39
    Level completed: 49%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Beiträge
    47
    Points
    3.873
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    I have a image with a player on it and I was able to get it on the screen and move it. My problem is that I don't know how to remove the background from the player image (blue).
    Make a .png with a alpha channel. The easiest way i can think of is making the image in photoshop with no color/transparent as background and saving as a .png. If you are using paint though you have no way of adding transparency. .png transparency is very useful too, you can get not only full transparency but also anything between 1~99% too.

    My only gripe about the lua transparency support is that when you blit a image with transparency onto another image you will lose all transparency. What made it worse is that you can't create an image with transparency by script (easily and resource freindly).

  6. #6546
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Can I add transperency with the gimp?

  7. #6547
    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

    Zitat Zitat von romulator
    Well if this is true, then how will you print half of a string on one line and half on the next? Man this is starting to frustrate me. And if Lua does not support this, why is it included in the lua dev kit snippets?
    Lua's default print function that prints to the console supports line breaks. LuaPlayer print to screen function that prints to the screen doesn't.

  8. #6548
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    How can I use the default functions that print to the console or am I stuck to figure out a way on my own? (It's 12:33 am so I'm very tired). Thanks for your help anyway yaustar if you can't figure this out.

  9. #6549
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    I only knew about the screen:Print function when i used lua. Never knew of another way ...

    Yaustar would it be easier for me to go to C if i plan on using the gu because i have something lined up now.

  10. #6550
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von romulator
    How can I use the default functions that print to the console or am I stuck to figure out a way on my own? (It's 12:33 am so I'm very tired). Thanks for your help anyway yaustar if you can't figure this out.
    print("text")

  11. #6551
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Ummm I tried that and that didn't help. Unless you could explain further, I won't be able to do it.

  12. #6552
    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 sony psp player
    Can I add transperency with the gimp?
    Assuming you've got the image saved as a png:

    Go to Select>By Color
    Click on your background (make sure your background is a color not used anywhere else on your sprite)
    Go to Layer>Transparency>Color to Alpha
    Choose your background color by clicking on the color box
    Click OK.

    If that transparency option is greyed out, there should be one that isn't, which is Add Alpha Channel. Guess what that does.


    Zitat Zitat von romulator
    How can I use the default functions that print to the console or am I stuck to figure out a way on my own? (It's 12:33 am so I'm very tired). Thanks for your help anyway yaustar if you can't figure this out.
    This is sort of what the Lua Code Challenge 3 was on Evilmana.com:
    http://forums.evilmana.com/index.php?topic=601.15

    Have a look at the last post (#20), you can use whatever you need from it, if you like. I believe I commented it pretty well.

  13. #6553
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    ok, i have this really simple jump theory, here is the code with the animation and the problem is that it doesn't come back down when prompted to
    Code:
    standright = Image.load("images/jack/jackstandright.png")
    jump = Image.load("images/jack/jackjumpright1.png")
    jump2 = Image.load("images/jack/jackjumpright2.png")
    jump3 = Image.load("images/jack/jackjumpright3.png")
    player = {}
    player.x = 20
    player.y = 200
    player.img = standright
    Timer1 = 0
    
    function jumpright()
    
    Timer1 = Timer1 + 1
    
    
            if Timer1==5 then
    
            player.img = jump
    
            end
    
    
    
            if Timer1==10 then
    
            player.img = jump2
    
            end
    
    
                     if Timer1==15 then
     
                     player.img = jump3
    
                     end
    
    while true do  ----MAIN LOOP----
    
    oldx = player.x
    oldy = player.y
    
    
    screen:clear()
    
    
    pad = Controls.read()
    
    if pad:up() then
    jumpright()
    player.y = player.y + 10   --player y is 20 so if you add it it will go 30
    end
    
    if pad:up() and player.y == 30 then  
    --since player y is 30 because of the last loop, i want it to come back down to 20
    
    player.y = player.y + 10
    end
    
    screen:blit(player.x, player.y, player.img)
    
    screen.flip()
    oldpad = pad
    screen.waitVblankStart()
    end
    also, when the animatin stops, it won't clear the scrren and replaye it with player.img, even with the running animation

  14. #6554
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    the function is only being called one time, specifically when the button is pressed. No button, no function. Try using a flag like player.jumping = true and have a function run while that flag is true and not run when it is false.

  15. #6555
    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 moncristo_da_dev
    ok, i have this really simple jump theory, here is the code with the animation and the problem is that it doesn't come back down when prompted to
    Code:
    standright = Image.load("images/jack/jackstandright.png")
    jump = Image.load("images/jack/jackjumpright1.png")
    jump2 = Image.load("images/jack/jackjumpright2.png")
    jump3 = Image.load("images/jack/jackjumpright3.png")
    player = {}
    player.x = 20
    player.y = 200
    player.img = standright
    Timer1 = 0
    
    function jumpright()
    
    Timer1 = Timer1 + 1
    
    
            if Timer1==5 then
    
            player.img = jump
    
            end
    
    
    
            if Timer1==10 then
    
            player.img = jump2
    
            end
    
    
                     if Timer1==15 then
     
                     player.img = jump3
    
                     end
    
    while true do  ----MAIN LOOP----
    
    oldx = player.x
    oldy = player.y
    
    
    screen:clear()
    
    
    pad = Controls.read()
    
    if pad:up() then
    jumpright()
    player.y = player.y + 10   --player y is 20 so if you add it it will go 30
    end
    
    if pad:up() and player.y == 30 then  
    --since player y is 30 because of the last loop, i want it to come back down to 20
    
    player.y = player.y + 10
    end
    
    screen:blit(player.x, player.y, player.img)
    
    screen.flip()
    oldpad = pad
    screen.waitVblankStart()
    end
    also, when the animatin stops, it won't clear the scrren and replaye it with player.img, even with the running animation
    you should give animlib a try. (unless you already have).
    --------------------------------------------------------------------------------------

  16. #6556
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Now I have a image with an alpha channel. How do I use it in lua?

    This is my code, but it doesn't work:
    screen:blit(movey, movex, player, alpha = true)

  17. #6557
    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

    Zitat Zitat von romulator
    How can I use the default functions that print to the console or am I stuck to figure out a way on my own? (It's 12:33 am so I'm very tired). Thanks for your help anyway yaustar if you can't figure this out.
    The short answer is that you write your function that parses the string for line breaks and prints the text in the right positions.
    -= Double Post =-
    Zitat Zitat von eldiablov
    I only knew about the screen:Print function when i used lua. Never knew of another way ...

    Yaustar would it be easier for me to go to C if i plan on using the gu because i have something lined up now.
    It be easier in some ways and harder in others. In short, I honestly don't know. You still have to face the same challenges but the difference is that it be in a different language.

    If it was me, I would just use an existing engine (eg LTE) rather then re-inventing the wheel.
    Geändert von yaustar (04-06-2007 um 08:05 AM Uhr) Grund: Automerged Doublepost

  18. #6558
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    Now I have a image with an alpha channel. How do I use it in lua?

    This is my code, but it doesn't work:
    screen:blit(movey, movex, player, alpha = true)
    The alpha is true as default in the image:blit() function, you don't need to type true or false.

    Code:
    screen:blit(movey, movex, player, alpha = true)
    The red area is the error, why you saw 'alpha = true' in the LUA function page is because they were stating to the user that it represents the boolean of the alpha to the blitting.

    Code:
    screen:blit(movey, movex, player, true)
    But as i said it's default, so you don't need it.
    Geändert von HaxxBlaster (04-06-2007 um 09:14 AM Uhr)
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  19. #6559
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Thanks!

  20. #6560
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    you should give animlib a try. (unless you already have).
    i don't want to put that big code in the beginning, i just want to blit and play a sprite animation, so can you give me the code simplified for that?

  21. #6561
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    big code ???!!!

    dofile("animlib.lua")

    If that's big to you then you must be an extremely tiny person.
    or just have a really tiny computer

  22. #6562
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard Is it possible

    Is it possible to run an EBOOT using lua

  23. #6563
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von xpack
    Is it possible to run an EBOOT using lua
    ....NO
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  24. #6564
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    ^^ what he said

  25. #6565
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    can someone give me an explanation of Gum.perspective?

    Gum.perspective(50, 16/9, 0.5, 1000)


    I know that the 16/9 is for the aspect ratio of the psp's screen, but what are the other 3 numbers for?

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

    In order:
    Field of View (FoV)
    Aspect ratio
    Near clipping plane
    Far clipping plane

    http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html
    About halfway down the page.

  27. #6567
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    the 50 is i think like the field
    and .5 is like how close the cam can be, and the 1000 is how far it could be

  28. #6568
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    50 is field of view aka how much canm be seen 0.5 is how close something can get before being clipped and 1000 is how far it can get before being clipped.

  29. #6569
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    field of view - how does that work exactly?

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

    FOV is how many degree you want the field of vision to be. It is usually in degrees.

    http://fly.cc.fer.hr/~unreal/theredb...es/Fig3-12.gif


 

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

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