English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 26 January 2020, 19:20   #1
timg
Registered User

 
Join Date: Jan 2020
Location: Saltash
Posts: 25
Parallax Scrolling

Hi guys,

I'm an old Amiga programmer (AMOS & Assembler) who's just started looking at Blitz (after 25 years away) and I need pointing the right direction for some screen set up.

I'm hoping to use AGA, with 2*16 colour dual playfields, with multi-level scrolling on one playfield (i.e. SOTB style) but DisplayScroll seems to split both layers... can you get it to apply only to one layer, or is there a different command that I've missed?
timg is offline  
Old 27 January 2020, 10:25   #2
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,723
I'm not a Blitz Basic expert, but do recall an earlier discussion about DisplayScroll and how to use it for Dual Playfield scrolling. It's over here: http://eab.abime.net/showthread.php?t=71875

The Dual Playfield discussion starts partway down the first page. As far as I can deduce from reading it, you have to pass two seperate arrays to DisplayScroll: one for the odd bitplanes and one for the even bitplanes.
roondar is online now  
Old 27 January 2020, 17:43   #3
Master484
Registered User
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 424
I have tested this command only once, but I got it to work. And here is what I have written in my notes.

The syntax for the DisplayScroll command is this:

DisplayScroll Coplist ID, &FrontPlayfieldArrayName (StartPos), &BackPlayfieldArrayName (StartPos), Offset


So make two arrays, one for Front Playfield and another one for Back Playfield. The arrays have to be of the "Quick" or ".q" type.

If you only want to parallax the Back Playfield, then simply fill the Front Playfield array with zeroes.

And the "Offset" value in the command is optional, so leave it to 0.

And the (StartPos) after the ArrayName also should be 0. This value tells the starting position from where the command starts to read your array.

---

And some other stuff from my notes:

The arrays need to have at least as many elements as the screen has Y-lines, otherwise graphics will turn into a mess.

You can have large arrays with thousands of pre-calculated values, and then use the (StartPos) to jump into different parts of the array, or "slide" through the array to make all kinds of effects.

Also the arrays can be changed in real time by putting new values to them, but this can be slow, because an array for a 200 pixel high screen has 200 elements, and Blitz is slow when it comes to arrays.

Negative values in the array move the screen to the right, and positive values move to the left. And in AGA, the values can have decimal parts like -1.5, which creates a smoother effect with the AGA sub pixel scrolling.

And the values are cumulative, so if you move the first line by 1 pixel, and then the second line also by 1 pixel, the second line will be moved 2 pixels. And if all array values after that are 0, all lines below the second will shifted by 2 pixels.

And in a single Playfield screen, have just one array, and for both playfield spots in the command you put that same array.

And CustomCops needed in the InitCoplist command is -3.
Master484 is offline  
Old 28 January 2020, 14:53   #4
timg
Registered User

 
Join Date: Jan 2020
Location: Saltash
Posts: 25
Thanks guys, it was the separation between the "odd" and "even" arrays... I hadn't realised that they related to the 2 different fields in the display!

That's a really good tip about using StartPos in the array, I was toying with the idea of having some degree of vertical movement in the scrolling (like some of the levels in Thunder Force 4 on the MegaDrive)... that may require rewriting the copper which I guess would be too slow, but having large arrays might be one route to explore, or whether you and poke values into the copperlist itself.
timg is offline  
Old 28 January 2020, 17:34   #5
Master484
Registered User
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 424
Quote:
I was toying with the idea of having some degree of vertical movement in the scrolling (like some of the levels in Thunder Force 4 on the MegaDrive)... that may require rewriting the copper which I guess would be too slow, but having large arrays might be one route to explore, or whether you and poke values into the copperlist itself.
If you just want the Back Playfield parallax effect to also scroll vertically like the sea surface does in the "clouds" level of Thunder Force 4, or like the grass field parallax moves up and down in Kid Chaos, then that should be possible with this command without any extra tricks.

Although I haven't tested this myself, but in theory, it should work like this:

Let's assume that you have a 400 pixels high bitmap that you scroll up and down, and in the bottom 50 pixels you have your parallax effect, so the parallax should only happen when pixel lines 350-400 are shown on screen.

To do this kind of thing, I think that you just need to do this:

Make an array that has 400 elements, so make it as high as your bitmap is. Then put your 50 parallax scroll values to the elements 350-400 of the array, and then fill all other values with zeroes.

And then during the game, you set the "StartPos" of the array to the same value as your bitmap's vertical scrolling value. So when you scroll the screen normally with DisplayBitmap, at the same time you update the "StartPos" value of the DisplayScroll command, and do this every frame, and the command itself should handle the rest.

At least that is how I understand this command should work.
Master484 is offline  
Old 29 January 2020, 00:36   #6
timg
Registered User

 
Join Date: Jan 2020
Location: Saltash
Posts: 25
Interesting, I will give that a try and see how it goes, I was assuming the array had to be the same height as the screen but if not that could work nice and easily.

Have to see how that command plays with the colour changing commands when it's scrolling up and down!
timg is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parallax overrated/overused? d4rk3lf Retrogaming General Discussion 49 22 January 2019 23:19
How Parallax scrolling under PC emulation? Retro1234 Retrogaming General Discussion 5 23 December 2016 11:28
Parallax scrolling layer with sprites possible? phx Coders. Asm / Hardware 21 12 July 2015 18:15
Parallax scrolling meant nothing to me until... killergorilla Amiga scene 26 12 February 2006 16:40
Parallax scrolling in DPaint (tutorial) Stein Retrogaming General Discussion 2 17 January 2006 22:18

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06594 seconds with 15 queries