Seite 145 von 342 ErsteErste ... 45 95 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 195 245 ... LetzteLetzte
Zeige Ergebnis 4.321 bis 4.350 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; okay grimfate after that huge long collision detection are u saying i do --long collisin thing here then hit = ...

  
  1. #4321
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    okay grimfate after that huge long collision detection are u saying i do

    --long collisin thing here then
    hit = "true"
    end

    if hit = "true" then
    --now would i do what slice4ever said and just blit the demon somewhere really far off the screen like 800, 900 or something? if so i have it so that the demon is chasing something wouldnt it eventually work its way back on to the screen? isnt there someway i can unload it or something or once its blit off the screen can i stop it from following if u need it i can post my source.


    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

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

    how about do
    if dead == false then screen:blit(demon.x,demon .y,demon.img) end
    Then make dead become true when collision happens:
    if hit == true then dead == true end

    Thatll make it stop blitting when it gets hit.

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

    Have the demon keep track of its own health in the table. Check the health before updating, if it is lower then 0, then don't update the AI.

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

    Code:
    bgmenu = Image.load("bg_menu.png")
    shot = Sound.load("bullet.wav",false)
    while true do
      screen:blit(0,0,bgmenu)
      screen.waitVblankStart()
      screen.flip()
      pad = Controls.read()
      if pad:cross() then
      shot:play()
      screen.waitVblankStart(100)
      dofile("game.lua")
      break
     end
    end
    everytime i press X its just crappy sound and not my full wav. i can hear maybe 0.001 sec from it...whats the prob?

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

    Code:
    bgmenu = Image.load("bg_menu.png")
    shot = Sound.load("bullet.wav",false)
    while true do
      screen:blit(0,0,bgmenu)
      screen.waitVblankStart()
      screen.flip()
      pad = Controls.read()
      if pad:cross() and play == false then
      play = true
      end
      if pad:cross() and play then
      play = false
      end
      if play then
      shot:play()
      end
      screen.waitVblankStart(100)
      dofile("game.lua")
      break
     end
    end
    Thatll make X toggle it on and off.

  6. #4326
    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

    well i found that problem is that my sound is 20kbps ... 64kbps plays ok

    edit. yeh problem solved, it must be *.wav file with bitrate 64kbps
    Geändert von myschoo (11-26-2006 um 08:11 AM Uhr)

  7. #4327
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    whats the code for 'if no arrow keys are press then'
    -= Double Post =-
    i mean, "if the last keypressed was (lastkeypressed) then"
    Geändert von yoyomacy (11-26-2006 um 10:14 AM Uhr) Grund: Automerged Doublepost

  8. #4328
    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 pad == nil then blah end

    I THINK thats it, try it.

  9. #4329
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    no i figured it out, its if not pad:right() and not pad:left() then

  10. #4330
    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

    But to indicate absolutely NO buttons are being pressed, its if pad == nil

  11. #4331
    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 want to do, when i touch the object and press X,it will disappear...
    i thought about something like this:

    Code:
    function touchFunction()
    pad = Controls.read()
    if object1.y = object2.y and object1.x = object2.x and pad:cross() then
    object2 == nil
    end
    
    then just
    
    while true do
    
    functionTouch()
    this doesnt work, could anyone help?

  12. #4332
    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

    Code:
    function touchFunction()
    pad = Controls.read()
    touch = 1
    if object1.y = object2.y and object1.x = object2.x and pad:cross() then
    touch = 2
    end
    
    while true do
    
    functionTouch
    if touch == 1 then screen:blit(object2.x,object2.y,object2.img) end

  13. #4333
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von -TacticalPaper-
    But to indicate absolutely NO buttons are being pressed, its if pad == nil
    actually my way worked...

  14. #4334
    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

    error: "then" expected near "=" :/

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

    Code:
    function touchFunction()
    pad = Controls.read()
    touch = 1
    if object1.y == object2.y and object1.x == object2.x and pad:cross() then
    touch = 2
    end
    
    while true do
    
    functionTouch
    if touch == 1 then screen:blit(object2.x,object2.y,object2.img) end
    You forgot to use double == signs. When you compare two things, its ==. When you make something equal to something else, its =. And yes yoyomacy your way works fine, but you originally asked how to tell if no buttons were being pressed.

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

    error: calling "blit" on bad self <number expected got nil>

  17. #4337
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    Have the demon keep track of its own health in the table. Check the health before updating, if it is lower then 0, then don't update the AI.
    i was considering tactial's idea but then i saw ur post. yes i have the demon's health set to a variable. and my musket does 5-10 damage so i set it to math.random(5,10)

    so i would have to combine tacticals post along with yours ok i see i got it now. thanks guys
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  18. #4338
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    I need to blit the same picture in different spots simultaneously. I have the x/y positions set up in a table. I really am stumped...

    Here is an example of what I have.

    Code:
    --Dot positions
    pos = {}
    pos[1] = {x=s1,y=f1}
    pos[2] = {x=s2,y=f1}
    Code:
    --Chords
    maj = {}
    maj[1] = {name = "C Major", pos = {5,9,14}}
    I need it to blit a picture at pos 5,9, and 14. Can you help me?

    ps. s1/f2 indicate coordinates.

  19. #4339
    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 pspgamer81
    Heres a simulator i am doing, When i run it, It has 2 white pixels on the left side of the screen, But they arent moving, They just stay still, I tried to run this in both the PSP and the PC and still, Theirs 2 white pixels on the left side, Anyone know why?

    Code:
    size = 200
    zMax = 5
    speed = 0.050
    
    width = 480
    height = 272
    
    background = Image.load("background.png")
    
    starfield = {}
    math.randomseed(os.time())
    
    function createStar(i)
      starfield[i] = {}
      starfield[i].x = math.random(2*width) - width
      starfield[i].y = math.random(2*height) - height
      starfield[i].z = zMax
    end
    
    for i = 1, size do
      createStar(i)
      starfield[i].z = math.random(zMax)
    end
    
    white = Color.new(255, 255, 255)
    black = Color.new(0, 0, 0)
    
    while true do
      screen:clear(black)
      screen:blit(0, 0, background)
      for i = 1, size do
        starfield[i].z = starfield[i].z - speed
        if starfield[i].z < speed then createStar(i) end
        x = width / 2 + starfield[i].x / starfield[i].z
        y = height / 2 + starfield[i].y / starfield[i].z
        if x < 0 or y < 0 or x >= width or y >= height then
          createStar(i)
        else
          screen:pixel(x, y, white)
        end
      end
      screen.waitVblankStart()
      screen.flip()
      if Controls.read():start() then 
    break 
    end
    end
    wow. you ripped that entire code from shines example. and didnt even give credit. (in your "demo" that you released as well). and, you claealt state that its made by you.and you cant even get it to work. sad... if anyone doesnt believe me, download luaplayer, go to the applications folder, and look at the "Starfield" folder. its the exact same thing. he just added in a speed var. and its unefficient too. 3 different files. lol.


    you sicken me.
    --------------------------------------------------------------------------------------

  20. #4340
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    ^^ I thought the same thing, but didn't bother to check it out. tisktisktisk

  21. #4341
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    it is i never bothered to delete the example off i thought so to
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    Is ther a working return to XMB function, But for 2.71 SE-C?
    Or if thier is a working one, What firmwares does it work on?
    All i know of is

    Code:
    if pad:start() then
    os.exit()
    end
    But it doesnt work...

  23. #4343
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    unless you compile the luaplayer it well bring you back to the luaplayer menu but it is break
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

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

    So i should just use this:
    Code:
    if pad:start() then
    break
    end

  25. #4345
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspgamer81
    So i should just use this:
    Code:
    if pad:start() then
    break
    end
    Sigh. break does NOT exit back to the XMB. It transfers from one loop to another. The only ways to go the XMB are the HOME button, os.exit() and System.Quit().

  26. #4346
    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 havent used System.Quit()
    I better try it, Thanks!

  27. #4347
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspgamer81
    Ok, I havent used System.Quit()
    I better try it, Thanks!
    It only works with the Lua Player mod by Cools.

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

    Thats the one im using.

  29. #4349
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    o well then now i know
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  30. #4350
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Access_Denied
    It only works with the Lua Player mod by Cools.
    Was the function System.Quit() added in the Lua Player mod? Meaning if i put it on a regular Lua player would it say it is an error?
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!


 

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

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