Seite 83 von 342 ErsteErste ... 33 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 133 183 ... LetzteLetzte
Zeige Ergebnis 2.461 bis 2.490 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; Ok, thanks jon frost. I'll try and look at it from here to make it better....

  
  1. #2461
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Ok, thanks jon frost. I'll try and look at it from here to make it better.



  2. #2462
    Points: 5.745, Level: 48
    Level completed: 98%, Points required for next Level: 5
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    404
    Points
    5.745
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von EminentJonFrost
    How is it stuck if the player it isnt touching and is not going to touch a block?
    I'm gonna go back read over everything again. This is confusing me. Plus, the way you explain it (no offense) is not helping.

    EDIT - OOOOOOHHHHH!! Ok. I get it now.

    All right, you want it luaplayer to check if theres a block in the way of the player, and if there is, the player cannot go through it. Makes sense. It was harder to understand that since some parts of your post were repetitive.

    Ok, umm...all right, heres an example:

    Code:
    -- box is 20x20 pixels
    box_x = 100
    box_y = 100
    box2_x = 120
    box2_y = 120
    
    --[[this means the box will cover from:
    
     (100, 100)____________(120, 100)
    |
    |
    |
    |
    |
    (100, 120)_____________(120, 120) <bottom right of pic
    
    ]]
    
    if player_x > box2_x or player_x < box_x and player_y > box2_y or player_y < box_y then 
    can_move = true
    end
    
    if player_x >= box_x and player_x <= box2_x then
    can_move = false
    end
    
    if player_y >= box_y and player_y <= box2_y then
    can_move = false
    end
    does that help you?


    not sure. becuase i m using
    Code:
    block = {}
    
    block[1] = { x = 34, y = 190 }
    for d = 2, 4 do
    block[d] = { x = block[d-1].x + 16, y = 150 }
    end

    like the code bellow makes move up to be false if it touch the bottom of my 17x17 pixel box

    Code:
    for c = 1, 4 do
    screen:blit(block[c].x, block[c].y, blockk)
    
    
    
    Code:
    if moving1 == true and x0 > block[c].x-14 and x0 < block[c].x+16 and y0+10 > block[c].y and y0 < block[c].y+17 then 
    moving1 = false
    end
    ---like in the code bellow, if the moving picture is at the left side of the box and bellow it, it becomes true
    Code:
    if moving1 == false and x0 < block[c].x-13 and y0 > block[c].y and y0 < block[c].y+17 then 
    moving1 = true
    end
    end
    but the problem is that if there is 3 boxs close with the same y axis but different x axis, the 1st at the right will work normally.
    the 1st and 2nd of the left move up will be true because the 1st at the right is making it to be true

    the thing i dont get it is to make it check if it have a box above the moving picture (that is x0 and y0)
    so if there is a box above its false. if there is no box above its true for the moving picture to go up
    Geändert von natan333 (05-24-2006 um 03:11 PM Uhr)
    Bequiet!!!
    I'm learning cc©cc

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

    so then do what your saying... its just booling really

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


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

    I need some help.
    Can someone explain me screen:drawLine to me VERY detailed? Because I need this to complete something that I'm making. Also, can somebody explain me screen:fillRect too? Thank you.
    --PSPduh
    Geändert von PSPduh (05-25-2006 um 04:22 PM Uhr)

  5. #2465
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    How do you call a variable from a table .. thats within a table?

    What I mean by "how do I call it" is...well, ok, to call a variable from a table, you just do this:

    Code:
    table = { variable1, variable2 }
    table.variable1 -- there, called the first variable from table "table".
    so how would I call that same variable if its table were inside another table?

    Code:
    bigger_table = {
    table = { variable1, variable2}
    table2...blah blah
    }
    Geändert von EminentJonFrost (05-25-2006 um 04:35 PM Uhr)
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  6. #2466
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Hey I was wondering what kind of software or whatever could create a .png image with a transparent background, so it wouldn't be all white, it would just be unnoticable. This is because I created one, yet when i saved it as .png my software said that it could save it in .png, yet it wouldn't retain all features. When i opend it again, it had a white, not transparent background. How would i do this?

  7. #2467
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    Hey I was wondering what kind of software or whatever could create a .png image with a transparent background, so it wouldn't be all white, it would just be unnoticable. This is because I created one, yet when i saved it as .png my software said that it could save it in .png, yet it wouldn't retain all features. When i opend it again, it had a white, not transparent background. How would i do this?
    The GIMP.
    To find it, go to Google.
    dont worry, its free.

    Ok, you need to get a runtime environment before the actual painting app, but its in the same site, so its not a problem.

    all right now, once its installed, open it.
    open up a photo. (its comes in it own window.)

    on the top it says: File Edit Select ... blah blah
    go to "Layer"
    scroll down to "Transparancy"
    to the side, go to "color to alpha"
    then you pick a color in your image that will become transparent.
    oh yea, it does .png pics. (and LOTS more.)
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  8. #2468
    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 EminentJonFrost
    How do you call a variable from a table .. thats within a table?

    What I mean by "how do I call it" is...well, ok, to call a variable from a table, you just do this:

    Code:
    table = { variable1, variable2 }
    table.variable1 -- there, called the first variable from table "table".
    so how would I call that same variable if its table were inside another table?

    Code:
    bigger_table = {
    table = { variable1, variable2}
    table2...blah blah
    }

    i dont think youre even allowed to do that. i would just make two seperate arrays/tables.
    --------------------------------------------------------------------------------------

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

    Yes you are allowed... Not in LUA though... nad it sounds to me like your making a class, which is in C(?)/C++ so far...

    But you can always do a multilayered table/array... I dunno if LUA supports it but...

    example[3][3] = ( '1', '2', '3'
    '4', '5', '6'
    '7', '8', '9'
    ;}; example

    Its something like that... that is for a tic-tac-toe board... so i dunno if LUA can support even this, let alone classes...

    sorry, no help here =(

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


  10. #2470
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard


    thanks for trying.

    but I know its possible.

    Luaplayer's own game "snake" has this piece of coding in it to prove it:

    Code:
    ...
    -- possible options for menu
    possibleOptions = {
    	speed = {
    		displayName = "Speed",
    		values = { 1, 2, 3 } },
    	level = {
    		displayName = "Level",
    		values = { "grass", "desert" } },
    	music = {
    		displayName = "Music",
    		values = { "on", "off" } },
    	sound = {
    		displayName = "Sound",
    		values = { "on", "off" } }
    }
    ...
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  11. #2471
    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 "example[3][1]" works (where [3] is the second table thats on the 3th place in the big table and [1] is the first value in the second table), but Im not completely sure.
    Have you tried to just use: "bigtable.table1.valu e"? Maybe that works aswell.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  12. #2472
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    i thought about it, but no I havent tried that. I will right now...

    edit - nevermind, I'm just gonna make a new table. I'll figure it out later.

    One last thing, I have the enemy's "y" location set to math.random(272). making it appear randomly, but how come it appears at the same place everytime I start the game up?
    Geändert von EminentJonFrost (05-26-2006 um 04:34 AM Uhr)
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  13. #2473
    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 EminentJonFrost
    i thought about it, but no I havent tried that. I will right now...

    edit - nevermind, I'm just gonna make a new table. I'll figure it out later.

    One last thing, I have the enemy's "y" location set to math.random(272). making it appear randomly, but how come it appears at the same place everytime I start the game up?

    put this at the VERY top of you code:

    Code:
    math.randomseed(os.time())
    it should give you different numbers now.
    --------------------------------------------------------------------------------------

  14. #2474
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    It worked!
    But why?
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  15. #2475
    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 EminentJonFrost
    It worked!
    But why?

    that function make the random numbers based on the time, which isnever the same. without it, the psp ram recalls the number it got last time, cause it gets kinda "lazy". i dont relly know how to exxplain it, but hey, it works!
    --------------------------------------------------------------------------------------

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

    ^^what he said it's especially great for luawindows
    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

  17. #2477
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    oh.
    thanks for explaining it!

    BTW, I think I found out how to call variables from tables that are inside tables.

    "table name" [#] .(dot) "variable"

    Code:
    example:
    a = { b, c = { d } }
    
    a[2].d
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  18. #2478
    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 or like so:

    table = {}
    table[1] = {x = 5}
    table[2] = {y = 6}

    screen:blit(table[1].x,table[2].y,image)

    i use mine this way(onle an example)
    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

  19. #2479
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever
    yes or like so:

    table = {}
    table[1] = {x = 5}
    table[2] = {y = 6}

    screen:blit(table[1].x,table[2].y,image)

    i use mine this way(onle an example)
    that way looks easier. more organized, easier to find what you want.
    I'll do it like that.
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    it makes things much more easier as you said especially to understand everything
    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

  21. #2481
    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 EminentJonFrost
    that way looks easier. more organized, easier to find what you want.
    I'll do it like that.

    it would be eaiser to just do:

    Code:
    table = {}
    
    table[1] = { x = 5, y = 6 }
    
    screen:blit(table[1].x, talbe[1].y, image)
    you dont need to create 2 tables.
    --------------------------------------------------------------------------------------

  22. #2482
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Yea, I downloaded The Gimp, yet when I try to save it with that transparent background it says because of .png capabilites, the layer must be merged, and then it doesn't save it with the invisible background? Any ideas? ???????

  23. #2483
    TheMarioKarters
    Guest

    Standard

    Zitat Zitat von emericaska8r
    Yea, I downloaded The Gimp, yet when I try to save it with that transparent background it says because of .png capabilites, the layer must be merged, and then it doesn't save it with the invisible background? Any ideas? ???????
    If you're having problems with transparent backgrounds, PM me the images, i'll do it.

  24. #2484
    Points: 4.492, Level: 42
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Minnesota, USA.
    Beiträge
    36
    Points
    4.492
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPduh
    I need some help.
    Can someone explain me screen:drawLine to me VERY detailed? Because I need this to complete something that I'm making. Also, can somebody explain me screen:fillRect too? Thank you.
    --PSPduh
    I'll explain them as best I can.


    screen:drawLine

    The syntax for screen:drawLine is as follows:

    Code:
     screen:drawLine(x0, y0, x1, y1, color)
    The x0 represents the starting "x" (horizontal) coordinates for a line.
    The y0 represents the starting "y" (vertical) coordinates for a line.

    The x1 represents the ending "x" (horizontal) coordinates for a line.
    The y1 represents the ending "y" (vertical) coordinates for a line.

    The color represents the color of the line.

    EXAMPLE:

    If I wanted to display a red line starting at the top left corner of the screen, and ending at the bottom right corner of the screen, I would use the following linesof code:

    Code:
    red = Color.new(255,0,0) 
     
    x0 = 0 
    y0 = 0
    x1 = 480
    y1 = 272
     
    while true do
     
    screen:drawLine(x0, y0, x1, y1, red)
     
    screen.waitVblankStart()
    screen.flip()
     
    end

    screen:fillRect

    The syntax for screen:fillRect is as follows:

    Code:
     screen:fillRect(x, y, width, height, color)
    The x represents the "x" (horizontal) coordinates for the top left-hand corner of the rectangle that you want to fill with a color.
    The y represents the "y" (vertical) coordinates for the top left-hand corner of the rectangle that you want to fill with a color.

    The width represents the width (in pixels) of the rectangle that you want to fill with a color.
    The height represents the height (in pixels) of the rectangle that you want to fill with a color.

    The color represents the color that the rectangle will be filled with.

    EXAMPLE:

    If I wanted to fill a rectangle with the color red that starts at the top left-hand corner of the screen, and extends 200 pixels in both directions (vertical and horizontal), I would use the following lines of code:





    Code:
     
    red = Color.new(255,0,0) x = 0 y = 0 width = 200 height = 200 while true do screen:fillRect(x, y, width, height, red) screen.waitVblankStart() screen.flip() end




    Hope that cleared things up a bit. :icon_smil

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

    Does anybody know if its faster to blit a whole image at once (so one big image) or two small slices? I need every bit of speed to be able to blit all the units.
    If a unit moves, I need to delete the unit first and then blit it at the new position. I can delete the whole unit and blit it at the new place. OR I can delete only the part where it isnt anymore. But if it moves diagonaly it has to delete two slices (eg upper- and leftside).
    I know its better to blit one big image then alot of smaller ones that form an image the same size. But im not sure if its the same if the smaller images have a smaller surface than the big one.

    I hope its clear I tried my best.

    BTW Why am I a PREMIUM Member suddenly? Thx to who ever made me one though!
    Geändert von Altair (05-27-2006 um 05:07 AM 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]

  26. #2486
    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 Jeffery
    I'll explain them as best I can.


    screen:drawLine

    The syntax for screen:drawLine is as follows:

    Code:
     screen:drawLine(x0, y0, x1, y1, color)
    The x0 represents the starting "x" (horizontal) coordinates for a line.
    The y0 represents the starting "y" (vertical) coordinates for a line.

    The x1 represents the ending "x" (horizontal) coordinates for a line.
    The y1 represents the ending "y" (vertical) coordinates for a line.

    The color represents the color of the line.

    EXAMPLE:

    If I wanted to display a red line starting at the top left corner of the screen, and ending at the bottom right corner of the screen, I would use the following linesof code:

    Code:
    red = Color.new(255,0,0) 
     
    x0 = 0 
    y0 = 0
    x1 = 480
    y1 = 272
     
    while true do
     
    screen:drawLine(x0, y0, x1, y1, red)
     
    screen.waitVblankStart()
    screen.flip()
     
    end

    screen:fillRect

    The syntax for screen:fillRect is as follows:

    Code:
     screen:fillRect(x, y, width, height, color)
    The x represents the "x" (horizontal) coordinates for the top left-hand corner of the rectangle that you want to fill with a color.
    The y represents the "y" (vertical) coordinates for the top left-hand corner of the rectangle that you want to fill with a color.

    The width represents the width (in pixels) of the rectangle that you want to fill with a color.
    The height represents the height (in pixels) of the rectangle that you want to fill with a color.

    The color represents the color that the rectangle will be filled with.

    EXAMPLE:

    If I wanted to fill a rectangle with the color red that starts at the top left-hand corner of the screen, and extends 200 pixels in both directions (vertical and horizontal), I would use the following lines of code:





    Code:
     
    red = Color.new(255,0,0) x = 0 y = 0 width = 200 height = 200 while true do screen:fillRect(x, y, width, height, red) screen.waitVblankStart() screen.flip() end




    Hope that cleared things up a bit. :icon_smil
    Thank you so much! :Punk: I'm copying that into notepad so I wont forget it.
    EDIT: Is there a way to make a curved line? And no I can't use a preset one in an image, for the app I'm making.
    Geändert von PSPduh (05-27-2006 um 06:11 AM Uhr)

  27. #2487
    Points: 4.492, Level: 42
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Minnesota, USA.
    Beiträge
    36
    Points
    4.492
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    I've kinda wondered how to do that myself, and I'll give it a try and see if I can come up with something. The only possible way that I can think of right now would be to draw every pixel in the curved line that you would want to create. Of course, that would take up a ton of lines of code.

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

    It doesn't have to be a ton of code, depends on the curve. I just think it would go really slow, because it has to blit the curve pixel by pixel.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

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

    I found this in the lua snippet thread in the dev's dungeon:
    Zitat Zitat von MagicianFB
    Here's a function to draw a circle:
    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
    Even though it would draw a circle, at least it is curved. But maybe I could use a for loop to draw the curved line, so it wouldn't take up lines and lines of code. That's what the for loop is there for, to do a lot in a little lines of code.

    EDIT: About screen:drawLine, do I need to use x0 y0 x1 y1? Because once you set them to what their equal to, then you can't change it. So can I do this:
    Code:
    screen:drawLine(10,10,90,100,red)
    Can I use different variables besides x0 y0 x1 y1? <<<< Thats what I really mean.
    Geändert von PSPduh (05-27-2006 um 07:11 AM Uhr)

  30. #2490
    Points: 4.492, Level: 42
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Minnesota, USA.
    Beiträge
    36
    Points
    4.492
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Yep, you can use different variables or no variables at all (just the actual numbers).


 

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

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