Results 1 to 7 of 7

Thread: Scrolling...

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    Scrolling...

    I am making a project for school, that is kind of like a Zelda type game, but I need help. I don't know how to make it scroll. I want the levels to be bigger, but for now they are just 20x20 tiles. I would like maybe a 100x100 map, and just display 10x10 of the tiles. I'll attach it. Please tell me if there is a half-way easy way to implement scrolling to my code. If not, I will have to rewrite everything, and that's not fun.

    Thanks
    -Joey
    <removed by admin>

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    well... no.

    I recommend you to completely re-design the engine, starting with your graphics system... read my tutorial for assistance or review the scrolling demo.

  3. #3
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Fox,

    Every single one of your posts states...

    "Read my tutorial"

    Is there anything you don't have a tutorial for????

    PS - have you tried Sentience yet?
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    as people asked me things again and again i wrote these tutorials..


    yes i tried but erm.. didnt like it too much. im not a fan of strategy games

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    im not a fan of strategy games
    Aaaah! *Shocked and Apalled*

    Seriously though, you could do it without redoing your engine, but it's a longshot. One way to do this is to add an Offset to your drawing function, and only draw the blocks needed. I haven't looked at your code but if you are using Directdraw you'll need to clip the RECTs before blitting them. I believe I gave you a sample code a while ago, did I not?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Fox - I have tried your tutorial many times. I just seem to get off track all the time and never finish it. I also don't learn much from demos where it's just the project. I'm not good at reading through the code, I would rather have somthing tell me what they are doing, then show me the code. But I'll have a look again, as soon as I get home (I'm at school).

    I'm not using DirectDraw... just BitBlt. I just need a really simple game. If I cannot just add it to what I have already, I will just have a 20x20 or 25x25 map. Whatever fits in the screen at 1024x768. And I don't think you ever gave me any sample code Sastraxi. I know you've helped me with other things, but not this.
    <removed by admin>

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Well since you're using BitBlt it wouldn't help anyways... But Scrolling itself is pretty simple. I should've given you some code before but here goes now:
    VB Code:
    1. Function Draw(OffsetX As Long, OffsetY As Long)
    2. Dim X As Long
    3. Dim Y As Long
    4. Dim Ix As Long
    5. Dim Iy As Long
    6.  
    7.     X = OffsetX
    8.     Y = OffsetY
    9.    
    10.     For Ix = Int(X / [TileWidth]) To Int((X + ScreenW) / [TileWidth])
    11.     For Iy = Int(Y / [TileHeight]) To Int((Y + ScreenH) / [TileHeight])
    12.         [Draw Tile Function] Ix * [TileWidth] - OffsetX, Iy * [TileHeight] - OffSetY
    13.     Next I
    14. End Function
    I believe this would work. You would pass pixel values as the offset, as in this example:
    VB Code:
    1. Draw PlayerX + (PlayerW / 2) - (ScreenW / 2), PlayerY + (PlayerH / 2) - (ScreenH / 2)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

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



Click Here to Expand Forum to Full Width