|
-
Dec 3rd, 2001, 01:09 AM
#1
Thread Starter
PowerPoster
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
-
Dec 3rd, 2001, 04:54 AM
#2
PowerPoster
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.
-
Dec 3rd, 2001, 05:13 AM
#3
PowerPoster
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...
-
Dec 3rd, 2001, 06:13 AM
#4
PowerPoster
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
-
Dec 3rd, 2001, 08:23 AM
#5
Good Ol' Platypus
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)
-
Dec 3rd, 2001, 11:06 AM
#6
Thread Starter
PowerPoster
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.
-
Dec 3rd, 2001, 04:31 PM
#7
Good Ol' Platypus
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:
Function Draw(OffsetX As Long, OffsetY As Long)
Dim X As Long
Dim Y As Long
Dim Ix As Long
Dim Iy As Long
X = OffsetX
Y = OffsetY
For Ix = Int(X / [TileWidth]) To Int((X + ScreenW) / [TileWidth])
For Iy = Int(Y / [TileHeight]) To Int((Y + ScreenH) / [TileHeight])
[Draw Tile Function] Ix * [TileWidth] - OffsetX, Iy * [TileHeight] - OffSetY
Next I
End Function
I believe this would work. You would pass pixel values as the offset, as in this example:
VB Code:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|