Seite 138 von 342 ErsteErste ... 38 88 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 188 238 ... LetzteLetzte
Zeige Ergebnis 4.111 bis 4.140 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; its still not working Ok heres part of my code here Quote: if pad:r() then computer = math.random(3,5) end but ...

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

    its still not working
    Ok heres part of my code here

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end

    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    when i hold down r it keeps doing generating the random numbers. how can i make it so that once i hold down r it gets that number and sticks with it until r is let go???? HELP plz im soo close to v0.2 i even have a menu this stupid random thing is killin me.


    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. #4112
    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 GuitarGod1134
    its still not working
    Ok heres part of my code here

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end

    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    when i hold down r it keeps doing generating the random numbers. how can i make it so that once i hold down r it gets that number and sticks with it until r is let go???? HELP plz im soo close to v0.2 i even have a menu this stupid random thing is killin me.

    ok, you can use oldpad, but its not very responsive, try this:
    Code:
    -- BEFORE YOUR MAIN LOOP, OUTSIDE OF ANY FUNCTIONS, PUT THIS --
    
    pressedR = false
    
    -- WHEREVER YOU DO "if pad:r() then..." put this--
    
    if pad:r() then
         if not pressedR then
              computer = math.random(3,5)
         end 
              pressedR = true
    else
         pressedR = false
    end
    --------------------------------------------------------------------------------------

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

    Thanks a bunch grim im gonna try it now.
    -= Double Post =-
    Zitat Zitat von Grimfate126
    ROFL! HAHHAHAHAHAHAHAHAHAHAHA :ROFL: :ROFL: :ROFL: :ROFL: HAHAHAHA..

    lol, sorry, couldnt hold myself there. NO, you keep it
    Code:
    math.randomseed(os.time())
    random.randomseed is a function, you cant change it.
    wow wasnnt that funny but yah on the code snippet i saw the funtion and the variable had a very similar name and as i skimmed down it pretty fast i got confused.

    EDIT: Well worst has come to worst. I was pushing really hard to get v0.2 out but its 2 in the morning and I have a Algebra test and I still have spanish2 homework to do. So grim if you find out the problem in the code i gave you can u fix it? if so thanks o and i can send you the pics too.
    Geändert von GuitarGod1134 (11-14-2006 um 05:07 PM Uhr) Grund: Automerged Doublepost
    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!

  4. #4114
    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 yoyomacy
    is it possible to do a collision with dofile, i have my bullet settings in one file and my game in another lua file. i want bullets to do collision with oobjects in my game file. how do i do that
    can anyone asner my question
    -= Double Post =-
    anyone?
    Geändert von yoyomacy (11-14-2006 um 05:34 PM Uhr) Grund: Automerged Doublepost

  5. #4115
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    --Anwser to Yoyomacy
    Actualy when doing dofile its like merging 2 files in 1 so you just have to make you function in one file then dofiles the other.So just do your collision check as if evcerything whas in the same file.

    --My question--
    here is my code i just don't under stand why it doesn't work.
    Code:
    --Define's Place
    Red = Color.new(255,0,0)
    Green =Color.new(0,255,0)
    Blue = Color.new(0,0,255)
    CurrentSelection = 1
    MenuBG1 = Image.load("Menu/menu1.png")
    MenuBG2 = Image.load("Menu/menu2.png")
    oldpad = Controls.read()
    
    while true do
    screen:clear()
    pad = Controls.read()
    
    --Menu1 Controls
    if pad:down() and oldpad:down() ~= pad:down() then
    CurrentSelection = CurrentSelection + 1
    elseif CurrentSelection == 2 then
    CurrentSelection = 1
    elseif pad:up() and oldpad:up() ~= pad:up() then
    CurrentSelection = CurrentSelection - 1
    elseif CurrentSelection == 0 then
    CurrentSelection = 2
    end
    
    if CurrentSelection == 1 then
    screen:blit(0,0,MenuBG1)
    elseif CurrentSelection == 2 then
    screen:blit(0,0,MenuBG2)
    end
    
    
    screen.waitVblankStart()
    screen.flip()
    end
    when i press up the screen goes black when i press down twice same thing.Any one know why?
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  6. #4116
    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 ZereoX
    --Anwser to Yoyomacy
    Actualy when doing dofile its like merging 2 files in 1 so you just have to make you function in one file then dofiles the other.So just do your collision check as if evcerything whas in the same file.
    wow thanks for the great reply

    also take out the ELSE from the elseif, see if that works

  7. #4117
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Thanks Yoyo it works. i don't know where my else if statement Fu** but il try do add some elseif statement until i get the error again so my code i shorther and i just have to remove maybe one elseif.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  8. #4118
    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

    ZeroX, you also need to add "oldpad = pad" at the end of your file.

  9. #4119
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Access_Denied i added Oldpad = Controls.read() at the begining of the code and my code works perfect.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

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

    I need to know: Is it possible to set screen brightness in LUA? (like when you press the little button next to the note, the brightness adjuster) I need it for a power saving purposes :)

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

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

    Still got my q over here
    its still not working
    Ok heres part of my code here

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end

    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    when i hold down r it keeps doing generating the random numbers. how can i make it so that once i hold down r it gets that number and sticks with it until r is let go???? HELP plz im soo close to v0.2 i even have a menu this stupid random thing is killin me.
    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!

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

    Does anyone know how to set the brightness in LUA? I need it for power conserving feature for my next app

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

  13. #4123
    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 Yongobongo
    Does anyone know how to set the brightness in LUA? I need it for power conserving feature for my next app
    I dont really know but maybe you could put in the readme like set psp to power screen off or whatever after so and so minutes.
    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!

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

    What about that button right there that does it by itself?

  15. #4125
    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 Yongobongo
    Does anyone know how to set the brightness in LUA? I need it for power conserving feature for my next app
    umm, i think it would be easier for the user to just press the brightness key then press multiple buttons. besides, no homebrew so far has the need to go to extreme measuers just to "save" power. so unless youre makeing another halo, this is pretty much un-needed.
    --------------------------------------------------------------------------------------

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

    can sombody help me with my second program in Lua i made it based on the tutorial
    it keeps coming up with an error
    here it is
    http://www.megaupload.com/?d=B9VYWJSZ

  17. #4127
    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

    still here!!!
    --------------------------------------------------------------------------------

    Still got my q over here
    its still not working
    Ok heres part of my code here

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end

    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    when i hold down r it keeps doing generating the random numbers. how can i make it so that once i hold down r it gets that number and sticks with it until r is let go???? HELP plz im soo close to v0.2 i even have a menu this stupid random thing is killin me.
    __________________
    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. #4128
    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 GuitarGod1134
    still here!!!
    --------------------------------------------------------------------------------

    Still got my q over here
    its still not working
    Ok heres part of my code here

    Quote:
    if pad:r() then
    computer = math.random(3,5)
    end

    but the problem is as soon as i press r my pic goes away and the variable returns to its orginal state. how can i make it so that one press of r and boom the pic stays blitted and the variable stays at the random selection. also i tried holding r and since its random it doesnt work it just keeps changing.
    when i hold down r it keeps doing generating the random numbers. how can i make it so that once i hold down r it gets that number and sticks with it until r is let go???? HELP plz im soo close to v0.2 i even have a menu this stupid random thing is killin me.
    __________________
    You have to use the oldpad method.

    if pad:r() and oldpad:r() ~= pad:r() then
    computer = math.random(3,5)
    end
    Geändert von Access_Denied (11-15-2006 um 02:14 PM Uhr)

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

    i want a collision with the bullet and the spot1 spot2 spot3 spot4, i have tried over 60 times differant things it wont work, so here is the 2 file, bullet.ua and index.lua, as they work right now with no collision so the bullet does nothing but shoot

    Code:
    function bulletInfo()
    
    
    bullet = Image.load("Bullet.png")
    
    
    currentBullet = 0
    direction = "right"
    
    
    BulletInfo = {}
    for a = 1,5 do
    BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = spot.x + 32,
    y = spot.y + 16 }
    end
    
    function bulletSetup()
    
    if currentBullet < 5 then
    currentBullet = currentBullet + 1
    else
    currentBullet = 1
    end
    if direction == "right" then
    BulletInfo[currentBullet].x = spot.x + 32
    BulletInfo[currentBullet].y = spot.y + 16
    end
    
    BulletInfo[currentBullet].direction = direction
    BulletInfo[currentBullet].firing = true
    end
    
    function bulletFire()
    for i = 1,5 do
    if BulletInfo[i].firing == true then
    if BulletInfo[i].direction == "right" then BulletInfo[i].x = BulletInfo[i].x + 10 end
    screen:blit(BulletInfo[i].x,BulletInfo[i].y,BulletInfo[i].pic)
    end
    if BulletInfo[i].x < 0 or BulletInfo[i].x > 480 or BulletInfo[i].y < 0 or BulletInfo[i].y > 272 then BulletInfo[i].firing = false end
    end
    end
    end
    Code:
    red = Color.new(255,0,0)
    blue = Color.new(0,0,255)
    green =Color.new(0,255,0)
    white = Color.new(255,255,255)
    speed = 100
    score = 0
    level = 1
    obst1 = Image.load("enemy1.png")
    obst2 = Image.load("enemy2.png")
    obst3 = Image.load("enemy3.png")
    obst4= Image.load("enemy4.png")
    car = Image.load("play.png")
    oldpad = Controls.read()
    dofile("Bullet.lua")
    bg = Image.load("bg.png")
    bullet = Image.load("bullet.png")
    
    System.usbDiskModeActivate()
    
    
    
    spot  = {x = 10, y = 30, height = car:height(), width = car:width() }
    spot1 = {x = 110, y = 120, height = obst1:height(), width = obst1:width()}
    spot2 = {x = 130, y = 250, height = obst2:height(), width = obst2:width()}
    spot3 = {x = 360, y = 250, height = obst3:height(), width = obst3:width()}
    spot4 = {x = 470, y = 170, height = obst4:height(), width = obst4:width()}
    
    
    function collisionCheck(object)
    if (spot.x + spot.width > object.x) and (spot.x < object.x + object.width) and (spot.y + spot.height > object.y) and (spot.y < object.y + object.height) then
    speed = speed - 1
    end
    end
    
    bulletInfo()
    
    bgy = 0
    
    while true do
    oldinput = input
    input = Controls.read()
    
    if input:select() then break end
    
    screen:clear()
    pad = Controls.read()
    
    score = score + 1
    
    if score>=500 and score<=500 then
    level = level + 1 / 1
    end
    
    if score>=1100 and score<=1100 then
    level = level + 1 / 1
    end
    
    if score>=1600 and score<=1600 then
    level = level + 1 / 1
    end
    
    bgy = bgy - 2
    
    if bgy<=-482 then
    bgy = 0
    end
    
    if bgy>1 then
    bgy = bgy - 481
    end
    
    collisionCheck(spot1)
    collisionCheck(spot2)
    collisionCheck(spot3)
    collisionCheck(spot4)
    
    if pad:up() and spot.y > 1 then
    spot.y = spot.y - 5
    end
    if pad:down() and spot.y < 270 then
    spot.y = spot.y + 5
    end
    
    if pad:cross() then
    spot1.x = spot1.x - 6
    spot2.x = spot2.x - 6
    spot3.x = spot3.x - 6
    spot4.x = spot4.x - 6
    bgy = bgy - 5
    end
    
    spot1.x = spot1.x - 3
    spot2.x = spot2.x - 3
    spot3.x = spot3.x - 3
    spot4.x = spot4.x - 3
    
    if spot1.x < 0 then
    spot1.x = math.random(480,520)
    spot1.y = math.random(20,252)
    end
    if spot2.x < 0 then
    spot2.x = math.random(480,520)
    spot2.y = math.random(20,252)
    end
    if spot3.x < 0 then
    spot3.x = math.random(480,520)
    spot3.y = math.random(20,252)
    end
    if spot4.x < 0 then
    spot4.x = math.random(480,520)
    spot4.y = math.random(20,252)
    end
    
    screen:blit(bgy,0,bg)
    screen:blit(bgy+bg:width(),0,bg)
    screen:blit(spot1.x,spot1.y,obst1)
    screen:blit(spot2.x,spot2.y,obst2)
    screen:blit(spot3.x,spot3.y,obst3)
    screen:blit(spot4.x,spot4.y,obst4)
    screen:blit(spot.x,spot.y,car)
    
    
    if pad:circle() and oldpad:circle() ~= pad:circle() then
    bulletSetup()
    end
    
    bulletFire()
    
    if score>=500 and score<=600 then
    screen:print(220,150,"LEVEL UP",red)
    end
    if score>=1100 and score<=1200 then
    screen:print(220,150,"LEVEL UP",red)
    end
    if score>=1600 and score<=1700 then
    screen:print(220,150,"LEVEL UP",red)
    end
    screen:print(220,0,"Level: "..level,red)
    screen:print(0,0,"plane health: "..speed,red)
    screen:print(380,0,"score: "..score,red)
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end

  20. #4130
    QJ Gamer Green
    Points: 6.863, Level: 54
    Level completed: 57%, Points required for next Level: 87
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Cross Country Course
    Beiträge
    794
    Points
    6.863
    Level
    54
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von cheese the psp
    can sombody help me with my second program in Lua i made it based on the tutorial
    it keeps coming up with an error
    here it is
    http://www.megaupload.com/?d=B9VYWJSZ
    What does the error message say?
    never mind.
    Right off the bat I found an error. When you where putting in you colors you did not capitalize the c.
    This is what you put:

    black = color.new(0, 0, 0)

    What it needs to be:

    black = Color.new(0, 0, 0)

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

    can someone help me on my problem 100k reward ;)

  22. #4132
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Yoyomacy can you send me the all the script/image.
    Free Prizes at Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  23. #4133
    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 ZereoX
    Yoyomacy can you send me the all the script/image.
    that is the entire script, look at the page before this

  24. #4134
    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 yoyomacy
    that is the entire script, look at the page before this
    He wants the images to test the code. It would make it easier for me too.

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

    sent. ok anyone else?
    -= Double Post =-
    ok. 500k if anyone does it (and works.)
    Geändert von yoyomacy (11-15-2006 um 07:29 PM Uhr) Grund: Automerged Doublepost

  26. #4136
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Not too much different from what you were doing:

    Code:
    function bulletcollision(object)
    
    for i = 1,5 do
    	if BulletInfo[i].firing then
    		if (BulletInfo[i].x + BulletInfo[i].pic:width() > object.x) and (BulletInfo[i].x < object.x + object.width) and (BulletInfo[i].y + BulletInfo[i].pic:height() > object.y) and (BulletInfo[i].y < object.y + object.height) then
    			screen:print(100,100,"BAM!",white)
                            screen.waitVblankStart(6)
    		end
    	end
    end
    
    end
    
    bulletcollision(spot1)
    bulletcollision(spot2)
    bulletcollision(spot3)
    bulletcollision(spot4)
    Not tested of course.

    The function can go anywhere outside of your while loop, and the function calls go inside, probably right after the bulletFire() call near the bottom. You didn't specify what should happen if the bullets collide with the objects. :)

  27. #4137
    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 LMelior
    Not too much different from what you were doing:

    Code:
    function bulletcollision(object)
    
    for i = 1,5 do
    	if BulletInfo[i].firing then
    		if (BulletInfo[i].x + BulletInfo[i].pic:width() > object.x) and (BulletInfo[i].x < object.x + object.width) and (BulletInfo[i].y + BulletInfo[i].pic:height() > object.y) and (BulletInfo[i].y < object.y + object.height) then
    			screen:print(100,100,"BAM!",white)
                            screen.waitVblankStart(6)
    		end
    	end
    end
    
    end
    
    bulletcollision(spot1)
    bulletcollision(spot2)
    bulletcollision(spot3)
    bulletcollision(spot4)
    Not tested of course.

    The function can go anywhere outside of your while loop, and the function calls go inside, probably right after the bulletFire() call near the bottom. You didn't specify what should happen if the bullets collide with the objects. :)
    I LOVE YOU, IT WORKED THE FIRST TIME, 500k FOR YOU~!!!!!!!

  28. #4138
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yoyomacy
    I LOVE YOU, IT WORKED THE FIRST TIME, 500k FOR YOU~!!!!!!!
    Wow, thanks...you just multiplied my points by a factor of 100! :Jump:

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

    now you can get 300k

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

    i need help with my new program
    it isnt loading the images it keeps coming up with an eror what am i doing wrong
    System.usbDiskModeActivat e()

    white = Color.new(255, 255, 255)

    background = Image.load("images/menu.png")
    November = Image.load("images/nov.png")
    December = Image.load("images/dec.png")
    January = Image.load("images/jan.png")
    Febuary = Image.load("images/feb.png")
    March = Image.load("images/mar.png")
    April = Image.load("images/apr.png")
    May = Image.load("images/may.png")
    June = Image.load("images/june.png")
    July = Image.load("images/july.png")
    August = Image.load("images/aug.png")
    September = Image.load("images/sept.png")

    screen:blit(0, 0, background, false)
    screen.waitVblankStart()
    screen.flip()

    while to do
    screen:blit(0, 0, background, false)


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 08:58 PM Uhr.

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