Seite 225 von 342 ErsteErste ... 125 175 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 275 325 ... LetzteLetzte
Zeige Ergebnis 6.721 bis 6.750 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; hey guys. Im making a sort of little football (soccer) game. I want the first version to be fairly simple. ...

  
  1. #6721
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    hey guys. Im making a sort of little football (soccer) game. I want the first version to be fairly simple.

    I want it so when the guy runs into the ball that it starts moving and eventually stops. I know how to do collision. I just wondered what i would type to make the ball move based on where the player collides with the ball.



  2. #6722
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    hey guys. Im making a sort of little football (soccer) game. I want the first version to be fairly simple.

    I want it so when the guy runs into the ball that it starts moving and eventually stops. I know how to do collision. I just wondered what i would type to make the ball move based on where the player collides with the ball.
    you could do a line projection path. Take the coordinates of the player and the coordinates of the ball and create a line formula. Then using that formula calculate a travel path and have the ball travel at whatever speed you like down that path. Gotta love algebra

  3. #6723
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    i am good at algebra. Could you give me some sort of psuedo code or something?

    Could you tell me at least how i would create this formula ?

  4. #6724
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    i am good at algebra. Could you give me some sort of psuedo code or something?

    Could you tell me at least how i would create this formula ?
    to take the angle the player got the ball you should use atan2

    hitangle = math.atan2(playerx-ballx,playery-bally)
    then based on that angle you can calculate the proyection path...
    but its more complex.. you betther see the phicis of a pool game wher a ball hits another ball using ball 1 speed ball 2 speed, ball 1 mass ball 2 mass, and the hitangle to calculate the correct angle of proyection..
    i recomend you to move the ball not whit ball.x = ball.x+1 bether to do like..
    Code:
     ballangle = 45
     ballspeed = 5
     ballx = ballx+math.cos(ballangle)*ballspeed
     bally = bally+math.sin(ballangle)*ballspeed
    thant should move the ball in angle 45 and whit a speed of 5
    i strongly recomend to see pool game...

  5. #6725
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Ok. Any recommendations on where i can see something like this ?

    With this way does it mean i dont need collision checks ?

  6. #6726
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    Ok. Any recommendations on where i can see something like this ?

    With this way does it mean i dont need collision checks ?
    of course you need colission chek,, but once it colide, you must calculate the ball new proyection angle. some interesting stuff on pool physics:
    http://library.thinkquest.org/C006300/main.htm
    here go to : momentum, collision , conservatin of the momentum.
    read thiss too..
    http://www.billiardworld.com/physics.html

    well letme see for and example a did som years ago fo another language,,, or search for a pool game made in lua just read and read and test.

  7. #6727
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    Ok. Any recommendations on where i can see something like this ?

    With this way does it mean i dont need collision checks ?
    Of course you do............

    edit: nvm I was beat
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  8. #6728
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    thanks very much ahrimanes.

    Im reading. Now.

    I finished reading this one.
    http://www.billiardworld.com/physics.html

    and am looking at the formula on the other one but find them .... difficult.
    Geändert von eldiablov (04-09-2007 um 11:31 AM Uhr)

  9. #6729
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    eldiablov: I recommend you use vector math instead, it is faster and once you have the base concepts, a lot easier to use.

    Also, I wouldn't recommend trying to make this too realistic, ever played sensible soccer? Fake physics all the way and it was still enjoyable.

  10. #6730
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    I dont planning on making it to realistic. Thanks Yaustar. I'll look at both and see which is easier to understand. :)

    Yaustar im only getting vector for 3d games. Does this matter ?

  11. #6731
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    eldiablov check this out
    http://www.phy.ntnu.edu.tw/ntnujava/...hp?topic=120.0
    by the way im in the same position of Yaustar...
    i think the ball must go foward whit the same angle of the player, then just make the speed alitel more big than the player.. and then the ball will lose speed simulating friction...
    see this alogrithn
    Code:
    if collide (player, ball) then
    ball angle =  player angle
    ball speed  =  player speed * 1.5
    end if
    if ball speed > 0 then ball speed = ballspeed - 1
    if ball speed < 0 then ball speed = 0
    and calculate movemente of the ball like i show back there whit sin cos...
    Geändert von ahrimanes (04-09-2007 um 12:15 PM Uhr)

  12. #6732
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    ty.

    Loading takes long on java

    reading this aswell.
    http://physics.about.com/od/mathemat...ctorMath_4.htm

    am i going in the right direction ?

  13. #6733
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    is this correct?:
    Timer = 0

    while true do

    pad = Controls.read()

    if pad:cross() then
    Timer = Timer.start()
    end

    if Timer == 10 then
    player.y = player.y - 20
    Timer = Timer.stop()
    Timer = 0
    end

  14. #6734
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    youresam or anybody what would I do in creating the lrx for compressing and uncompressing zip files would anonymous tipster's .zip source help or is making lrx's for lua different...

  15. #6735
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von moncristo_da_dev
    is this correct?:
    Timer = 0

    while true do

    pad = Controls.read()

    if pad:cross() then
    Timer = Timer.start()
    end

    if Timer == 10 then
    player.y = player.y - 20
    Timer = Timer.stop()
    Timer = 0
    end
    It should be like this:
    Code:
    Timer = Timer.new()
    
    while true do
    Timer:start()
    
    pad = Controls.read()
    
    if Timer:time() >= 10 then --I suggest you put the value 10 higher, because the timer counts  in milliseconds.
    player.y = player.y - 20
    Timer:reset()
    end
    
    end
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

  16. #6736
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    eldiablov: no. 3D is just 2D minus one dimension. Just leave the Z componment as 0.

  17. #6737
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    i am good at algebra. Could you give me some sort of psuedo code or something?

    Could you tell me at least how i would create this formula ?
    Just for fun, heres a way to do it using simple math.

    Was thinking about this while at work and I worked out a fun simple math way of doing it. Definately not the best way, but I thought I'd share it.

    You can just use the slope
    Code:
    ball.rise = (ball.y - player.oldy) 
    ball.run = (ball.x - player.oldx)
    I'm using an oldx and oldy variable to give me the point just before collision which will simulate force applied to ball. Longer the stride, the harder the ball will be hit.

    Then its as simple as
    Code:
    ball.y = ball.y + ball.rise
    ball.x = ball.x + ball.run
    Slowing the ball down would be a little trickier, you would have to keep the ratios equal, so use a percentage formula.

    Code:
    if ball.rise > 0 then		--maintains motion direction
        ball.oldrise = ball.rise
        ball.rise = ball.rise - 1
    elseif ball.rise < 0 then
        ball.oldrise = ball.rise
        ball.rise = ball.rise + 1
    end
    ball.run = math.floor((ball.rise * ball.run) / ball.oldrise)
    if ball.rise == 0 then
        ball.rise = 0
        ball.run = 0
    end
    Just for kicks, vectors would be the best way though, a lot more control and accuracy. This method will cause shakiness in the slowdown. Just thinking outside the box.

  18. #6738
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Does anyone know how to get ahold of be2003 the creator of sysext.lrx (I think) Or get his source. I plan on improving the .zip compress and uncompress

  19. #6739
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HaxxBlaster
    It should be like this:
    Code:
    Timer = Timer.new()
    
    while true do
    Timer:start()
    
    pad = Controls.read()
    
    if Timer:time() >= 10 then --I suggest you put the value 10 higher, because the timer counts  in milliseconds.
    player.y = player.y - 20
    Timer:reset()
    end
    
    end
    can i make it like this? i want it like that

    Timer = Timer.new()

    while true do

    pad = Controls.read()

    if pad:up() then
    Timer:start()
    end

    if Timer:time() >= 10 then --I suggest you put the value 10 higher, because the timer counts in milliseconds.
    player.y = player.y - 20
    Timer:reset()
    end

    end

  20. #6740
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HaxxBlaster
    It should be like this:
    Code:
    Timer = Timer.new()
    
    while true do
    Timer:start()
    
    pad = Controls.read()
    
    if Timer:time() >= 10 then --I suggest you put the value 10 higher, because the timer counts  in milliseconds.
    player.y = player.y - 20
    Timer:reset()
    end
    
    end
    lol good job. And even worse, I think you are restarting the timer every loop.
    BTW, 2 line code:
    timer = Timer.new(); timer:start()
    screen:blit(player.x,player.y-timer:time()/10,player.img)
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  21. #6741
    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 cant really understand youresam's post, but what he's getting at is you've named a variable the name of a reserved class in Lua.

    'Timer' is a reserved class of functions in Lua. Declaring a varaible named Timer will cause errors as you cant assign a class as a value.

    Same with 'Music' and 'Sound' and 'screen' i believe...

    Correct me if im wrong anywhere above.

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


  22. #6742
    QJ Gamer Bronze
    Points: 9.999, Level: 66
    Level completed: 88%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Washington
    Beiträge
    759
    Points
    9.999
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    why wont you answer my pm sg57?

    also if i have a cube:
    Code:
    cube = {
    bla bla bla bal
    ect ect ect cec
    lol ol ol ol ol olol
    }
    how do i make it move forward and left and right?

    add speed or lower speed, proper brakes?

    or is there any 3d lua tuts out? i searched google and didnt find any

    i am making a racing game :O
    (´・ω・‘)ノシ

  23. #6743
    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 Jomann
    why wont you answer my pm sg57?

    also if i have a cube:
    Code:
    cube = {
    bla bla bla bal
    ect ect ect cec
    lol ol ol ol ol olol
    }
    how do i make it move forward and left and right?

    add speed or lower speed, proper brakes?

    or is there any 3d lua tuts out? i searched google and didnt find any

    i am making a racing game :O
    dont take this personally, but if you cant figure out how to move a model, you're quite simply not ready to make even a bad racing game. also, you're not gonna find exact tutorials on every little thing. you need to learn the actual physics of cars, and apply that to your game. however, to asnwer your question:

    you should have a vector of the cars position. like this: (its C, i havent worked with lua in some time)
    Code:
    ScePspFVector3 carPos = {0, 0, 0};
    
    sceGumLoadIdentity();
    sceGumTranslate(carPos);
    // Draw Car //
    now, to move it, its simply a matter of changing the coordinates, just as you would in 2D, but with an added dimension. like:

    Code:
    if (pressed right) {
    carPos.x += speed;
    }
    etc.
    also, keep in mind that the above example will not get you anywhere. you will also have to keep a direction vector, and use that to calculate the direction in which the car will move. i recommend reading the articles on gamedev.net
    --------------------------------------------------------------------------------------

  24. #6744
    QJ Gamer Bronze
    Points: 9.999, Level: 66
    Level completed: 88%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Washington
    Beiträge
    759
    Points
    9.999
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    hey im not dumb :P lol anyway thank you, i knew how to move the model but i didnt understand how to put it in my code thats why i put the cube = {}
    thingy up there
    (´・ω・‘)ノシ

  25. #6745
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von moncristo_da_dev
    can i make it like this? i want it like that

    Timer = Timer.new()

    while true do

    pad = Controls.read()

    if pad:up() then
    Timer:start()
    end

    if Timer:time() >= 10 then --I suggest you put the value 10 higher, because the timer counts in milliseconds.
    player.y = player.y - 20
    Timer:reset()
    end

    end
    Sure. Is your point to make it move in one direction when you press a button?
    Something like this?:

    Code:
    RT = Timer.new()
    LT = Timer.new()
    UT = Timer.new()
    DT = Timer.new()
    
    Speed=10
    
    while true do
    
    pad = Controls.read()
    
    if pad:right() then
    RT:start()
    elseif pad:up() then
    LT:start()
    end
    
    
    if pad:up() then
    UT:start()
    elseif pad:down() then
    DT:start()
    end
    
    if RT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.x = player.x + Speed
    RT:reset()
    RT:start()
    elseif LT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.x = player.x - Speed
    LT:reset()
    LT:start()
    end
    
    if UT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.y = player.y - Speed
    UT:reset()
    UT:start()
    elseif DT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.y = player.y + Speed
    DT:reset()
    DT:start()
    end
    
    end

    Zitat Zitat von youresam
    lol good job. And even worse, I think you are restarting the timer every loop.
    BTW, 2 line code:
    timer = Timer.new(); timer:start()
    screen:blit(player.x,player.y-timer:time()/10,player.img)
    I don't think it's what he want to do.

    Zitat Zitat von SG57
    I cant really understand youresam's post, but what he's getting at is you've named a variable the name of a reserved class in Lua.

    'Timer' is a reserved class of functions in Lua. Declaring a varaible named Timer will cause errors as you cant assign a class as a value.

    Same with 'Music' and 'Sound' and 'screen' i believe...

    Correct me if im wrong anywhere above.
    I know, i think it works anyway. I've done it before. I remade the code.
    [CENTER]Some of my homebrew Applications/Games:
    [URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
    [URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]

    [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]

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

    How do you save a string with non-number elements in it?

  27. #6747
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    I cant really understand youresam's post, but what he's getting at is you've named a variable the name of a reserved class in Lua.

    'Timer' is a reserved class of functions in Lua. Declaring a varaible named Timer will cause errors as you cant assign a class as a value.

    Same with 'Music' and 'Sound' and 'screen' i believe...

    Correct me if im wrong anywhere above.
    ...you can name any variable anything, except for the programming-specific keywords...but...
    Timer = Timer.new()
    Do you not see something seriously wrong with that code?!
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  28. #6748
    .info
    Points: 15.395, Level: 80
    Level completed: 9%, Points required for next Level: 455
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    ACT, Australia
    Beiträge
    1.674
    Points
    15.395
    Level
    80
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Anti-QJ
    How do you save a string with non-number elements in it?
    blah = "blah"

    ..

    http://www.yongobongo.com
    PSN - yongobongo

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

    i have a text file like this:

    Code:
    code1 = 0
    code2 = 0
    code3 = 0
    code4 = 0
    code5 = 0
    and now i need with file io save new value to code3, how would i do that??

  30. #6750
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HaxxBlaster
    Sure. Is your point to make it move in one direction when you press a button?
    Something like this?:

    Code:
    RT = Timer.new()
    LT = Timer.new()
    UT = Timer.new()
    DT = Timer.new()
    
    Speed=10
    
    while true do
    
    pad = Controls.read()
    
    if pad:right() then
    RT:start()
    elseif pad:up() then
    LT:start()
    end
    
    
    if pad:up() then
    UT:start()
    elseif pad:down() then
    DT:start()
    end
    
    if RT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.x = player.x + Speed
    RT:reset()
    RT:start()
    elseif LT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.x = player.x - Speed
    LT:reset()
    LT:start()
    end
    
    if UT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.y = player.y - Speed
    UT:reset()
    UT:start()
    elseif DT:time() >= 200 then --I suggest you make the value 200 to fit, because the timer counts  in milliseconds.
    player.y = player.y + Speed
    DT:reset()
    DT:start()
    end
    
    end


    I don't think it's what he want to do.


    I know, i think it works anyway. I've done it before. I remade the code.
    im just making a simple jump function


 

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

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