Seite 182 von 342 ErsteErste ... 82 132 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 232 282 ... LetzteLetzte
Zeige Ergebnis 5.431 bis 5.460 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; Code: if timer:time() > 0 < 1000 then x = x - 1 end should be: Code: if timer:time() > ...

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

    Code:
    if timer:time() > 0 < 1000 then
    x = x - 1
    end
    should be:

    Code:
    if timer:time() > 0 and timer:time() < 1000 then
    x = x - 1
    end


    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  2. #5432
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    hmm its still doesnt make that effect -_- never mind and thx

  3. #5433
    QJ Gamer Silver
    Points: 7.371, Level: 57
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    貴方
    Beiträge
    1.159
    Points
    7.371
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    could someone show me an example of moving an object halfway across the screen from left to right
    all your help is much appreciated
    thanks

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

    Like as we control it or it justs moves on its own?

  5. #5435
    QJ Gamer Silver
    Points: 7.371, Level: 57
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    貴方
    Beiträge
    1.159
    Points
    7.371
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    on its own

  6. #5436
    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 HeaD ShOt
    on its own
    um...a simple example is:

    Code:
    while true do
    if object.x < destination.x and object.status == hasnt_reached_destination_yet then
    object.x = object.x + 1
    elseif object.x >= destination.x or object.status ~= hasnt_reached_destination_yet then
    object.x = object.x - 1
    object.status = destination_reached
    end
    end
    is it understandable?
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  7. #5437
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    xtreme - I posted an example that uses a timer, and does just waht you want. Timers arent confusing either, just think logically....
    I just started and im only in the ninth grade, but i am looking to become a programer so if figured i my as well start trying, so well that's gone

  8. #5438
    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 xtreme0915
    I just started and im only in the ninth grade, but i am looking to become a programer so if figured i my as well start trying, so well that's gone
    lol
    ninth grade isnt very special around these parts. there are some amazing youngsters out there...(not me, i wish )
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

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

    xtreme - Im in 9th gradetoo, so thats no excuse. If I can handle the simple logicallness that is 'a timer' I think you can too...

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

    It doesn't matter what grade your in.

  11. #5441
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    wow, that hurts, lol, looks like i got some research ahead of me

  12. #5442
    Asleep...
    Points: 11.516, Level: 70
    Level completed: 67%, Points required for next Level: 134
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    1.383
    Points
    11.516
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    im in 9th grade >_>...
    i need help..
    how would you be able to check if a file was there, and if it is, return as eighter true or false? (if possible, i think it is)

  13. #5443
    QJ Gamer Silver
    Points: 7.371, Level: 57
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    貴方
    Beiträge
    1.159
    Points
    7.371
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    only...

    btw
    there is a sample script for this at Evilmana

  14. #5444
    Asleep...
    Points: 11.516, Level: 70
    Level completed: 67%, Points required for next Level: 134
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    1.383
    Points
    11.516
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HeaD_ShOt
    only...

    btw
    there is a sample script for this at Evilmana
    for timers or checking if a file is there?

  15. #5445
    QJ Gamer Silver
    Points: 7.371, Level: 57
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    貴方
    Beiträge
    1.159
    Points
    7.371
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    timers
    Zitat Zitat von codebase at evilmana
    -- EVILMANA.COM PSP LUA CODEBASE
    -- www.evilmana.com/tutorials/codebase
    -- Game Timer
    -- SUBMITTED BY: dtodabreezy
    red=Color.new(255,0,0)
    black=Color.new(0,0,0)

    --i like this font becuz it dosent get in the way

    proportional = Font.createProportional()
    proportional:setPixelSize s(0,25)


    --time for game
    gametimer=Timer.new()
    time=60
    gametimer:start()



    while true do
    --gets time
    gamestime=gametimer:time( )
    -- take this out to use in game
    screen:clear(black)

    --tells it count down 1 second every second
    if gamestime>1000 then time=time - 1 gametimer:reset(0) gametimer:start()
    end

    screen:fontPrint(proporti onal, 220, 25, time, red)
    link

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

    yauster - I know, but I was porting it, and was hoping to gainevery aspect of the PC version. But, seeing theactual mechanics of a particle engine such as this, Im going to write my own. That way, I learn something :)

    I have all evening to do it, so hopefully you could look over my code later on for optimization tricks :o Also, Ill be making it visually better, as in using either small textured quads OR simply pixels (ill need alot of particles if i use pixels). (im trying to say i understand the mechanics of atleast one type of particle engine and now i believe ican write my own)...

    itll probably look the same as some others in many aspects, but honestly, itll be my own, whether or not you believe me doesnt matter to me too much...

    *starts individual particle structure*
    -= Double Post =-
    Im confused on the question being asked but...

    Code:
    if io.open("file.extension","r") then
    --file exists
    else
    --file doesnt exist
    end
    Geändert von SG57 (01-30-2007 um 04:36 PM Uhr) Grund: Automerged Doublepost

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


  17. #5447
    Asleep...
    Points: 11.516, Level: 70
    Level completed: 67%, Points required for next Level: 134
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    1.383
    Points
    11.516
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    yauster - I know, but I was porting it, and was hoping to gainevery aspect of the PC version. But, seeing theactual mechanics of a particle engine such as this, Im going to write my own. That way, I learn something :)

    I have all evening to do it, so hopefully you could look over my code later on for optimization tricks :o Also, Ill be making it visually better, as in using either small textured quads OR simply pixels (ill need alot of particles if i use pixels). (im trying to say i understand the mechanics of atleast one type of particle engine and now i believe ican write my own)...

    itll probably look the same as some others in many aspects, but honestly, itll be my own, whether or not you believe me doesnt matter to me too much...

    *starts individual particle structure*
    -= Double Post =-
    Im confused on the question being asked but...

    Code:
    if io.open("file.extension","r") then
    --file exists
    else
    --file doesnt exist
    end

    yeah thats perfect thanks

  18. #5448
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    ok you guys i really want to get this, if i have

    Code:
    timer = Timer.new()
    timer:start()
    
    while true do
         screen:clear()
    
         screen:print(208,131,"Checking flash0",red)
    
         if timer:time() >= 1000 and timer:time() < 2000 then
           screen:print(272,131,".",red)
         elseif timer:time() >= 2000 and timer:time() < 3000 then
           screen:print(272,131,"..",red)
         elseif timer:time() >= 3000 and timer:time() < 4000 then
           screen:print(272,131,"...",red)
         elseif timer:time() >= 4000 then
    how can i make it end after going through once and begin another timer? sorry for so many questions but i am really trying

  19. #5449
    QJ Gamer Blue
    Points: 4.209, Level: 41
    Level completed: 30%, Points required for next Level: 141
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    72
    Points
    4.209
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    didn't I post before that rather than starting another timer, you could just use math.floor(timer:time()/1000)=2

    I think I did but Im too lazy to check so yeah there ya go. If you really want it to be another timer, then you could use Timer:reset([startTime]) and then restart the timer.

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

    yauster - I have all the basics sofar, now I just need to set a random x and y coordinate plane speed... I have to do some research on google, but if you get this before i do, please post a way (i have an angle of direction set up, 0-360 as i want it to be in a circle, randomly set each time the particle dies).

    xtreme - You arent thinking logically, there fore you lose... If you wantto start another timer when a certain timer reaches a certain time, you do..
    Code:
    timer1 = Timer.new()
    timer2 = Timer.new()
    
    timer1:start()
    
    while true do
         if timer1:time()  > 10000 then 
             timer1:stop()
             timer2:start()
         end
    end

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


  21. #5451
    Points: 3.511, Level: 37
    Level completed: 8%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    19
    Points
    3.511
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    oh, haha, thanks, today i have done a little more research and discovered a little more.

    http://files.filefront.com//;6652077;;/

    what do you think?

    **NOTE** when the screen is black you must press a button to begin

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

    I dont have a PSP, so I cant really do much enjoyable...

    Anywho...

    Ive finished my particle engine. Im going to debug it now and fix any syntax errors, then ill upload it. Hopefully someone can test it and tellme what they tink...

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


  23. #5453
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Ill test if you want SG
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

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

    Alright guys, i made this particle engine, using prior PD experience, but sure enough, i typed it up and only had to research on one part for 1 minute... In the end, i came up with this... please test it someone and if you can,video tape it as eyece has done ;)
    Code:
    --[[
         Lua Particle Demo
             By: SG57
    
    
         No more than an
          eye looker...
            For now ;)
    ]]
    
    num_particles = 299 -- # of particles to have on screen
    particle = {}
    
    for i=0,num_particles do  -- constructs each particle with default values
           particle[i] = { x=240,y=136,                   -- x and y coordinates
                           xspeed,yspeed,                -- speed on x and y planes
                           color=Color.new(255,255,255), -- color of particle
                           life=0,                       -- life determines color ^
                           angle=math.random(360),       -- random angle for particle movement
                           speed=10,                      -- particle speed
                           fade_speed=20,  -- fading speed of particle
                           r=255,g=255,b=255             -- so color can be changed
                         }
           particle[i].xspeed = math.sin(particle[i].angle) * particle[i].speed -- set x axis vector speed
           particle[i].yspeed = math.cos(particle[i].angle) * particle[i].speed -- set y axis vector speed
    end
    
    while true do
       screen:clear()
       for i=0,num_particles do
           particle[i].xspeed = math.sin(particle[i].angle) * particle[i].speed -- set x axis vector speed
           particle[i].yspeed = math.cos(particle[i].angle) * particle[i].speed -- set y axis vector speed
    
           particle[i].x = particle[i].x + particle[i].xspeed -- Vector speeds
           particle[i].y = particle[i].y + particle[i].yspeed -- ^
    
           particle[i].color = Color.new(particle[i].r,particle[i].g,particle[i].b,particle[i].life)
    
           if particle[i].life >= 255 then
                particle[i].r=math.random(255)
                particle[i].g=math.random(255)
                particle[i].b=math.random(255)
                particle[i].life = 0
                particle[i].speed=math.random(1,3)
                particle[i].fade_speed=math.random(7,9)
                particle[i].x = 240
                particle[i].y = 136
                particle[i].angle=math.random(360)
           end
    
           particle[i].life = particle[i].life + particle[i].fade_speed
    
           screen:fillRect(particle[i].x,particle[i].y,2,2,particle[i].color)
       end
    
       screen.waitVblankStart()
       screen.flip()
    end

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


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

    It runs pretty smooth on the PSP.
    I cant get to a camera but maybe later unless someone else does it.

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

    Im not to worried about framerate, rather the look of it. Id like to know what you think it looks like... A fire, a bomb, etc.?

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


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

    It looks more like an explosion, Like at the middle you see all the clolors, Then it just spreads out. Its really smooth so it looks really kool on the PSP.

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

    Wait, so it explodes, the colors spread across screen, then it explodes again? Im aiming for a smooth constant flame type thing - easily fixable. But Im going to port this code to VB 6.0 so i can see it correctly. and modify it appropriatly.

    Oh and also - do the explosion particles fade away atall? or just scatter of screen? Id really like a video someone Cant you get the screen capture module thing shrrom? You just press R+SELECT i believe to take a video fo wahtever is on the screen...

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


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

    Ok, I will downlaod SVC, But it explodes at first like in a circle motion, Then it starts to spread out from the middle, But it doesnt look like they fade away, They just disappear.

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

    Ahh.. ok. And yes, it should explode ina circle motion, than it should just act as a fire or a smoke type effect... Once you get the video thing uploaded, ll be able to really see what i can do to improve it. Also, make sure you use that trick to compress the GIF and whatnot... That way, its not like 30 mb.

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



 

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 .