Seite 236 von 342 ErsteErste ... 136 186 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 286 336 ... LetzteLetzte
Zeige Ergebnis 7.051 bis 7.080 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; if collision(something,somet hing) then if player.img == something then dosomething else dofile("br.lua") end end...

  
  1. #7051
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    if collision(something,somet hing) then if player.img == something then dosomething else dofile("br.lua") end end



  2. #7052
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    that didnt work

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

    What do you mean by 'the player iamge is different'? If your talking about a powerup for invincibility or shield, use a bool/flag.
    Code:
    if collide(player,object) and shield_on == false then dofile("w/ethisscriptis.lua") 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


  4. #7054
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    can you explain what that shield_on thing is

  5. #7055
    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

    Zitat Zitat von SG57
    What do you mean by 'the player iamge is different'? If your talking about a powerup for invincibility or shield, use a bool/flag.
    Code:
    if collide(player,object) and shield_on == false then dofile("w/ethisscriptis.lua") end
    Zitat Zitat von Urameshi
    can you explain what that shield_on thing is
    The shield_on is suppose to be a powerup and if the player and object collide without a shield then it will do a certain file, then you can just add something like if the player and object collide then the player just bounces or whatever away

  6. #7056
    QJ Gamer Blue
    Points: 3.679, Level: 38
    Level completed: 20%, Points required for next Level: 121
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Ort
    Relative
    Beiträge
    135
    Points
    3.679
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Merick
    the image is 50x50 pixels, however because the coord system starts at 0, the for loop should only go to 49
    Thank you very much.

    I knew it was something stupid, I just didn't think about that since it worked with a loaded image.

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

    please can someone give me the collison formula :Argh:

  8. #7058
    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's the formula from the collision function I'm currently using, I got it from Yaustar's C circle collision function that he posted on Evilmana:


    Code:
       distanceSquared = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
       radiusSquared = (rad2 + rad1) * (rad2 + rad1)
       
       if distanceSquared < radiusSquared then
          return true
       else
          return false 
       end
    x1,y1 and x2,y2 are the center points of each object image in relation to the screen

    rad1 and rad2 are the radius to use for each object, in my version I have it setup to automatically calculate these to be half of whichever side of the object image is the shortest

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

    you misunderstood me. I meant ...

    Wait i'll quote myself from the previous posts.

    Omg i still cant find the post. Anyway it was basiclally that when the player hits the ball the ball goes away at the angle the player came from and then slow down due to friction.
    Geändert von eldiablov (04-23-2007 um 03:05 AM Uhr)

  10. #7060
    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, you could try something like this :

    xspeed = 5, (or whatever)
    yspeed = 7
    (current speed at which the player is moving)

    after collision, you would change the ball position each cycle like this:

    ballspeed = 5
    ball.x = ball.x + (xspeed * ballspeed)
    ball.y = ball.y + (yspeed * ballspeed)
    ballspeed = ballspeed - .3 (or whatever)
    if ballspeed <=0 then ball stops

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

    Zitat Zitat von eldiablov
    you misunderstood me. I meant ...

    Wait i'll quote myself from the previous posts.

    Omg i still cant find the post. Anyway it was basiclally that when the player hits the ball the ball goes away at the angle the player came from and then slow down due to friction.
    Done: http://www.gamasutra.com/features/20...lander_pfv.htm

  12. #7062
    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 yaustar. I'l try that when i get home because that sites blocked on this computer.
    -= Double Post =-
    BAH now my head hurts again. These formulas aren't at all simple :Argh:
    Geändert von eldiablov (04-23-2007 um 08:15 AM Uhr) Grund: Automerged Doublepost

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

    i have downloades TTlde 2.1 and wen im traying to run it i ever got this error
    error: ttlde.lua:10: module 'pad.lc' not found:
    no field package.preload['pad.lc']
    no file './pad/lc.lua'
    no file '/usr/local/share/lua/5.1/pad/lc.lua'
    no file '/usr/local/share/lua/5.1/pad/lc/init.lua'
    no file '/usr/local/lib/lua/5.1/pad/lc.lua'
    no file '/usr/local/lib/lua/5.1/pad/lc/init.lua'
    no file './pad/lc.so'
    no file '/usr/local/lib/lua/5.1/pad/lc.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './pad.so'
    no file '/usr/local/lib/lua/5.1/pad.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    can some one tell me hor to make this works.. this hapen on lpwindows. and psp
    my psp is 3.10 oe a'

  14. #7064
    QJ Gamer Blue
    Points: 4.296, Level: 41
    Level completed: 73%, Points required for next Level: 54
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    132
    Points
    4.296
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    hi i am useing PSP Game Maker v 0.7 but i have a prob. I need to kno where to put my files, like my pic and sound filkes where do i put them? pls help =)

  15. #7065
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Just put them in the same directory as the lua script file that uses them.

  16. #7066
    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
    please can someone give me the collison formula :Argh:
    Zitat Zitat von eldiablov
    Omg i still cant find the post. Anyway it was basiclally that when the player hits the ball the ball goes away at the angle the player came from and then slow down due to friction.
    it might help you.
    Code:
    if colide(player,ball) then
       ball.angle = player.angle
       ball.speed = player.shutpawer
    end if
    in your ballupdate function use:
    Code:
    function updateball()
       ball.x = ball.x + math.sin(ball.angle)*ball.speed
       ball.y = ball.y + math.cos(ball.angle)*ball.speed
       if ball.speed > 0 then
          ball.speed = ball.speed-friction --the ball continues and lose speed.
       else
          ball.speed = 0 --the ball stops
       end
    end
    i think this culd help you.. when i do somthing whit angle i thibk is betther to calculate the next x y whit sin cos angle * speed. this is good.. now you just need to see the limist of the x and y i think you can figure out how to do that. else. fell fre to ask. im glad of helping.....by the wai i write this code here it might have some errors. but tis the logic what you need.

  17. #7067
    QJ Gamer Blue
    Points: 4.296, Level: 41
    Level completed: 73%, Points required for next Level: 54
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    132
    Points
    4.296
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    um can someone help me with my code

    red = Color.new(255, 0, 0)
    background = Image.load("images/background.jpg")
    screenrint(200, 100, "Look! I made text appear!", red)
    screen.flip()
    while true do
    screen.waitVblankStart()
    end

    i cant get the image to load. Its my first time codeing so i dont kno wats wrong. Can someone pls help me.

  18. #7068
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    You never blit the image. I'm sure it loads, though.
    Code:
    red = Color.new(255, 0, 0)
    background = Image.load("./images/background.jpg")
    while true do
         screen:clear(Color.new(0, 0, 0)) --may be wrong function name :|
         screen:blit(0, 0, background, true)
         screen:print(200, 100, "Look! I made text appear!", red)
         screen.waitVblankStart()
         screen.flip()
    end
    Geändert von PSPJunkie_ (04-25-2007 um 11:43 AM Uhr)

  19. #7069
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von cruisx
    um can someone help me with my code

    red = Color.new(255, 0, 0)
    background = Image.load("images/background.jpg")
    screenrint(200, 100, "Look! I made text appear!", red)
    screen.flip()
    while true do
    screen.waitVblankStart()
    end

    i cant get the image to load. Its my first time codeing so i dont kno wats wrong. Can someone pls help me.


    Code:
    red=Color.new(255,0,0)
    background=Image.load("./images/background.jpg")
    
    while true do
    screen:clear()
    
    screen:blit(0,0,background)
    screen:print(200, 100, "Look! I made text appear!", red)
    
    screen.waitVblankStart()
    screen.flip()
    end

  20. #7070
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPJunkie_
    You never blit the image. I'm sure it loads, though.
    Code:
    red = Color.new(255, 0, 0)
    background = Image.load("./images/background.jpg")
    while true do
         screen:clear(Color.new(0, 0, 0)) --may be wrong function name :|
         screen:blit(0, 0, background, true)
         screenrint(200, 100, "Look! I made text appear!", red)
         screen.waitVblankStart()
         screen.flip()
    end
    .......

    Zitat Zitat von Urameshi
    Code:
    red=Color.new(255,0,0)
    background=Image.load("./images/background.jpg")
    
    while true do
    screen:clear()
    
    screen:blit(0,0,background)
    screen:print(200, 100, "Look! I made text appear!", red)
    
    screen.waitVblankStart()
    screen.flip()
    end
    ????

  21. #7071
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    At least Urameshi's code works. You didn't even check yours lol.

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

    Zitat Zitat von ahrimanes
    it might help you.
    Code:
    if colide(player,ball) then
       ball.angle = player.angle
       ball.speed = player.shutpawer
    end if
    in your ballupdate function use:
    Code:
    function updateball()
       ball.x = ball.x + math.sin(ball.angle)*ball.speed
       ball.y = ball.y + math.cos(ball.angle)*ball.speed
       if ball.speed > 0 then
          ball.speed = ball.speed-friction --the ball continues and lose speed.
       else
          ball.speed = 0 --the ball stops
       end
    end
    i think this culd help you.. when i do somthing whit angle i thibk is betther to calculate the next x y whit sin cos angle * speed. this is good.. now you just need to see the limist of the x and y i think you can figure out how to do that. else. fell fre to ask. im glad of helping.....by the wai i write this code here it might have some errors. but tis the logic what you need.
    Thank you soooo much

    But where do you define ballpower?

  23. #7073
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von romulator
    At least Urameshi's code works. You didn't even check yours lol.
    And? It was the exact same thing... @[email protected]

  24. #7074
    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
    Thank you soooo much

    But where do you define ballpower?
    there is not ball power. just ball speed, that increases when the player touch it, and decreaces by friction every loop.
    i mybe worng calling.. ball.speed = player.shutpawer... i must bee
    ball.speed = player.pushforce.. since is not theplayer shuting the ball but driving it..well any question are wellcome .

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

    eldiablov:

    when the ball collides (with another ball), make sure the angle you give it isn't just player.angle.
    that will only work if the collide straight on. If you hit it at more of an angle, you will need some formula for that. If you need help with that, i could figure it out later.
    -= Double Post =-
    lol, i kind of want to make a pool game now.
    Geändert von emericaska8r (04-24-2007 um 02:48 PM Uhr) Grund: Automerged Doublepost

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

    he is making a soccer game, i dont think he need ball colision formula :)

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

    lol my bad, i thought he was making a pool game, sorry. :o

  28. #7078
    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 emericaska8r
    lol, i kind of want to make a pool game now.
    if you still want to do the pool game i have a ball collide script i made in blitzmax. it will be easy to port to lua. if you wanna try ...tell.....

  29. #7079
    QJ Gamer Blue
    Points: 4.296, Level: 41
    Level completed: 73%, Points required for next Level: 54
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    132
    Points
    4.296
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    You know how you can move back and forth through pics in the psp XMB by pressing R and L. Well is their any way to do this in lua? like by pressing R u go to the next pick and pressing L u go back to the previous pic?

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

    sure ahrimanes, thanks.


 

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

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