Seite 93 von 342 ErsteErste ... 43 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 143 193 ... LetzteLetzte
Zeige Ergebnis 2.761 bis 2.790 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; can u post the code for replacing the yellow pixels with purple?...

  
  1. #2761
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    can u post the code for replacing the yellow pixels with purple?


    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  2. #2762
    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 Glynnder- PSPro
    can u post the code for replacing the yellow pixels with purple?
    heres my theory: i havent tried it yet.

    first, blit the image. THEN define purple, and yellow, and some vars:

    Code:
    yellow = Color.new(255, 255, 0)
    purple = Color.new(102, 0, 153)
    a = 0
    b = 0
    thenif the image is 480X272)
    Code:
    while a < 481 and b < 273 do
    
    color = image.pixel(a,b)
    colors = color:colors()
    
    if (color == yellow) then
    assert(colors.r == 102)
    assert(colors.g == 0)
    assert(colors.b == 153)
    a = a+1
    else
    a = a+1
    end
    
    if a > 480 then
    a = 0
    b = b+1
    end
    
    end
    probably wont work. but its worth a try.
    --------------------------------------------------------------------------------------

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

    jw...

    is there a way to break back to the xmb screen? i'm planning to make it a standalone app but i have an exit in there and i was wondering if there was a way to break back to the xmb screen?

    edit: if i dl lua source do i need to re-compile it afterwards?
    Geändert von slicer4ever (07-09-2006 um 10:06 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

  4. #2764
    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 slicer4ever
    jw...

    is there a way to break back to the xmb screen? i'm planning to make it a standalone app but i have an exit in there and i was wondering if there was a way to break back to the xmb screen?
    I asked this question a while back on a different forum. I never got an answer though.
    Also, does anybody know how to make gravity? Like if a player jumps, it comes back down.

  5. #2765
    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

    kinda easy for example if you look at the source of my game(block attack you well see how i did gravity)

    but heres an example:

    Code:
    cyan = Color.new(0,255,255)
    block = Image.createEmpty(20,20)
    block:clear(cyan)
    
    gravity = 1
    upmove = 5
    
    block_Array = {}
    block_Array[1] = {x = 240, y = 250}
    
    function check_for_jump()
    block_array[1].y = block_Array[1].y + gravity
    if block_array[1].y > 250 then
    block_array[1].y = 250
    end
    if pad:cross() then
    block_Array[1].y = block_Array[1].y - upmove
    end
    end
    
    while true do
    screen:blit(block_array[1].x,block_array[1].y,block)
    
    check_for_jump()
    
    screen.flip()
    screen.waitVblankStart()
    end
    that should work as to simulate sometype of gravity
    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. #2766
    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 slicer4ever
    kinda easy for example if you look at the source of my game(block attack you well see how i did gravity)

    but heres an example:

    Code:
    cyan = Color.new(0,255,255)
    block = Image.createEmpty(20,20)
    block:clear(cyan)
    
    gravity = 1
    upmove = 5
    
    block_Array = {}
    block_Array[1] = {x = 240, y = 250}
    
    function check_for_jump()
    block_array[1].y = block_Array[1].y + gravity
    if block_array[1].y > 250 then
    block_array[1].y = 250
    end
    if pad:cross() then
    block_Array[1].y = block_Array[1].y - upmove
    end
    end
    
    while true do
    screen:blit(block_array[1].x,block_array[1].y,block)
    
    check_for_jump()
    
    screen.flip()
    screen.waitVblankStart()
    end
    that should work as to simulate sometype of gravity
    Thanks, now that I really took a look at it, it's really easy.

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

    well since my other question hasen't been answered i ask a new one:

    how do you draw a circle?

    i've tried:

    screen:drawcirc
    screen:fillCirc

    thats about it
    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

  8. #2768
    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 slicer4ever
    well since my other question hasen't been answered i ask a new one:

    how do you draw a circle?

    i've tried:

    screen:drawcirc
    screen:fillCirc

    thats about it
    From the lua code snippets thread :
    Code:
    function drawCirc(where, x, y, radius, color)
    
    	theta = 0
    
    	while theta<=360 do
    		where:drawLine((math.sin(  theta)*radius)+x, (math.cos(theta)*radius)+  y, (math.sin(theta+1)*radius  )+x, (math.cos(theta+1)*radius  )+y, color)
    		theta = theta+1
    	end
    end
    Plenty of other good snippets in there too.
    [IMG]http://img.photobucket.com/albums/v693/fchaos/koolaidsig.jpg[/IMG]

  9. #2769
    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

    o well i went to luaplayer.org and looked at ther functions thing ut couldn't find anything there well thanks=-)

    edit: what am i surpose to put at the where?
    Geändert von slicer4ever (07-09-2006 um 01:32 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

  10. #2770
    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

    How do you use animated sprites in lua?

  11. #2771
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    Make a timer and for time 1-20 do one animation, 21-40 another animation, etc..

  12. #2772
    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 thought of that, but I thought there would be an easier way.

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

    ok i was wondering if someone could help me with this: so ok i have 2 blocks of the exact same size in which i want to touch and when they do i want them to change to another 2ndary picture i have for them so basicly i want a collision in which they touch a both change pictures because i can't figure it out so yeah thanks in advance

  14. #2774
    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
    ok i was wondering if someone could help me with this: so ok i have 2 blocks of the exact same size in which i want to touch and when they do i want them to change to another 2ndary picture i have for them so basicly i want a collision in which they touch a both change pictures because i can't figure it out so yeah thanks in advance
    search "collisions in lua" and follow hat guide.
    --------------------------------------------------------------------------------------

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

    i need help with making an object/picture move left and right because i what i seem to be doing is getting it to go only right and stop and not go back left so help[ would be much appreciated.

  16. #2776
    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

    Can you post your code? Then its easier to help you. Or atleast the part which involves the moving of the character.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  17. #2777
    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 a way to get a character to move and change image while moving. What i mean by this is like when your using a sprite sheet.

    Edit: i do actually know how to let the player move just not change images while doing so
    Geändert von mark.sparky (07-13-2006 um 11:59 AM Uhr)

  18. #2778
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mark.sparky
    hey is there a way to get a character to move and change image while moving. What i mean by this is like when your using a sprite sheet.
    The word you're looking for is 'animation'

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

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

    yes so do you know how to do it?

  20. #2780
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    It's been too long since I used Lua to be of any assistance really.

    What I would do though is download some of the hundreds of Lua homebrew games that are available and look at their animation code - it's the best way to learn.

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

  21. #2781
    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 anyway even if you are no help

  22. #2782
    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 remember seeing on the pspdev.org forums a example of animation. I believe is what on page 3, 4 or 5 of the lua section for psp. I'll try looking later if you are too lazy ;).

  23. #2783
    QJ Gamer Green
    Points: 5.866, Level: 49
    Level completed: 58%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Dark_Alex Command Center
    Beiträge
    597
    Points
    5.866
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    has anyone got TTLDE1.0 or 2.0 working with new Luaplayer20?? i used them fine on 0.16 but i keep getting a no script found in Luaplayer20...
    [FONT=Fixedsys][spoiler="PSP DAX_Hacks"]PSP1001 3.71-M33-4 ------------------------------------------
    - 17 Diff Castlevania Games on 4Gb Stick Cps2psp2.30 - MVSpsp[/FONT][FONT=Fixedsys]2.30[/FONT][FONT=Fixedsys] + Bootlegs - gpSP09 - PsUltraRip - Manhunt2 Uncensored
    [/spoiler] [/FONT][FONT=Fixedsys]Consoles Pwnd: PSP, Xbox360
    Pwnd: PSP, PSOne, PS2, Xbox360
    [/FONT]

  24. #2784
    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 load. There is a problem with putting the animation on the screen.

  25. #2785
    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

    Can you post your code? Then its easier to help you. Or atleast the part which involves the moving of the character.
    Today 11:11 AM
    okay i tried this:

    if x>= 0 and x < 450 then x = x + 2
    end
    if x == 450 and x>0 then x = x-2
    end
    but that just makes it stop at the right side forever so yeah please help

  26. #2786
    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 pspsalv2
    okay i tried this:

    if x>= 0 and x < 450 then x = x + 2
    end
    if x == 450 and x>0 then x = x-2
    end
    but that just makes it stop at the right side forever so yeah please help
    I think I may have had this problem before, try this:

    Code:
    if x >= 0 and x <= 250 then
    x=x+2
    end
    if x <= 450 and x >= 0 then
    x = x - 2
    end
    Hope this helps.

    EDIT- I just noticed why you get stuck on the right side. You put

    if x == 450

    that means that if x = 449 then it won't move left. Just change that to <=.
    Geändert von Access_Denied (07-13-2006 um 06:08 PM Uhr)

  27. #2787
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    pspsalv2 - Thats because its doing what you told it to. I was kinda bored and had about 5-10 minutes so i made a visual :) You have a loop going on but you dont know it.

    Oh and as how to fix it, use a bool.

    Zitat Zitat von Access_Denied
    EDIT- I just noticed why you get stuck on the right side. You put

    if x == 450

    that means that if x = 449 then it won't move left. Just change that to <=.
    Your code still wont work as it applys to the above paradox. Plus, it doesnt matter if he says if it is == 450 as he is improving by 2's, so it WILL hit the 450 mark, then go down, then go back up for being less then 450.
    Geändert von SG57 (07-13-2006 um 06:17 PM Uhr)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


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

    I think I may have had this problem before, try this:


    Code:
    if x >= 0 and x <= 250 then
    x=x+2
    end
    if x <= 450 and x >= 0 then
    x = x - 2
    end

    Hope this helps.

    EDIT- I just noticed why you get stuck on the right side. You put

    if x == 450

    that means that if x = 449 then it won't move left. Just change that to <=.

    thanks but access denied ....

    Oh and as how to fix it, use a bool.
    yeah im not too sure what that is SG57 so if you or someone else could explain...please

  29. #2789
    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
    thanks but access denied ....



    yeah im not too sure what that is SG57 so if you or someone else could explain...please

    a bool is basically a true or false statement. try this:


    Code:
    move_right = false
    move_left = false
    
    while true do
    
    if if x >= 0 and x <= 250 then
       move_right = true
       move_left = false
    end
    
    if x <= 450 and x >= 0 then
       move_right = false
       move_left = true
    end
    
    if move_right == true then
       x = x+2
    end
    if move_left == true then
       x = x-2
    end
    
    end
    hiow i helped
    Geändert von Grimfate126 (07-13-2006 um 06:35 PM Uhr)
    --------------------------------------------------------------------------------------

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

    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!
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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


 

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 .