Results 1 to 6 of 6

Thread: debug

  
  1. #1
    mafia1ft is offline -Hacks Newbie
    Join Date
    Mar 2006
    Posts
    9
    Rep Power
    0

    Default

    would someone be able to degug my code
    i think something is wrong with my random number thing

    Code:
    DRAW = Image.load("PICS/DRAW.JPG") 
    WIN = Image.load("PICS/WIN.JPG") 
    LOSE = Image.load("PICS/LOSE.JPG") 
    
    while true do 
    
    screen:clear() 
    
    pad = Controls.read() 
    
    -- X 
    if pad:cross() then 
    break 
    end 
    
    a = math.random(3)
    
    if a == 1 then 
    screen:blit(0,0,WIN) 
    end 
    
    if a == 2 then 
    screen:blit(0,0,LOSE) 
    end 
    
    if a == 3 then 
    screen:blit(0,0,DRAW) 
    end 
    
    screen.waitVblankStart() 
    screen.flip() 
    
    end


  2. #2
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    thats it??? well right off the bat I see you didn't call screen.flip() and screen.waitVblankStart() and you didn't end your main loop
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  3. #3
    mafia1ft is offline -Hacks Newbie
    Join Date
    Mar 2006
    Posts
    9
    Rep Power
    0

    Default

    it's ok i got it to work
    btw i did if u scroll down

  4. #4
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    oh shit sorry I was on the psp when I posted and It didn't show the scroll
    hmm now looking at it I don't see anything wrong.
    I've never used the random number thing before so I don't know if thats it, so how did you fix it

    after further inspection I see that you put screen.flip() after screen.waitVblankStrat()
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  5. #5
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    Dude when you use the Random function you need to show between which 2 numbers you need the random number

    so it should be

    a = math.random(1,3)

    and to make it more random add

    math.randomseed(os.time())

    at the beging of ur code

    \"Death be not proud, some have called thee mighty and great, thou art not so\"

  6. #6
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    Dude when you use the Random function you need to show between which 2 numbers you need the random number

    so it should be

    a = math.random(1,3)

    and to make it more random add

    math.randomseed(os.time())

    at the beging of ur code


    o and it must be

    screen:flip()

    \"Death be not proud, some have called thee mighty and great, thou art not so\"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •