Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: please help me with lua scrolling

                  
   
  1. #1
    DCEmu Legend Buddy4point0's Avatar
    Join Date
    May 2006
    Location
    The Lounge Awesomeness: 1337
    Age
    33
    Posts
    4,026
    Rep Power
    139

    Default please help me with lua scrolling

    hi im learning lua, but i need to find how to make and image scroll and repeat. please any1 who knows how HELP ME!

  2. #2
    DCEmu Rookie BlackShark's Avatar
    Join Date
    Mar 2006
    Posts
    107
    Rep Power
    71

    Default

    [COLOR="DarkRed"]post ur code...[/CKLOR]

  3. #3
    DCEmu Legend Buddy4point0's Avatar
    Join Date
    May 2006
    Location
    The Lounge Awesomeness: 1337
    Age
    33
    Posts
    4,026
    Rep Power
    139

    Default

    lol y.
    all i needed to know was the function to scoll. which i found

  4. #4
    PS3 User Gizmo356's Avatar
    Join Date
    Feb 2006
    Age
    33
    Posts
    1,756
    Rep Power
    124

    Default

    Something like

    if player.x>50 then
    bg.x=bg.x-2
    end

  5. #5
    DCEmu Legend Buddy4point0's Avatar
    Join Date
    May 2006
    Location
    The Lounge Awesomeness: 1337
    Age
    33
    Posts
    4,026
    Rep Power
    139

    Default

    yea i figured that out thanks

  6. #6
    DCEmu Legend Buddy4point0's Avatar
    Join Date
    May 2006
    Location
    The Lounge Awesomeness: 1337
    Age
    33
    Posts
    4,026
    Rep Power
    139

    Default

    ok it scrolls fine but i how do i make the picture repeat.
    cause right now it just scrolls and leaves black

  7. #7
    PS3 User Gizmo356's Avatar
    Join Date
    Feb 2006
    Age
    33
    Posts
    1,756
    Rep Power
    124

    Default

    Im not to sure how to due that but I would either but more than one background image( makes it alot harder to make background scroll ) or just have one really huge background image.

  8. #8
    DCEmu Legend Buddy4point0's Avatar
    Join Date
    May 2006
    Location
    The Lounge Awesomeness: 1337
    Age
    33
    Posts
    4,026
    Rep Power
    139

    Default

    yea i just have it set so that there are like 10 background images in a line and the just all scroll like that. but after all 10 have scrolled past im left with black. i could just make like 1000 background varialbes but thats kinda the half ass way. im sure theres a better way

  9. #9

    Default

    the psp screen in 480x272 - when drawing outside that area to the right or to the left, it goes to a max of -480 and -272, to create a continuous scroll of a single image do this

    set a varable as an x offset:

    X_offset = 0

    Blit the three images:

    screen:blit(-480+X_offset, 0, image)
    screen:blit(X_offset, 0, image)
    screen:blit(480+X_offset, 0, image)

    when the player is moving left do this:

    X_offset = X_offset - 1
    if X_offset < -480 then X_offset = 0 end

    when moving right, use the same thing only do a +1 instead of a -1, and set it to check if it's >480

    if you want to make it srcroll up and down instead, do the same except use a Y offset instead of an X

  10. #10
    PSP Coder -Xandu-'s Avatar
    Join Date
    Jan 2007
    Posts
    1,036
    Rep Power
    82

    Default

    Try this:


    BG = Image.load("Bg2.png")

    slide = {}

    slide[1] = { x = 0, y = 0, pic = BG }
    slide[2] = { x = -480, y = 0, pic = BG }
    slide[3] = { x = -960, y = 0, pic = BG }

    for blit_slides = 1,2 do
    screen:blit(slide[blit_slides].x, slide[blit_slides].y, slide[blit_slides].pic)
    oldslidesx = slide[blit_slides].x
    end

    for repeat_slides = 1, 2 do
    if slide[repeat_slides].x > 480 then
    slide[repeat_slides].x = -480
    end
    end

    for repeat_slides = 1, 2 do
    if slide[repeat_slides].x < -480 then
    slide[repeat_slides].x = 480
    end


    Taken from my unreleased "Pokemon : Ditto's Quest".

Page 1 of 2 12 LastLast

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
  •