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

Thread: Scrolling backgrounds

                  
   
  1. #1
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default Scrolling backgrounds

    I need some help with making scrolling backgrounds. CAn someone point me to a tut or give me some advice. thx.
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

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

    Default

    Define scrolling backgrounds. Tiled or just plain images?

  3. #3
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default

    just plain png's
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

  4. #4
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default

    when you run to the edge of the screen i need the screen to scroll so you can continue moving in that direction.
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

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

    Default

    Do you want to continous scrolling (ie, player is 'still' on the screen the background scrolls) or staggered (ie, player hits the right edge of the screen, player is placed to the left and a new image is blitted to the background).

  6. #6
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default

    I wanted it like Sora's adventure backgrounds. Where, when you get to a specific X coordinate on the screen the background scrolls, and when you get to the edge of the last picture, it stops scrolling
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

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

    Default

    The easiest way I found to do things like this is to set everything in World co-ordinates and have a camera object.

    As every object's position is defined to the top left of the images, the camera's relative position to the screen will always be in the top left.

    When you draw the screen, you draw everything that would be on screen relative to the camera based on their world co-ordinates.

    So when you move your character, it is a certain distance from/to the camera, you move the camera to keep the player on screen.

    I did this for my RTS Prototype that was 'released' a month or two back.

    This is just one way to achieve the effect. The other is to have every object's position relative to the screen which I find harder to keep track of in my head and code.

  8. #8
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default

    so, how would i go about making this "camera" object?
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

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

    Default

    All it is a x and y position.

    eg.

    camera x = 20
    camera y = 30

    sprite x = 40
    sprite y = 50

    to find out where to draw the sprite on the screen it is simply sprite - camera.

    Therefore:
    sprite on screen position x = 40 - 20 = 20
    sprite on screen position y = 50 - 30 = 20

  10. #10
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    35
    Posts
    832
    Rep Power
    95

    Default

    oh, ic i wil try this later tonight
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

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
  •