
PureBASIC and scrolling
Re: 2D Scrolling (Tiles) Eingine examples
Thank you Rings!
Re: Where can I get the <Programming 2D scrolling games>?
@DemivecDemivec wrote:@Olliv: Here is a small adjustment needed for the example posted for large view screens. I present it merely to keep your example working and hopefully it is not considered an irritant.
It is presented in two parts to avoid posting all the intervening codeThis portion modifies only the line at the start of the inner display loop with YS3 (changing 'Dh' to 'Dh2').Code: Select all
Wi = 32 He = 32 OpenScreen(Dw, Dh, Dd, "") ;Add the following lines to test if screen is larger vertically than needed and set maxheight 'Dh2' appropriately If Dh > ((He - 1) * 32) Dh2 = ((He - 1) * 32) Else Dh2 = Dh EndIf
The difference is shown in two thumbnails, the left one is before the change.Code: Select all
For XS3 = 0 - 32 To Dw - 1 Step 32 For YS3 = 0 To Dh2 - 1 Step 32 ; <== use maxheight based on screen and map size ;Debug Str(XS3 / 32 + OffsetTileX) + "; " + Str(YS3 / 32) XX = XS3 / 32 + OffsetTileX If XX => 0 Tile = Tile(XX, YS3 / 32) If Tile DisplaySprite3D(Tile, XS3 + OffsetX, YS3) EndIf EndIf Next Next
![]()
Well... Excuse me if come back again to you, but I understand nothing about your last observation.
I have two questions I hope you have time to answer:
1) What are the conditions of your last observation?
> Only for unidirectionnal scrolling (just vertical or just horizontal)? Or for multi-directionnal scrolling?
2) Is the left picture really what you see on your computer? Or is it a representative (symbolic) picture which announces a possible bug depending the specific dimensions on different computers?
Thank you.
Ollivier
Re: Where can I get the <Programming 2D scrolling games>?
1: It is for your horizontal scrolling example only. The simple fix I posted could be improved further by possibly centering the map vertically on the visible screen.Olliv wrote:![]()
@Demivec
Well... Excuse me if come back again to you, but I understand nothing about your last observation.
I have two questions I hope you have time to answer:
1) What are the conditions of your last observation?
> Only for unidirectionnal scrolling (just vertical or just horizontal)? Or for multi-directionnal scrolling?
2) Is the left picture really what you see on your computer? Or is it a representative (symbolic) picture which announces a possible bug depending the specific dimensions on different computers?
2: Yes. I have a larger screen view than you did and thus I see the map repeating (with an offset column) to fill the larger screen view. The same would happen if the map being used had been narrower than the screen.