Seite 198 von 342 ErsteErste ... 98 148 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 248 298 ... LetzteLetzte
Zeige Ergebnis 5.911 bis 5.940 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; I don't like animlib i have a differnt code thats easier in my opion but i need the animation to ...

  
  1. #5911
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    I don't like animlib i have a differnt code thats easier in my opion but i need the animation to stay in one place is there differnt side sroller that can have an object stay in one place?



  2. #5912
    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

    try something like this:

    Code:
    -- this creates a table with 3 images for the animation
    -- if you want to use more than three, just continue with 4 =, 5 =, etc...
    animation = { 1 = Image.load(frame1.png), 2 = Image.load(frame2.png), 3 = Image.load(frame3.png)}
    
    -- this function draws the current frame
    function animate(animx, animy, frame)
         screen:blit(animx, animy, animation[frame])
    end
    animx and animy are the coordinates where you want the animation to appear at.if you want your animation to always appear at the same place on the screen then you could call it like this:

    Code:
    frame = frame + 1
    if frame > 3 then frame = 1
    animate(50, 50, frame)
    replace the 50, 50 with whatever coordinates it is where you want the animation to appear at, and the animation will always be at that location. Just remember that for it to be visible you'll have to place the function call after the background images.

  3. #5913
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    thanks but i already have something like that. It's my side scroller that's causeing the problem i need something a little better because this one kind of sucks

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

    hmm...

    Oh wait, I think I understand. Are you saying you want the animation to move with the background as it scrolls? Like say if you have a flag by a house in the bg and you want the flag to be waving in the wind

    for x use (backx + animx)
    for y use (backy + animy)

    this will make the animation move with the bg as it scrolls

  5. #5915
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspaquaforce
    I don't like animlib i have a differnt code thats easier in my opion but i need the animation to stay in one place is there differnt side sroller that can have an object stay in one place?
    Use animlib, You say that you have an easier way yet your having so many problems, Just download animlib and learn how to use it.

  6. #5916
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    i keep getting an error :Cry:

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

    what error?

  8. #5918
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    i can't really read it. It flashes to fast. here's the demo you can take a look because i'm really tired http://www.sendspace.com/file/dvgxx3

  9. #5919
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    I got no error while playing.
    Geändert von eyece (03-02-2007 um 06:44 PM Uhr)

  10. #5920
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Thats because i didn't post the one with the error

  11. #5921
    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

    here change your animation calls to look like this:


    Code:
    if currentFrame == 1 then --draw first frame
          screen:blit(Back3.x - 370,50,frame1)
       elseif currentFrame == 2 then --draw second frame
          screen:blit(Back3.x - 370,50,frame2)
       elseif currentFrame == 3 then --draw third frame
          screen:blit(Back3.x - 370,50,frame3)
       end
    As you can see, the rain doesn't quite match up with the clouds, but to fix that all you have to do is tinker around with how much you subtract from Back3.x.
    -= Double Post =-
    heh, I went ahead and figured it out for you, even added a few lines to double the size of the animation:

    Code:
    if currentFrame == 1 then --draw first frame
          screen:blit(Back3.x - 480,50,frame1)
          screen:blit(Back3.x - 397,50,frame2)
       elseif currentFrame == 2 then --draw second frame
          screen:blit(Back3.x - 480,50,frame2)
          screen:blit(Back3.x - 397,50,frame3)
       elseif currentFrame == 3 then --draw third frame
          screen:blit(Back3.x - 480,50,frame3)
          screen:blit(Back3.x - 397,50,frame1)
       end
    Geändert von Merick (03-02-2007 um 07:18 PM Uhr) Grund: Automerged Doublepost

  12. #5922
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    thank you so much :ROFL: :Punk: :Jump:

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

    hehe, no problem, I haven't had this much fun with a programming language in years

    and here's another way to do it:

    Code:
    for i = 536,314, -83 do
       if currentFrame == 1 then --draw first frame
             screen:blit(Back3.x - i,50,frame1)
          elseif currentFrame == 2 then --draw second frame
             screen:blit(Back3.x - i,50,frame2)
          elseif currentFrame == 3 then --draw third frame
             screen:blit(Back3.x - i,50,frame3)
            end
    end
    -= Double Post =-
    ok, I really need some help with this. First, I have my tile loader function. When my program runs through this, it appears to be loading the images like I want it to:

    Code:
    tiles = {}     -- store tile images
    tfiles = {}    -- store tile filenames
    
    -- load all images from tiles folder
    function loadtiles()
    	screen:clear()
    	screen:fontPrint(hyperion, 100, 100, "loading tiles", red)
    	screen:flip()
       screen:clear()
    	local files = System.listDirectory("./tiles")
       tiles[(table.getn(files))] = {}
    	for i = 3, table.getn(files) do
    		tiles[i-2] = Image.load("./tiles/"..files[i].name)
    		tfiles[i-2] = (files[i].name)
    		end
    	screen:fontPrint(hyperion, 100, 150, "done", blue)
    	screen:flip()
       for i = 1, 100000 do end
    	return
    end
    However, when I try to display one of the tiles like this:

    Code:
       screen:blit(xpos, ypos, tiles[currenttile])
       screen:flip()
    nothing shows up on the screen

    *edit*

    nvm,LOL

    the problem was with my algorithm to determine the xpos and ypos
    Geändert von Merick (03-03-2007 um 08:32 AM Uhr) Grund: Automerged Doublepost

  14. #5924
    Points: 3.531, Level: 37
    Level completed: 21%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    43
    Points
    3.531
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    merick what kind of game are you making?

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

    Well, right now I'm not actually making a game. What I'm working on is a program to draw game maps using graphics tiles.

  16. #5926
    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 guys, when i use math.floor, i want to round off to the nearest whole number, but it is rounding me off to the first decimal place. any solutions?

  17. #5927
    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 we see how you're using it? I just did a small test, and using math.floor(199.99) gave me the result of 199, so it's probably something to do with the way you're coding it

  18. #5928
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    function math.round(a)
    	if a-math.floor(a) >= 0.5 then
    		return math.ceil(a)
    	else
    		return math.floor(a)
    	end
    end

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

    Zitat Zitat von Merick
    can we see how you're using it? I just did a small test, and using math.floor(199.99) gave me the result of 199, so it's probably something to do with the way you're coding it
    well i have a timer, but i don't want it to show it in milliseconds, so i used:
    Code:
    gametime = math.floor((10000 - timer1:time())/10) -- it shows 10000 - time because it is supposed to be counting down
    -= Double Post =-
    actually, now that i think about it i think i put the "/ 10" after the math.floor, which would, in any case that the number was not divisible by ten, make the number a decimal again.

    and eyece, thanks for teaching me that there was a such thing as math.ceil. I understand why ceiling and floor were named what they are now lol.
    Geändert von emericaska8r (03-03-2007 um 03:27 PM Uhr) Grund: Automerged Doublepost

  20. #5930
    I love the PS3!!!
    Points: 11.447, Level: 70
    Level completed: 50%, Points required for next Level: 203
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Look behind you
    Beiträge
    1.876
    Points
    11.447
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    what does floor in math.floor stand for?
    [size=-3][color=#fefefe]11[/color][color=white]0[/color][color=#fbfbfb]1[/color][color=#f1f4f6]0[/color][color=#f2f5f8]0[/color][color=#f7f8fa]1[/color][color=#fcfcfc]0[/color][color=#fdfefd]0[/color][color=#fffffe]1[/color][color=#fefefe]1[/color][color=white]1[/color][color=#fefefe]000[/color][color=white]1[/color][color=#fefefe]0[/color][color=white]0[/color][color=#fefefe]1111011[/color][color=white]1[/color][color=#fefefe]1[/color][color=white]101[/color]
    [color=white]1[/color][color=#fffefe]0[/color][color=#cad3e0]0[/color][color=#6f7f9c]1[/color][color=#788eaf]0[/color][color=#98b7d6]0[/color][color=#99c0e1]0[/color][color=#9ac2e2]1[/color][color=#a5c6e2]1[/color][color=#a6c3e2]0[/color][color=#b2bed1]1[/color][color=#dbe2ed]0[/color][color=#f7f9fa]1[/color][color=#fefefd]10110[/color][color=#fefefe]01[/color][color=#fefefd]0[/color][color=#fefefe]1[/color][color=#fefefd]10[/color][color=#fefefe]1[/color][color=white]00100[/color]
    [color=#fefefe]0[/color][color=#f2f6f8]0[/color][color=#566da3]0[/color][color=#8a919d]1[/color][color=#e2e5e4]0[/color][color=#eff2f3]0[/color][color=#eef2f6]1[/color][color=#e8eef3]1[/color][color=#dfe6ee]1[/color][color=#d1dee8]0[/color][color=#c1cddd]1[/color][color=#7997ce]1[/color][color=#8ea4d1]1[/color][color=#ebeeee]0[/color][color=#fdfef9]0[/color][color=#fefffa]1[/color][color=#fefefc]01101011[/color][color=#fefefd]1[/color][color=#fefefe]00[/color][color=white]10[/color][color=#fefefe]1[/color]
    [color=#fefefe]1[/color][color=#dde3ef]0[/color][color=#4866a7]1[/color][color=#b3bbc6]0[/color][color=#fafbf7]1[/color][color=#fefefc]0[/color][color=#f6f7f9]0[/color][color=#a8b6cf]1[/color][color=#6a7c9b]0[/color][color=#6886b2]0[/color][color=#7697c8]0[/color][color=#85a3cd]1[/color][color=#6287c3]1[/color][color=#496eb6]1[/color][color=#98abce]0[/color][color=#dde5e5]1[/color][color=#fcfef4]0[/color][color=#fdfef7]1[/color][color=#fefffa]100[/color][color=#fefefb]00[/color][color=#fefefc]00[/color][color=#fefefd]1[/color][color=#fefefe]1[/color][color=white]0[/color][color=#fefefe]0[/color][color=white]1[/color]
    [color=#fefefd]0[/color][color=#f8fafa]0[/color][color=#a7bce4]1[/color][color=#6887cf]0[/color][color=#9eb0d3]1[/color][color=#e3e9ec]1[/color][color=#bbc4d6]0[/color][color=#405b99]1[/color][color=#848b97]0[/color][color=#c2cace]0[/color][color=#c2cdd7]1[/color][color=#bdcce0]0[/color][color=#94acd4]1[/color][color=#547dc3]1[/color][color=#385ea9]1[/color][color=#496eb1]1[/color][color=#90a7c7]1[/color][color=#dde4e4]1[/color][color=#f6f9ee]1[/color][color=#fcfef3]1[/color][color=#fdfff5]1[/color][color=#fdfef7]1[/color][color=#fdfef8]0[/color][color=#fdfef9]1[/color][color=#fefefa]1[/color][color=#fefffb]1[/color][color=#fefefb]0[/color][color=#fefefc]1[/color][color=#fefefe]11[/color]
    [color=#fefefc]01[/color][color=#fcfdfc]0[/color][color=#e6ecf7]0[/color][color=#9fb5e7]0[/color][color=#6889cf]0[/color][color=#6b86c0]1[/color][color=#415ba1]0[/color][color=#6c82b0]0[/color][color=#d4d9da]0[/color][color=#f4f6ec]0[/color][color=#f8faf1]1[/color][color=#f5f8f3]0[/color][color=#e0e7ec]1[/color][color=#a0b7d8]1[/color][color=#5e82c2]0[/color][color=#2e5fb4]0[/color][color=#4065b0]1[/color][color=#809cc5]1[/color][color=#cdd7d9]1[/color][color=#f7f9e9]0[/color][color=#fafcef]1[/color][color=#fcfef2]1[/color][color=#fdfef5]1[/color][color=#fdfef6]1[/color][color=#fdfef9]0[/color][color=#fefff9]1[/color][color=#fefffa]1[/color][color=#fefefc]10[/color]
    [color=#fefefc]1100[/color][color=#fbfcfc]1[/color][color=#e8eff7]1[/color][color=#a5b8e6]1[/color][color=#5a7cc9]1[/color][color=#3a589d]0[/color][color=#3c5ba2]1[/color][color=#8d9fc1]1[/color][color=#d8deda]0[/color][color=#f4f7e8]0[/color][color=#f5f8ec]1[/color][color=#f1f5ea]0[/color][color=#dee5e4]1[/color][color=#b1c2d5]0[/color][color=#6b8dc7]1[/color][color=#416dba]1[/color][color=#3965b2]0[/color][color=#6c88b8]1[/color][color=#b5c3cd]0[/color][color=#e4e8df]1[/color][color=#f7f8e8]0[/color][color=#fbfdef]1[/color][color=#fcfef4]0[/color][color=#fdfff7]1[/color][color=#fefffa]0[/color][color=#fefefb]0[/color][color=#fefefc]1[/color]
    [color=#fefffb]1[/color][color=#fefefb]1[/color][color=#fefefc]0[/color][color=#fefffb]10[/color][color=#fdfefa]1[/color][color=#f9fbf9]0[/color][color=#dce4f1]1[/color][color=#94aada]1[/color][color=#4567b4]0[/color][color=#2c509f]0[/color][color=#4c6bac]0[/color][color=#a0adc3]1[/color][color=#e3e6db]0[/color][color=#f0f2e2]1[/color][color=#f0f3e4]0[/color][color=#ecf0e3]0[/color][color=#dde1dd]0[/color][color=#b1bfd1]0[/color][color=#7893bf]0[/color][color=#416fb7]0[/color][color=#3c66ad]0[/color][color=#6181b8]1[/color][color=#a3b2c8]1[/color][color=#dfe4de]1[/color][color=#f1f3e6]0[/color][color=#fafbf0]0[/color][color=#fcfdf6]1[/color][color=#fdfff8]1[/color][color=#fefffa]0[/color]
    [color=#fefffa]10[/color][color=#fefefa]1[/color][color=#fefffa]1[/color][color=#fefff9]11[/color][color=#fdfef8]1[/color][color=#fcfdf4]0[/color][color=#f5f7f3]0[/color][color=#d6dee9]1[/color][color=#809ad5]0[/color][color=#3a5cad]1[/color][color=#264a9f]1[/color][color=#4e6aad]1[/color][color=#a8b3c5]1[/color][color=#e2e4d5]1[/color][color=#ebecda]1[/color][color=#edeee0]0[/color][color=#e9ebde]0[/color][color=#dee1db]1[/color][color=#bfc7cd]1[/color][color=#869ec2]1[/color][color=#5479ba]1[/color][color=#3665b4]1[/color][color=#466aaf]0[/color][color=#7f95b9]1[/color][color=#c5ccd0]1[/color][color=#f2f3e6]0[/color][color=#f9faef]1[/color][color=#fcfef4]0[/color]
    [color=#fdfef7]10110[/color][color=#fdfef5]1[/color][color=#fdfdf2]1[/color][color=#fbfdf1]0[/color][color=#fbfcf0]0[/color][color=#f6f8ec]0[/color][color=#eaece8]0[/color][color=#c0cbdc]1[/color][color=#6e88c5]1[/color][color=#3657ab]0[/color][color=#2d4ea1]1[/color][color=#5b73ac]1[/color][color=#b1b9c1]1[/color][color=#dbdccf]0[/color][color=#e5e6d4]0[/color][color=#e6e7d7]0[/color][color=#e4e5da]0[/color][color=#d9ddd5]1[/color][color=#c1caca]0[/color][color=#99a9be]1[/color][color=#6584b9]1[/color][color=#4369b1]0[/color][color=#3f5fa1]0[/color][color=#7586a6]0[/color][color=#dcddd0]1[/color][color=#f4f4e7]1[/color]
    [color=#fcfdf1]01[/color][color=#fcfcf0]1[/color][color=#fcfcef]1[/color][color=#fcfcf0]1[/color][color=#fcfcef]0[/color][color=#fbfced]0[/color][color=#f9fbeb]1[/color][color=#f9faea]1[/color][color=#f7f8e7]0[/color][color=#f3f4e6]1[/color][color=#eeeee2]1[/color][color=#dbdfdb]0[/color][color=#a4b1ca]1[/color][color=#5670b4]1[/color][color=#284ca4]1[/color][color=#2e4e9a]0[/color][color=#6d80aa]1[/color][color=#bcc0bb]0[/color][color=#d9dbc9]1[/color][color=#dfe0ce]0[/color][color=#e2e3d2]0[/color][color=#dfe1d2]1[/color][color=#d7dbd0]1[/color][color=#c4cbc9]1[/color][color=#96a2b6]0[/color][color=#3c558e]0[/color][color=#56637f]0[/color][color=#d0d2c2]0[/color][color=#eae9db]0[/color]
    [color=#fafbec]1[/color][color=#f9faea]1000[/color][color=#f8f8e8]0[/color][color=#f7f7e6]1[/color][color=#f5f7e5]0[/color][color=#f5f5e3]0[/color][color=#f3f3e1]1[/color][color=#f1f1dd]0[/color][color=#eeeedc]0[/color][color=#ececda]0[/color][color=#e3e4d4]0[/color][color=#ced0c9]0[/color][color=#8e9db9]1[/color][color=#4766ac]0[/color][color=#234799]0[/color][color=#2e4c96]0[/color][color=#727d93]1[/color][color=#c1c2b1]0[/color][color=#d0d2c0]0[/color][color=#c1c6c1]1[/color][color=#9ba3b1]0[/color][color=#677591]0[/color][color=#415179]1[/color][color=#515d75]1[/color][color=#9fa29b]0[/color][color=#dbdacc]0[/color][color=#eceadb]0[/color]
    [color=#f6f5e5]10[/color][color=#f5f4e4]1[/color][color=#f5f5e3]01[/color][color=#f3f3e1]0[/color][color=#f3f2de]1[/color][color=#f2f1e0]0[/color][color=#f0efdc]0[/color][color=#efeed9]0[/color][color=#edecd8]0[/color][color=#ebebd6]1[/color][color=#e8e8d2]1[/color][color=#e3e2cd]0[/color][color=#e0dfcb]1[/color][color=#d6d6c6]1[/color][color=#b7bcbf]0[/color][color=#7a8cb0]1[/color][color=#4564a7]0[/color][color=#354d81]1[/color][color=#616b7f]0[/color][color=#57657f]1[/color][color=#445371]1[/color][color=#4f586b]1[/color][color=#6f7478]0[/color][color=#999b93]0[/color][color=#bdbeb0]1[/color][color=#d7d6c6]0[/color][color=#e5e3d3]1[/color][color=#eae9d8]0[/color]
    [color=#f1f0dd]0[/color][color=#f1efdc]0[/color][color=#f1f0e0]1[/color][color=#f0efdc]0[/color][color=#f0f0db]1[/color][color=#f0efd9]1[/color][color=#eeedd8]1[/color][color=#ededd7]1[/color][color=#ebebd4]0[/color][color=#eae9d3]0[/color][color=#e8e7d2]1[/color][color=#e6e6cf]0[/color][color=#e4e4cc]1[/color][color=#e2e2ca]1[/color][color=#e0dfca]0[/color][color=#dddcc6]0[/color][color=#d7d8c3]0[/color][color=#cdcfbd]1[/color][color=#adb1ac]1[/color][color=#868f95]1[/color][color=#777e7f]1[/color][color=#82867f]1[/color][color=#9d9e8f]1[/color][color=#b7b6a2]0[/color][color=#c6c6b0]1[/color][color=#d0d0ba]1[/color][color=#d7d6c3]0[/color][color=#dddcc9]0[/color][color=#e2e1ce]1[/color][color=#e5e4d1]0
    [/color][/size]
    [SIZE=1]a paper clip made by thekon[/SIZE]

  21. #5931
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    what does floor in math.floor stand for?
    it drops a decimal number to the last (next lowest) whole number.
    http://lua-users.org/wiki/MathLibraryTutorial

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

    arrg, I'm really not getting tables. I'm trying to create a table for a map grid, where I can set point x,y in the grid as number like so:

    map point x,y = number of the tile to be displayed

    no matter how I try to set it up, I keep getting errors like "attempt to index field '?' (a nil value)" or "table index is nil"

  23. #5933
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    i assume you loop through the table when processing tiles? if so, make sure your loop starts at 1.

    otherwise show me some code.

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

    Code:
    a = {}
    
    for i= 1, 10 do
       for j = 1, 10 do
          count = count +1
         a[i,j] = count -- right here i get this: ']' expected near ','
       end
    end
    
    --
    
    a = {}
    
    for i= 1, 10 do
       for j = 1, 10 do
          count = count +1
         a[i],[j] = count  -- unexpected symbol near '['
       end
    end
    
    --
    
    a = {}
    
    for i= 1, 10 do
       for j = 1, 10 do
          count = count +1
         a[i][j] = count --attempt to index field '?' (a nil value)
       end
    end
    
    --
    b = {}
    a[b] = {} --attempt to index field '?' (a nil value)
    
    for i= 1, 10 do
       for j = 1, 10 do
          count = count +1
         a[i].j  = count
       end
    end
    -= Double Post =-
    It's been a long time and my memory is kinda fuzzy, but i remember it being much easier do to this kind of thins in quickbasic
    -= Double Post =-
    I just want something that will let me declare a table as a matrix array with xsize number of columns and ysize number of rows, then will let me say that point x,y is equal to some number
    -= Double Post =-
    .

    why does this always happen to me? I struggle for hours to figure something out, but I come up with an answer only after I post a question about it:

    Code:
    a = {}
    
    for i= 1, 10 do
       a[i] = {}
       for j = 1, 10 do
          count = count +1
         a[i][j]  = count
       end
    end
    Geändert von Merick (03-03-2007 um 04:42 PM Uhr) Grund: Automerged Doublepost

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

    i'm not sure how to make a table into an array as you are talking about, but you could always use seperate tables like:
    Code:
    row1 = {}
    row2 = {}
    row3 = {}
    row4 = {}
    row5 = {}
    for i = 1, 5 do
    row1[i] = i
    row2[i] = i
    row3[i] = i
    row4[i] = i
    row5[i] = i
    end

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

    lol, look in my last double post merge post above, I have found the answer I was looking for

    Code:
    a = {}
    
    for i= 1, x do
       a[i] = {}
       for j = 1, y do
          a[i][j] ={}
       end
    end
    this bit of code creates a matrix array of x columns by y rows. Since I'm not assigning any values here, all points are = nil, but once this bit of code has run, you can access any point in the matrix with: a[xpos][ypos]

  27. #5937
    QJ Gamer Blue
    Points: 4.241, Level: 41
    Level completed: 46%, Points required for next Level: 109
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Alabama
    Beiträge
    142
    Points
    4.241
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Could someone give me examples/tell me how to use these functions?

    Gu.light, Gu.lightAtt, Gu.lightColor, Gu.lightMode, Gu.lightSpot

    I don't even know where to begin. I just started 3D, and I can at least tinker (poorly) with all the other functions, but the best I get from these is an error.
    Geändert von Aphonia (03-03-2007 um 10:06 PM Uhr)

  28. #5938
    QJ Gamer Blue
    Points: 5.034, Level: 45
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    243
    Points
    5.034
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    aphonia, i just took a crack at Gu.light, i got nothing also, so i had a look at the function to see how many arguments it did need, 6 apparently. 1st one looks to be an id i don't know what the next 2 do, but then the other 3 should be the xyz of the light:
    Code:
    static int lua_sceGuLight(lua_State *L) {
    	int argc = lua_gettop(L); 
    	if (argc != 6) return luaL_error(L, "wrong number of arguments");
    	ScePspFVector3 v;
    	v.x = luaL_checknumber(L, 4);
    	v.y = luaL_checknumber(L, 5);
    	v.z = luaL_checknumber(L, 6);
    	sceGuLight(luaL_checkint(L, 1), luaL_checkint(L, 2), luaL_checkint(L, 3), &v);
    	return 0;
    }
    but, i have tried and failed maybe my source is different for some reason, could someone enlighten me please :P

    EDIT:
    lol, my bad the num of arguments error was coming from line 136, not the line 146 with Gu.light, so i just spent 15 minutes trying to fix something that wasn't broken, it'll try again. - ignore the last part of my post :P
    Geändert von eyece (03-04-2007 um 02:36 AM Uhr)

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

    Zitat Zitat von Merick
    lol, look in my last double post merge post above, I have found the answer I was looking for
    lol, i didn't see it

  30. #5940
    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 anyone point me to some code that can rotate an image?


 

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 07:52 AM Uhr.

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