Seite 18 von 342 ErsteErste ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 68 118 ... LetzteLetzte
Zeige Ergebnis 511 bis 540 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; no prob. im glad it worked! And i just made a really hard version of my crappy game. Now the ...

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

    no prob. im glad it worked!

    And i just made a really hard version of my crappy game. Now the target moves randomly with a random speed, haha. This is very difficult, but also pretty fun. I'll just post it here so everybody can learn from the code, or have a little fun, lol.

    Later Altair


    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  2. #512
    QJ Gamer Bronze
    Points: 5.975, Level: 50
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Alabama
    Beiträge
    272
    Points
    5.975
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    If you use random numbers be sure to seed it, or you will get the exact same numbers every time you run your program... one good way to seed is put this at the top of your program somewhere

    Code:
    math.randomseed(os.time())
    My lua tutorials for PSP - www.evilmana.com/tutorials
    PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/

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

    Yeah read something about that. But it's not true with my 'game'. It's not showing any repetition as far as i can see. Everytime i restart it, the movement is different and its really hard to anticipate it.
    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. #514
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Can Someone tell me whats wrong with this:
    --Garage PSP Menu Test
    --By Vaza

    --Loading Images
    Navtop = Image.load("bartop.png")
    BG = Image.load("bg.png")
    Car1 = Image.load("car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("car2.png")

    --Variables
    carnumber = 1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber = carnumber - 1
    end
    if pad:right() then
    carnumber = carnumber + 1
    end
    if carnumber = 3 then
    carnumber = carnumber - 2
    end
    if carnumber = 1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber = 2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end

  5. #515
    100% Pure Awesome
    Points: 6.164, Level: 51
    Level completed: 7%, Points required for next Level: 186
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    508
    Points
    6.164
    Level
    51
    Downloads
    0
    Uploads
    0

    Standard

    Well, I have sifted through the forums and found nothing on overclocking the psp using lua. Well, there is a function using c to overclock the psp and I was just wondering if there was a similar function for lua.

    -Thanks for the answer.

  6. #516
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Vaza
    Can Someone tell me whats wrong with this:
    --Garage PSP Menu Test
    --By Vaza

    --Loading Images
    Navtop = Image.load("bartop.png")
    BG = Image.load("bg.png")
    Car1 = Image.load("car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("car2.png")

    --Variables
    carnumber = 1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber = carnumber - 1
    end
    if pad:right() then
    carnumber = carnumber + 1
    end
    if carnumber = 3 then
    carnumber = carnumber - 2
    end
    if carnumber = 1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber = 2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end
    Navtop = Image.load("Themes/Bar.png")
    BG = Image.load("BGs/BG.png")
    Car1 = Image.load("Carsq/car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("Carsq/car_1.png")

    --Variables
    carnumber=1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber = carnumber - 1
    end
    if pad:right() then
    carnumber = carnumber + 1
    end
    if carnumber == 3 then
    carnumber = carnumber - 2
    end
    if carnumber == 1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber == 2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end

    All Done I Guess i shouldve tweeked it for you
    but i cant at the moment
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  7. #517
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von c5cha7
    Navtop = Image.load("Themes/Bar.png")
    BG = Image.load("BGs/BG.png")
    Car1 = Image.load("Carsq/car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("Carsq/car_1.png")

    --Variables
    carnumber=1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber = carnumber - 1
    end
    if pad:right() then
    carnumber = carnumber + 1
    end
    if carnumber == 3 then
    carnumber = carnumber - 2
    end
    if carnumber == 1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber == 2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end

    All Done I Guess i shouldve tweeked it for you
    but i cant at the moment
    thx mate.

  8. #518
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Vaza
    thx mate.
    K, After all i did say when i had the
    time i would help :) . But at the moment i am
    learning C+ so i might not be at much help .

    Anyway good luck :Jump:
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  9. #519
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    i get the error then expected near = on luaplayer windows

  10. #520
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    ok after taking a little break from coding but now im back at it working on the pole creation part but i haver a problem(again)

    Code:
    if np==0 and rc==0 and math.random(0, 1)==0 then screen:blit(x1-ps, y1, Obj) y1=200 rc=0 np=1 else end 
    if np==0 and rc==0 and math.random(0, 1)==1 then screen:blit(x1-ps, y1, Obj) y1=178 rc=0 np=1 else end
    everything in the if part is good but the poles dont create

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

    Zitat Zitat von Vaza
    Can Someone tell me whats wrong with this:
    --Garage PSP Menu Test
    --By Vaza

    --Loading Images
    Navtop = Image.load("bartop.png")
    BG = Image.load("bg.png")
    Car1 = Image.load("car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("car2.png")

    --Variables
    carnumber = 1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber = carnumber - 1
    end
    if pad:right() then
    carnumber = carnumber + 1
    end
    if carnumber = 3 then
    carnumber = carnumber - 2
    end
    if carnumber = 1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber = 2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end
    lol, I wonder what game your making?

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


  12. #522
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    lol, I wonder what game your making?
    yer, im making garages menu system, so im a coder and the creator, can somebody please tell me what the code is to put in the time?

  13. #523
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Vaza
    i get the error then expected near = on luaplayer windows
    Try this code then :icon_wink

    Navtop = Image.load("Themes/Bar.png")
    BG = Image.load("BGs/BG.png")
    Car1 = Image.load("Carsq/car1.png")
    Comingsoon = Image.load("Comingsoon.pn g")
    Car2 = Image.load("Carsq/car_1.png")

    --Variables
    carnumber=1

    --Read Control Input
    pad = Controls.read()

    --Main loop
    while true do
    screen:blit(0, 0, BG, false)
    screen:blit(0, 0, Navtop)
    screen.flip()
    if pad:left() then
    carnumber=carnumber - 1
    end
    if pad:right() then
    carnumber=carnumber + 1
    end
    if carnumber==3 then
    carnumber=carnumber - 2
    end
    if carnumber==1 then
    screen:blit(336, 8, Car1)
    end
    if carnumber==2 then
    screen:blit(336, 8, Car2)
    end
    if pad:cross() then
    screen:blit(0, 0, Comingsoon)
    end
    end

    That might work :mrgreen: .
    And about the clock function, i think you can find it here
    http://wiki.ps2dev.org/psp:lua_player:functions
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  14. #524
    Points: 4.338, Level: 41
    Level completed: 94%, Points required for next Level: 12
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    46
    Points
    4.338
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    wow crazy thread, so much info in one place

    ok I have this working

    red = Color.new(255, 0, 0)

    dot = Image.load("DATA/dot.png")
    bgC = Image.load("DATA/bg col2.png")

    x0 = 0 ; y0 = 0 ; x1 = 0 ; y1 = 0
    while true do

    screen:clear()
    pad = Controls.read()

    dx = pad:analogX()
    if math.abs(dx) > 32 then
    x0 = x0 + dx / 64
    end
    dy = pad:analogY()
    if math.abs(dy) > 32 then
    y0 = y0 + dy / 64
    end

    if bgCixel(x1, y1) == red then

    x1 = x1 ; y1 = y1 else
    x1 = x0 ; y1 = y0

    end

    screen:blit(0, 0, bgC)
    screen:blit(x1, y1, dot)
    screen.waitVblankStart()
    screen.flip()

    if pad:start() then break end

    end
    But what i want is instead of having my dot stop totaly when it hits a red pixel, I want it to be block by the red pixels and be able to continu around it
    anybody as an idea how I could do this?

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

    First of all, what happens is that if a pixel is red, then x1 is always x1. The same goes for y1. So it will never move again unless you code it differently.

    Secondly, how do you want it to continue around it? Like 'feel' the edges and then move along them?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  16. #526
    Points: 4.338, Level: 41
    Level completed: 94%, Points required for next Level: 12
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    46
    Points
    4.338
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    First of all, what happens is that if a pixel is red, then x1 is always x1. The same goes for y1. So it will never move again unless you code it differently.

    Secondly, how do you want it to continue around it? Like 'feel' the edges and then move along them?

    Exactly what you just discribed, I change my x1, y1 to x0 and y0 when checking the pixel color, and now it continues doesn't get stock, but it kind of teleport the other side of the zone like it was doing the movement and then when it's not on red pixels appears at that position, I'm new at lua and programming so it doesn't always to clear to me

    but what you discribe is what I wanna do feel the edge (been looking for those words)
    Geändert von arlutik (02-19-2006 um 06:18 PM Uhr)

  17. #527
    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 to make it stop moving and also stay on that place (the x and y coordinates) you just say that if the pixel is red, the x and y coordinates stay thesame.
    The feeling is a little harder. The thing you have to do is check if the pixels around it are also red. So something like:
    Code:
     if x1 + 1 == red then ...
    If you want it to go the shortest route, then i don't know how to do that. Maybe you can implement a learning thing?
    I hope this is clear enough. Its hard to explain in short. I don't want to just give you the code :P, besides i haven't tried the feeling part myself, but i can imagine.

    Altair
    Geändert von Altair (02-20-2006 um 11:46 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]

  18. #528
    Points: 4.338, Level: 41
    Level completed: 94%, Points required for next Level: 12
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    46
    Points
    4.338
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    thanx mate, I'm sure it's gona help alote

    thanx for not giving me the code otherwise I wouldn't learn, Lua is all bout undestanding what is going on

    thanx again, I love lua

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

    yeah i like it too. And i also like to help other LUA coders (well those are the only coders i can help i guess, unless its HTML or JavaScript).
    If something is unclear or you want to know something else i'll try to help you out. Good luck with it!
    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. #530
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Right now im making a game based on a mini game from an older xbox game(this is gona be 2-d of coarse) but i ran into a problem with a random pole generator. im going to use laurin's collision detection so i dont need a variable for each pole but thats where i run into the problem. i want the speed the pipes are moving to be subtracted from the x value(making it move left) but i dont want to have to predefine all the x values for every pipe. i was wondering how i would do this? so basicly i would have the y value all preset but i just need to have the x value keep subtracting another variable.

  21. #531
    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

    im sorry but i dont think i understand you completely.
    The pole generator you're talking about, is that pole as in pole-coordinates, or as in just a pole (a stick)? And what exactly is your problem with it?
    And for the moving left of the pipes: do you mean that you want to use one variable for the speed for all the pipes? Maybe you can use a table. See the LUA wiki tutorial for that, or PSPMillionare's tutorial on tables. If all the pipes are move the same and at the same time, then you can just use one variable.

    I hope i understood you correctly, othwerwise you have to explain it a little better, maybe then i can help.

    Altair
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  22. #532
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    the poles are sticks(actualy a circle cause its looking from a side). they are all going to be moving at the same speed but when one reaches the left screen im gona move it back to the right side. im going to have it pick a random number to determin if its a higher pole or a lower pole(hieght wise). the problem is their going to be at different x positions. I want it to subtract the speed from its own x variable without having to creat a whole new variable for each.

    heres a little drawing to help show what the poles are gojng to be
    + is a pole = is a space

    ===+=====+==+====+====+
    =+====+=======+====+===

    so i want to make somthing that randomly picks if its on top or bottom

  23. #533
    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

    Then you have to go with a table i think. Th ething is i almost know all the commands i think (i went through the list a couple of times to search for the ones i needed), but i haven't used them all. I know tables are really handy though.
    I think you should do something like this.
    Make a table where all the x variables of all the poles are in say "xvar". Then you can just say "xvar = xvar - xspeed".
    So that would make:
    Code:
     xvar = {}
    while n<10 do
    xvar[n] = math.random(0,100)
    n=n+1
    end
    this is for 10 poles and i create random x-coordinates for them. If you want them to have fixed x-coordinates then you can do that ofcourse.
    To make them all move the same, you can use:
    Code:
     xvar = xvar - xspeed
    where xspeed is the speed (duh!).

    Im not sure if you can just say xvar - 1 though. Just try it and see if it works. If it works then the rest should be easy.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  24. #534
    QJ Gamer Blue
    Points: 5.016, Level: 45
    Level completed: 33%, Points required for next Level: 134
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    108
    Points
    5.016
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    What is the code for the port for the headphone extension?

  25. #535
    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 that one i dont know :P. Hmm im not sure if thats possible through LUA, i dont think so. I dont know of anyone who has used it in a LUA app.
    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. #536
    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

    BTW Is your game gonna be some sort of Frogger?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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

  27. #537
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    its from a game called fusion frenzy. it was a game full of mini games for the xbox early on in its life. also thanks for the help. ill try this out when i get back from school.

  28. #538
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    			if pad:square()  then  			dir.ax = -3  			state = Fight_l[W_FRAME]  			W_TIMER = W_FRAME + 1  			if W_TIMER == 0  then  			end  			If W_FRAME = 0 then  			W_TIMER -1  			end  			lastdir = "left"  			  			end  		end
    basically im trying to make it say something like if you punch once then extend the timer 1 to give the user some time to make another combo (by pressing square again) i might expand on this by making it like if you are to a certain point then you have to stop (to make it so you dont have unlimted combo) and make your character unable to move for a while.
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  29. #539
    Psp Dev
    Points: 5.664, Level: 48
    Level completed: 57%, Points required for next Level: 86
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Nebraska
    Beiträge
    228
    Points
    5.664
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard Lua help

    Code:
     
                    --Movement
              	if pad:up() and pad:up() ~= oldpad:up() then
                   		XLMove = 0
                   		YLMove = -1
    			timer = 0
    			LastSet = 1
    			if position == 3 then gameover() end
    			position = 4
    
              	end
    
              	if pad:down() and pad:down() ~= oldpad:down() then
                   		XLMove = 0
                   		YLMove = 1
    			timer = 0
    			LastSet = 2
    			if position == 4 then gameover() end
    			position = 3
              	end
    
              	if pad:right() and pad:right() ~= oldpad:right() then
                   		XLMove = 1
                   		YLMove = 0
    			timer = 0
    			LastSet = 3
    			if position == 1 then gameover() end
    			position = 2
              	end
    
              	if pad:left() and pad:left() ~= oldpad:left() then
                   		XLMove = -1
                   		YLMove = 0
    			timer = 0
    			LastSet = 4
    			if position == 2 then gameover() end
    			position = 1
              	end
    
              	if pad:triangle() and pad:triangle() ~= oldpad:triangle() then
                   		XRMove = 0
                   		YRMove = -1
    			timer2 = 0
    			LastSet = 5
    			if position2 == 7 then gameover() end
    			position2 = 8
              	end
    
              	if pad:cross() and pad:cross() ~= oldpad:cross() then
                   		XRMove = 0
                   		YRMove = 1
    			timer2 = 0
    			LastSet = 6
    			if position2 == 8 then gameover() end
    			position2 = 7
              	end
    
              	if pad:circle() and pad:circle() ~= oldpad:circle() then
                   		XRMove = 1
                   		YRMove = 0
    			timer2 = 0
    			LastSet = 7
    			if position2 == 5 then gameover() end
    			position2 = 6
              	end
    
              	if pad:square() and pad:square() ~= oldpad:square() then
                   		XRMove = -1
                   		YRMove = 0
    			timer2 = 0
    			LastSet = 8
    			if position2 == 6 then gameover() end
    			position2 = 5
              	end
    
    
    
    
    
    
                    -- UPDATE --
    
    		RightX = RightX + XRMove + XRMove + Interval
    		RightY = RightY + YRMove + YRMove + Interval
                    PixelRX = RightX
    		PixelRY = RightY
    		LeftX = LeftX + XLMove + XLMove + Interval
    		LeftY = LeftY + YLMove + YLMove + Interval
    		PixelLX = LeftX
    		PixelLY = LeftY
    		Score = Score + 1 + Interval
    		
    		if RightX > 468 or RightY > 260 or RightX < 0 or RightY < 0 then
    		LastSet = 13
    		gameover()
                    end
                    
    
    		if LeftX > 468 or LeftY > 260 or LeftX < 0 or LeftY < 0 then
    		LastSet = 10
    		gameover()
                    end
    		
    		gamebackground:fillRect(PixelRX + 1, PixelRY + 1, 9, 9, red)
    		gamebackground:fillRect(PixelLX + 1, PixelLY + 1, 9, 9, blue)
                    Color1 = gamebackground:pixel(PixelRX , PixelRY)
    		Color2 = gamebackground:pixel(PixelRX+11, PixelRY)
    		Color3 = gamebackground:pixel(PixelRX, PixelRY+11)
    		Color4 = gamebackground:pixel(PixelRX+11, PixelRY+11)
                    Color5 = gamebackground:pixel(PixelLX, PixelLY)
    		Color6 = gamebackground:pixel(PixelLX+11, PixelLY)
    		Color7 = gamebackground:pixel(PixelLX, PixelLY+11)
    		Color8 = gamebackground:pixel(PixelLX+11, PixelLY+11)
    
                    timer2 = timer2 + 0.1	-- create a delay
    		if timer2 >= 0.7 then
    			if Color5 == red or Color5 == blue or Color6 == red or Color6 == blue or Color7 == red or Color7 == blue or Color8 == red or Color8 == blue then
    			          LastSet = 9
                    		gameover()
                    	end
    		end
    
    
                       timer = timer + 0.1	-- create a delay
    		if timer >= 0.7 then
    			if Color1 == red or Color1 == blue or Color2 == red or Color2 == blue or Color3 == red or Color3 == blue or Color4 == red or Color4 == blue then
    			LastSet = 12
                    		gameover()
                    	end
    		end

    It works but when you change direction it goes to gameover. I cant figure it out.

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

    MikePiP, one thing thats wrong in your code is this:
    Code:
    if pad:up() and pad:up() ~= oldpad:up() then
    it has to be
    Code:
    if pad:up() and pad ~= oldpad then
    where you store pad in oldpad at the end of the loop, like this
    Code:
    oldpad=pad
    Maybe there are other things wrong but thats the most obvious one. Try and see if it works now.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

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


 
Seite 18 von 342 ErsteErste ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 68 118 ... LetzteLetzte

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

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