English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 02 December 2022, 09:38   #1
nanoflite
Registered User
 
Join Date: May 2021
Location: Westerlo / Belgium
Posts: 4
Vertical scrolling troubles

Hello all! I picked up programming on the Amiga again, using AMOS... that brings back a lot of memories ;-) Amazing what some people can do with it!!!


Anyhow, I'm stuck with some simple vertical scrolling that I would like to turn into a small (skiing, racing,...?) game... The screen is 160 by 256 using 8 colors, centered in the middle. This way I want to 'mimic' the aspect ratio of a smartphone.
The scroll seems to work fine, but when the scroll reaches the top there's a distortion of some kind going on... I've figuring out what causes this.

Trying different 'Screen Display' offsets, turning on/off double buffering, but nothing helps ...
Here's a Youtube clip that shows the issue: [ Show youtube player ]


Here's the code:
Code:
Screen Open 2,320,256,8,LORES
Hide On : Flash Off : Curs Off 
Load Iff "scroll.iff"

For I=1 To 4
   Get Icon 2,I,(I-1)*8,10 To I*8,18
   Make Icon Mask I
Next 

Screen Close 2

Double Buffer : Autoback 0
Hide On 
Screen Open 0,160,256+8,8,LORES
Screen Display 0,208,,160,256
Curs Off : Flash Off : Cls 0
Get Icon Palette 

DELTA=0
Repeat 

   Screen Copy 0,0,1,160,256+8 To 0,0,0
   Cls 1,0,256+8-1 To 160,256+8

   DELTA=DELTA+1
   If DELTA>=8
      DELTA=0
      For X=0 To 160 Step 8
         Add I,1,1 To 4
         Paste Icon X,256,Rnd(3)+1
      Next 
   End If 

   Screen Swap 
   Wait Vbl 

Until Mouse Key<>0
I also attached the zip with the background image and amos file...


Any ideas of what can cause this problem and how I can solve this?
I'm running this on fs-uae on a mac... so maybe it is an emulator issue? But I hardly doubt that.



Cheers,
Johan
Attached Files
File Type: zip scroll.zip (1.7 KB, 50 views)
nanoflite is offline  
Old 04 December 2022, 01:44   #2
adrazar
Registered User
 
Join Date: Feb 2017
Location: Oslo
Posts: 90
Hi, I'm fairly sure the problem is just that you have put the Double Buffer instruction in too early - put it in after you open the new screen. You will quickly notice that this messes up the rendering though, and the reason for this is that whenever you make a change in one buffer you need to repeat the change in the next buffer to make the buffers identical. After that you can apply any new changes to the buffer and swap the screens. Getting it to work this way is simply a matter of updating the rendering code a little (I'm afraid the end result will not turn out quite as short and sweet as it is now, but with some care it could still be made quite tidy and elegant. I would recommend trying to split the task of rendering into a few Gosubs or Procedures [as a means to obtain a simple solution]).

(By the way, I realise the easiest solution is to add a line saying "Screen Copy Physic to Logic" right after Screen Swap & Wait Vbl, as this makes the buffers identical in only one line of code. In general it's not the fastest solution, but then again, why optimize before one needs to?)

Last edited by adrazar; 04 December 2022 at 20:08.
adrazar is offline  
Old 05 December 2022, 20:32   #3
nanoflite
Registered User
 
Join Date: May 2021
Location: Westerlo / Belgium
Posts: 4
Cool! Thank you for the answer. This was exactly the problem. I could however get away with only 1 screen copy, from physic to logic, combining the scroll and copy in one ;-)


Here's the new code:


Code:
Screen Open 2,320,256,8,LORES
Hide On : Flash Off : Curs Off 
Load Iff "scroll.iff"

For I=1 To 4
   Get Icon 2,I,(I-1)*8,10 To I*8,18
   Make Icon Mask I
Next 

Screen Close 2

Hide On 
Screen Open 0,160,256+8,8,LORES
Screen Display 0,208,,160,256

Double Buffer : Autoback 0

Curs Off : Flash Off : Cls 0
Get Icon Palette 

DELTA=0
Repeat 

   Screen Copy Physic,0,1,160,256+8 To Logic,0,0
   Cls 1,0,256+8-1 To 160,256+8

   DELTA=DELTA+1
   If DELTA>=8
      DELTA=0
      For X=0 To 160 Step 8
         Add I,1,1 To 4
         Paste Icon X,256,Rnd(3)+1
      Next 
   End If 

   Screen Swap 
   Wait Vbl 

Until Mouse Key<>0




Cheers,
Johan
nanoflite is offline  
Old 06 December 2022, 01:54   #4
adrazar
Registered User
 
Join Date: Feb 2017
Location: Oslo
Posts: 90
Oooh, nice!
adrazar 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
Smooth vertical scrolling in AMOS idrougge Coders. AMOS 43 21 February 2021 12:58
Vertical Scrolling by blitting outside the bitmap Shatterhand Coders. Blitz Basic 31 05 September 2019 23:52
Infinite vertical scrolling LuigiThirty Coders. Asm / Hardware 38 04 January 2017 23:25
Horizontal vs vertical scrolling Amiga1992 Coders. General 20 26 October 2015 11:15
Vertical scrolling motorcycle game.. Anyone? Thrash75 Looking for a game name ? 11 18 May 2005 19:44

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 06:51.

Top

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