Seite 92 von 342 ErsteErste ... 42 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 142 192 ... LetzteLetzte
Zeige Ergebnis 2.731 bis 2.760 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; Hi cool thread helped me alot...

  
  1. #2731
    Points: 3.931, Level: 39
    Level completed: 88%, Points required for next Level: 19
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Beiträge
    17
    Points
    3.931
    Level
    39
    Downloads
    0
    Uploads
    0

    Standard

    Hi cool thread helped me alot



  2. #2732
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    hello and well i guess welcome to the forums it looks like=-)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    Zitat Zitat von slicer4ever
    ]edit: the not symbol(~) is just what i needed to cut down my code just enough to get it working=-)
    Good to hear. Atleast I helped you with one thing
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

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

    Can Someone Pleassssssssssssss Help Me Wit My Question On The Last Page??
    --------------------------------------------------------------------------------------

  5. #2735
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Talking

    can you upload your code or pm a link to where i can see it?
    Geändert von slicer4ever (06-21-2006 um 09:27 AM Uhr)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  6. #2736
    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 slicer4ever
    can you upload your code or pm a link to where i can see it?
    me?? i was just asking if there was a way to not use oldpad statements. my question is on the last page. and my code is the bullets snippet from pspmillionaire.
    --------------------------------------------------------------------------------------

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

    @ Grimfate126:
    I never used his snippets, but I can't imagine why the oldpad way wouldn't work. Or he/you made a mistake with it. Otherwise it should know weither or not you press the button again.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  8. #2738
    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

    Grimfate126 if you show us the code that doesnt work then we can see if theres a mistake (evilmana.com doesnt work anymore for some reason so we cant see it from there)
    <<Put A message Here>>
    <<Just made another rubbish website visit it here.>>

  9. #2739
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    just do a couple of replaces:

    for example:

    1. find and replace:

    and oldpadbutton used)() ~= padbutton used)()

    with

    (nothing)

    next search for oldpad and replace that with nothing

    this well make it so now when you hold down the button to fire it well keep firing

    but wait you are limited by 5 bullets(if i remeber correctly) so go find the array that says bullets and you should see a loop above it change the 5 to say 20 that should be enough to clear them off the screen in time o and go to your bulletsetup array and you well see sometin like:

    if currentbullet > 5 then
    currentbullet = 1
    else
    currentbullet = currentbullet + 1
    end

    change the 5 to the samething you changed the the loop with
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  10. #2740
    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 Saving

    Does anyone know if there is a save state function in lua?

  11. #2741
    QJ Gamer Gold
    Points: 18.627, Level: 86
    Level completed: 56%, Points required for next Level: 223
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    LOLWUT
    Beiträge
    2.625
    Points
    18.627
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Access_Denied
    Does anyone know if there is a save state function in lua?
    You would have to make it up yourself.
    Code:
    file = io.open("highscore.txt", "w") --Open the file in write mode
    file:write("Highscore = " .. highscore) --Write the highscore to the file
    file:close() --Close the file.
    My lua is a bit rusty, but I think that is how it is.
    Yep, it is. I tested it and it works perfectly.
    Geändert von PSPduh (09-14-2006 um 04:09 PM Uhr)

  12. #2742
    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 slicer4ever
    just do a couple of replaces:

    for example:

    1. find and replace:

    and oldpadbutton used)() ~= padbutton used)()

    with

    (nothing)

    next search for oldpad and replace that with nothing

    this well make it so now when you hold down the button to fire it well keep firing

    but wait you are limited by 5 bullets(if i remeber correctly) so go find the array that says bullets and you should see a loop above it change the 5 to say 20 that should be enough to clear them off the screen in time o and go to your bulletsetup array and you well see sometin like:

    if currentbullet > 5 then
    currentbullet = 1
    else
    currentbullet = currentbullet + 1
    end

    change the 5 to the samething you changed the the loop with
    the problem with that is when you TAP x, 3-4 bullets come out at once, and if you HOLD it, the bullets just line up in front of you and release once you let go of x. thats bad cause then you have 20 bullets going all at once , which is really cheap.
    --------------------------------------------------------------------------------------

  13. #2743
    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

    So without the oldpad it does work?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  14. #2744
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    yes it well the thing is it seems like it lags there are multiple ways of doing this like creating a timer and if you press x then the timer resets etc etc but i advise using oldpad just try diffrent things...
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  15. #2745
    Developer
    Points: 5.397, Level: 47
    Level completed: 24%, Points required for next Level: 153
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Ireland
    Beiträge
    205
    Points
    5.397
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone have a guide on making a simple pong game? I just havn't a clue on where to start making one

  16. #2746
    Developer
    Points: 4.965, Level: 45
    Level completed: 8%, Points required for next Level: 185
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Land of Oz
    Beiträge
    35
    Points
    4.965
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    .. just think...

    i would start with paddle movement, then add a ball with reflections off walls, then add in an angle thing to the paddle, so when it hits a paddle, it goes off at an angle depending how far up it the ball hits....

    you really need to think on your own if you want to program

  17. #2747
    QJ Gamer Blue
    Points: 4.464, Level: 42
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    146
    Points
    4.464
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    I recently decided to try making some homebrew games for the PSP. I'm trying to make a game similar to breakout. I'm having a problem with figuring out how to get the ball to move realistically (bouncing off walls and the paddle at the right angle). Could someone explain to me what math formula I would need to use to accomplish this? I've tried searching, but I haven't come accross a source code for another breakout (I know they exist, I just can't find them). So, feel free to post a link to another source code, and I will see how they did it.

  18. #2748
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    id like to know how to get the bounce off wall thing too,,

  19. #2749
    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

    just reverse the direction of the ball.

    Say you have a vertical wall
    then if the x component of the ball's speed is say 1 (m/s or whatever) and its y component is 2. Then if it hits the wall th x component will reverse. So it will become -1 and the y will remain the same. Very easy.

    If you want it to change the direction you will have to calculate the correct angle. You can use PSPGolf as an example for that.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  20. #2750
    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

    Can someone take a look at my code.
    The problem is at line 275 and the animation loops at the end.

    Here is my LUA Script
    http://www.sendspace.com/file/sw0ghd

  21. #2751
    QJ Gamer Blue
    Points: 4.464, Level: 42
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    146
    Points
    4.464
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    just reverse the direction of the ball.

    Say you have a vertical wall
    then if the x component of the ball's speed is say 1 (m/s or whatever) and its y component is 2. Then if it hits the wall th x component will reverse. So it will become -1 and the y will remain the same. Very easy.

    If you want it to change the direction you will have to calculate the correct angle. You can use PSPGolf as an example for that.

    Wouldn't that get the ball into an infinite loop between 2 points?

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

    nope.

    say the wall starts at xwall
    and the ball goes with 1 pixel per loop to the right, where vx is the speed of the ball (vx=1 at the start)

    if xball==xwall then
    vx=-vx
    end

    x=x+vx
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  23. #2753
    QJ Gamer Blue
    Points: 4.464, Level: 42
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Beiträge
    146
    Points
    4.464
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Have a look at the image I attached. It might clear up why I believe that the ball will be in an infinite loop.
    Miniaturansicht angehängter Grafiken Miniaturansicht angehängter Grafiken Lua Programming Help Thread-angle_visual.png  

  24. #2754
    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

    I think i get why you think it'll loop. I was talking about a verticle wall starting at xwall and a ball moving from the left side of it to the right.
    In case of a horizontal wall you do the same but then with the y component of the speed.

    Also the ball doesn't just move one pixel to the left, but its speed is one pixel to the left/loop. I hop it makes it clear. If not you'll have to try and see for yourself.
    Geändert von Altair (07-04-2006 um 05:00 PM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  25. #2755
    &lt;img src=&quot;images/smilies/psp.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&quot;inlineimg&quot; /&gt; &lt;img src=&quot;images/smilies/Punk.gif&quot; border=&quot;0&quot; alt=&quot;&quot; title=&quot;&quot; cl***=&
    Points: 11.105, Level: 69
    Level completed: 64%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Canada
    Beiträge
    1.944
    Points
    11.105
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    do any of you know how to change the colour of an image
    like something like this
    default image :)
    then some code to change the yellow to purple like this :o

    ive seen it done in psp air hockey, but i cant locate where it does it
    any help?

  26. #2756
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    by loading multiple images of the same thing but with diffrent colors for example:

    Code:
    purple_ball = image.load(purpleball)
    orange_ball = image.load(orangeball)
    green_ball = image.load(greenball)
    
    currentball = purple_ball
    oldpad = nil
    
    function change_ball_color()
    if pad:cross() and oldpad:cross() ~= pad:cross() then
    if currentball == purple_ball then
    currentball = orange_ball
    elseif currentball == orange_ball then
    currentball = green_ball
    elseif currentball == green_ball then
    currentball = purple_ball
    end
    end
    end
    
    while true do
    
    pad = Controls.read()
    
    change_ball_color()
    
    screen:blit(240,136,currentball)
    screen.flip()
    screen.waitVblankStart()
    oldpad = pad
    end
    that is all you have to do (note elseif is important because if you just use if then it well run threw each one and you well end up back at the purple ball
    Geändert von slicer4ever (07-06-2006 um 07:11 PM Uhr)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    that, which is faster, or you make a function that checks for yellow pixels and if it finds one, it changes it to purple.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  28. #2758
    Gutya
    Points: 15.093, Level: 79
    Level completed: 49%, Points required for next Level: 257
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    2.398
    Points
    15.093
    Level
    79
    Downloads
    0
    Uploads
    0

    Standard

    I just dug out LUA again to work on a projet. But havent worked in it for a while so i'm just making little test scripts, for some reason my function won't work, i get

    Error: functions.lua:6: '=' expected near 'function'

    Line 6 days 'function cursor()'

  29. #2759
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    hmmm..unsure also altair how would you do sometin like that?
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  30. #2760
    QJ Gamer Green
    Points: 5.981, Level: 50
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Texas
    Beiträge
    146
    Points
    5.981
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    that, which is faster, or you make a function that checks for yellow pixels and if it finds one, it changes it to purple.
    That would be pretty sloooow. Unless your working with small images. As for how you can change the color of an image, maybe take a solid color image (red, blue, etc) and place it on top of the other image with a alpha transparency?
    [IMG]http://img.photobucket.com/albums/v693/fchaos/koolaidsig.jpg[/IMG]


 

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 .