Results 1 to 10 of 10

Thread: Scene.lua (code help)

                  
   
  1. #1
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    33
    Posts
    2,976
    Rep Power
    108

    Post Scene.lua (code help)

    well my main objective now is to implament a cut scene. iv been having one problem. I want to be able to press X and have the old talk sprite be cleared of the screen and have the next talk sprite be blit to the screen right after. I also want to be able to do this about 5 five time for different talk sprites. This is to give the effect of players talking

    scene.lua
    Code:
    --load images, this is for the cutscene--
    Background = Image.load("backgrounds/scene1.png")
    Sora = Image.load("sprites/sora.png")
    Enemie = Image.load("sprites/enemie.png")
    Talk = Image.load("sprites/talk.png")
    Talk2 = Image.load("sprites/talk2.png")
    Talk3 = Image.load("sprites/talk3.png")
    Talk4 = Image.load("sprites/talk4.png")
    Talk5 = Image.load("sprites/talk5.png")
    
    while true do
    pad = Controls.read()
    screen:clear()
    
    
    --prints to screen--
    screen:blit(0,0,Background,false)
    screen:blit(31, 230,Sora)
    screen:blit(330, 230,Enemie)
    screen:blit(35, 30,Talk)
    
    screen:waitVblankStart()
    screen:flip()
    end
    help would be much appricaiated

    thanx

  2. #2
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    33
    Posts
    2,976
    Rep Power
    108

    Default A little progress

    I was messing around with the code a little bit and got it to wear when i press X the talk sprite permenatly clears off the screen. Also i was able to all in the same function be able to blit the next talk sprite to the screen. I used this code

    Code:
    --controls to load new talk sprites--
    if pad:cross() and not oldpad:cross then
    Talk:clear()
    screen:blit(35, 30,Talk2)
    end
    the only problem is that the next talk sprite only blits to the screen for a quick second then goes away how do i make it perminatly stay after you press and let go of X

    thank you

    --edit

    This is what the new code looks like
    Code:
    --load images, this is for the cutscene--
    Background = Image.load("backgrounds/scene1.png")
    Sora = Image.load("sprites/sora.png")
    Enemie = Image.load("sprites/enemie.png")
    Talk = Image.load("sprites/talk.png")
    Talk2 = Image.load("sprites/talk2.png")
    Talk3 = Image.load("sprites/talk3.png")
    Talk4 = Image.load("sprites/talk4.png")
    Talk5 = Image.load("sprites/talk5.png")
    
    current = 1
    
    while true do
    
    oldpad = pad
    pad = Controls.read()
    screen:clear()
    
    --prints to screen--
    screen:blit(0,0,Background,false)
    screen:blit(31, 230,Sora)
    screen:blit(330, 230,Enemie)
    screen:blit(35, 30,Talk)
    
    --controls to load new talk sprites--
    if pad:cross() and not oldpad:cross() then 
    Talk:clear()
    screen:blit(35, 30,Talk2)
    end
    
    screen:waitVblankStart()
    screen:flip()
    end
    HOW DO I GET THE FREAKING SPRITE TO BLIT TO THE SCREEN PERMINATLY!!!

    my brain hurts

    --edit

    ok iv read up on all the controls fuctions but i dont know how to implament these into my code to do what i want it to do

    --this is what i found--

    Controls

    Controls Controls.read()

    Bool controls:select()
    Bool controls:start()
    Bool controls:up()
    Bool controls:right()
    Bool controls:down()
    Bool controls:left()
    Bool controls:l()
    Bool controls:r()
    Bool controls:triangle()
    Bool controls:circle()
    Bool controls:cross()
    Bool controls:square()
    Bool controls:home()
    Bool controls:hold()
    Bool controls:note()

    Number controls:analogX() -- ranges from -127 to 128.


    Returns the current analog stick position in x direction.

    Number controls:analogY() -- same


    Returns the current analog stick position in y direction.

    Bool (Controls a == Controls b) -- note! The analog stick is NOT considered when comparing because of analog fluctuations.


    Compares two pad states.

    Number controls:buttons() -- returns the bitmask like sceCtrlReadBufferPositive reads it


    Constants for binary operations on buttons() result (for example “Controls.read():buttons() & Controls.startMask > 0” is the same as “Controls.read():start()”)

    Number Controls.selectMask
    Number Controls.startMask
    Number Controls.upMask
    Number Controls.rightMask
    Number Controls.downMask
    Number Controls.leftMask
    Number Controls.ltriggerMask
    Number Controls.rtriggerMask
    Number Controls.triangleMask
    Number Controls.circleMask
    Number Controls.crossMask
    Number Controls.squareMask
    Number Controls.homeMask
    Number Controls.holdMask
    Number Controls.noteMask

    --end of what i found--

  3. #3
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    33
    Posts
    2,976
    Rep Power
    108

    Default

    can no one help this is just sad . I just wanted to be able to press X and have the old talk sprite be cleared off the screen and have a new talk sprite be blit to the screen perminitly all in the same function. how do i do this. i used this code

    Code:
    --controls to load new talk sprites-- if pad:cross() and not oldpad:cross then Talk:clear() screen:blit(35, 30,Talk2) end
    the only problem with this is that it doesnt blit the new image to the screen perminitly

    please help

  4. #4

    Default

    add screen.waitVblankStart() and screen.flip()

    that will solve it

  5. #5
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    33
    Posts
    2,976
    Rep Power
    108

    Default

    Quote Originally Posted by Zion View Post
    add screen.waitVblankStart() and screen.flip()

    that will solve it
    no thats already inplace in the code the last code that i used above is the code that i used to clear the old talk sprite and blit a new one, but the only problem is that the new talk sprite is only bliting to the screen for a milisecond how do i make it blit perminitly after pressing X

    heres the code

    Code:
    --load images, this is for the cutscene--
    Background = Image.load("backgrounds/scene1.png")
    Sora = Image.load("sprites/sora.png")
    Enemie = Image.load("sprites/enemie.png")
    Talk = Image.load("sprites/talk.png")
    Talk2 = Image.load("sprites/talk2.png")
    Talk3 = Image.load("sprites/talk3.png")
    Talk4 = Image.load("sprites/talk4.png")
    Talk5 = Image.load("sprites/talk5.png")
    
    current = 1
    
    while true do
    
    oldpad = pad
    pad = Controls.read()
    screen:clear()
    
    --prints to screen--
    screen:blit(0,0,Background,false)
    screen:blit(31, 230,Sora)
    screen:blit(330, 230,Enemie)
    screen:blit(35, 30,Talk)
    
    --controls to load new talk sprites--
    if pad:cross() and not oldpad:cross() then 
    Talk:clear()
    screen:blit(35, 30,Talk2)
    end
    
    screen:waitVblankStart()
    screen:flip()
    end

  6. #6

    Default

    try putting the screen.flip() before the vblank start. If you want, send me the file and il try and fix it for you

  7. #7
    DCEmu Legend gunntims0103's Avatar
    Join Date
    May 2006
    Location
    Brentwood, NY
    Age
    33
    Posts
    2,976
    Rep Power
    108

    Default First scene COMPLETE!!!

    o yea i finally got the first cut scene for sora adven out of the way. Thanx to ninja9393 for the super coding help. he was able to get the talk sprite cleared and blit a new one using dofiles. geez why didnt i think of that . Well anyways now that thats out the way im going to start coding the actual in game play which is gonna be my biggest mild stone.

  8. #8
    DCEmu Art Pro
    Join Date
    Apr 2006
    Posts
    1,950
    Rep Power
    95

    Default

    Cool. Where did you get the sprites? what website? and what game they from. Plus will you need me to animate them or for bg's etc?

  9. #9
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    83

    Default

    The problem is here:
    if pad:cross() and not oldpad:cross() then
    Talk:clear()
    screen:blit(35, 30,Talk2)
    end
    Talk2 is ONLY blitted if cross was pressed in this frame and not pressed last frame.

    The blit needs to happen outside the if statement and the control of what image to blit needs to be in it.

  10. #10

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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