English Amiga Board


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

 
 
Thread Tools
Old 20 March 2021, 05:29   #1
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
the bob does not appear at the given position

hello again! I am trying to write the first level of my game: title picture, menu, info, map scrolling, map in txt, icons are ready and working perfectly but ... when I try to add bobs they are not displayed on the map I don't know why. sprites ( in 4 colors) are visible. can anyone help me with this problem? what and where do I have to insert for this devilish plane to appear. simple bob 1,100,100,1 also doesn't work ?, I'd like to add a bob to the bottom of the screen (for example at 160x160) and add a joystick control and that's it. pls help
Set Buffer 32
sciezka$="mapapoziom1.txt"
Screen Open 0,320,512+32,16,Lowres
Screen Hide : Curs Off : Flash Off : Cls 0 : Colour Back $F : Hide : Screen Show
Screen Display 0,135,50,320,256
Screen 0
MAPA=450
Dim MAP(9,mapa)
Global MAPA,JAG_X,JAG_Y,FI_X,FI_Y,SK_Y,MAP(),VROW,VPOS,_DRAWX,_DRAWY,sciezka$
INICJALIZACJA
WKLEJANIEIKONEK
Procedure INICJALIZACJA
RYSOWANIEMAPY
JAG_X=160-8 : JAG_Y=256-32
FI_X=100 : FI_Y=10
SK_Y=256+32
VROW=8
VPOS=MAPA-1
_DRAWX=0 : _DRAWY=8
End Proc
Procedure RYSOWANIEMAPY
LADUJTEXT
Load "ikonki.abk"
Load "samoloty1.abk"
Get Icon Palette
For Y=0 To 449
For X=0 To 9
If MAP(X,Y)=0 Then MAP(X,Y)=1
Next X
Next Y
Y=mapa-1-(512/32)
For V=0 To 512 Step 32
For X=0 To 9
Paste Icon X*32,V,MAP(X,Y)
Next X
Inc Y
Next V
End Proc
Procedure LADUJTEXT
Open In 1,SCIEZKA$
For Y=0 To 449
Line Input #1,ROW$
For X=0 To 9
CELL$=Mid$(ROW$,X*3,3)
MAP(X,Y)=Val(CELL$)
Next X
Next Y
Close 1
End Proc
Procedure WKLEJANIEIKONEK
Repeat
WEJSCIE
If SK_Y>0 Then Screen Offset 0,0,SK_Y Else RESETSCREEN
Wait Vbl
If SK_Y>256-64
If _DRAWY=>0
Paste Icon 32*_DRAWX,32*_DRAWY,MAP(_DRAWX,VPOS-VROW)
Paste Icon 32*_DRAWX+32,32*_DRAWY,MAP(_DRAWX+1,VPOS-VROW)
End If
End If
If SK_Y<160
If _DRAWY>8
Paste Icon 32*_DRAWX,32*_DRAWY,MAP(_DRAWX,VPOS-VROW)
Paste Icon 32*_DRAWX+32,32*_DRAWY,MAP(_DRAWX+1,VPOS-VROW)
End If
End If
_BOBKI
Until Mouse Key
Edit
End Proc
Procedure RESETSCREEN
SK_Y=256+32
VROW=8
_DRAWX=0 : _DRAWY=8
Screen Offset 0,0,SK_Y
End Proc
Procedure WEJSCIE
Dec SK_Y
Dec SK_Y
If _DRAWX<7
Inc _DRAWX
Inc _DRAWX
Else
_DRAWX=0
Dec _DRAWY
Inc VROW
End If
If SK_Y=100
_DRAWX=0
VROW=0
_DRAWY=16
VPOS=VPOS-9
End If
If SK_Y mod 32=0
'Bell 22
End If
End Proc
Procedure _BOBKI
bob 1,JAG_X,JAG_Y,1
End Proc
tomek is offline  
Old 20 March 2021, 15:41   #2
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
Hello!

Use sprites with HW coordinates, Bobs with screen coordinates.
If I understand...the screen size 320x512, visible screen is 320x256 with an offset (SK_Y), then the vertical bob coordinate sholud be JAG_Y+SK_Y?

Bob 1,JAG_X,JAG_Y+SK_Y,1

Last edited by sovenyimre; 20 March 2021 at 15:47.
sovenyimre is offline  
Old 21 March 2021, 14:21   #3
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
great!!
thank you. you solved my problem but i have a request. There is something wrong with the code for pasting icons. unless I'm wrong, the code splits the screen into two halves and pastes the icons to the half of the screen and to the half of the screen to increase speed. this generates a lot of graphical errors. is it possible to change these 4 lines (with paste icon in the "WKLEJANIEIKONEK" procedure) into one simple "paste icon" ?? I tried to change it but sometimes the simple things are the hardest
tomek is offline  
Old 23 March 2021, 23:15   #4
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
I don't fully understand the 2x2 paste icon problem, but try
Paste Icon 32*(SK_Y mod 32),32*_DRAWY,MAP(SK_Y mod 32,VPOS-VROW)
Maybe I better understand with a screenshot.
If the goal is to draw whole area of icons with a single command, then I recommend to use TOME extension. It is extremely simple and even has an editor. With it you can draw whole (ICON based) terrain (one tile or a raw or areas) with a simple command. Very useful for TILE based games/maps, but not only for maps. If you want more, you can also the same map of icons the TURBOPlus 2.15 extension, which has its own icon drawer, with that you can draw icons one by one, but it also draws TOME maps (called Scenes) and even faster than Tome. The usage is almost the same as you do, MAP(x,y) --> Map Tile(x,y)....I use these two in Project Horizon and it is very simple and fast.

What type of errors?
If you see graphics errors, it may be because of moving a BOB on top of ICONs, the auto restore system allways stores and restores the area below it. Stores pattern that is below the BOB when it is placed (appeared there), so if you drop/draw an icon under the BOB and then move the BOB, then the auto-system is restoring to the state was before the icon was drawn, not that the icon you last drew there.

If you want speed, I can suggest ...
-Use "No Icon Mask" (..if you can)
-Use TURBOPlus 2.15 for Icon draw (F Paste Icon x,y,icon) Generally 2-3.5 times faster than the AMOS.
-If you dont use draw commands then it will be much faster with "Autoback 0" after screen open

Last edited by sovenyimre; 24 March 2021 at 13:46.
sovenyimre is offline  
Old 24 March 2021, 16:16   #5
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
you are amos god to me. it almost works but I don't know what to type and it copies the first screen all the time and errors with bobs still occur. I don't know if I can make it, I'm better at graphics than programming. I have everything ready for level one, icons, bobs, menus, even sounds, but I'm stuck with a screen scroller ughh.
tomek is offline  
Old 24 March 2021, 20:50   #6
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
Now realized that the code+abk+map is present in an other thread.
Still not sure how that bob errors occure, but I tried to put in something what coud help.
The HW scroll step is 2 by original. That's why the 2+2 paste Icon was necssery.
I changed the step to 1 pixel to reduce the paste Icon part to 1+1. (slower but fluid scroll)

Set Buffer 32
Screen Open 0,320,512+32,16,Lowres
Curs Off : Flash Off : Cls 0 : Hide On
Screen Display 0,135,50,320,256
Autoback 0
Auto View Off
Bob Update Off
Sprite Update Off

SCIEZKA$="mapapoziom1.txt"
MAPA=450
Dim MAP(9,MAPA)
Global MAPA,JAG_X,JAG_Y,FI_X,FI_Y,SK_Y,MAP(),VROW,VPOS,_DRAWX,_DRAWY,SCIEZKA$

INICJALIZACJA
WKLEJANIEIKONEK

Procedure INICJALIZACJA
RYSOWANIEMAPY
JAG_X=160-8 : JAG_Y=256-32
SK_Y=256+32
VROW=8
VPOS=MAPA-1
_DRAWX=0 : _DRAWY=8
End Proc

Procedure RYSOWANIEMAPY
LADUJTEXT
Load "ikonki.abk"
Load "samoloty1.abk"
Get Icon Palette
No Icon Mask

For Y=0 To(MAPA-1)
For X=0 To 9
If MAP(X,Y)=0 Then MAP(X,Y)=1
Next X
Next Y

Y=MAPA-1-(512/32)
For V=0 To 512 Step 32
For X=0 To 9
Paste Icon X*32,V,MAP(X,Y)
Next X
Inc Y
Next V
End Proc

Procedure LADUJTEXT
Open In 1,SCIEZKA$
For Y=0 To(MAPA-1)
Line Input #1,ROW$
For X=0 To 9
CELL$=Mid$(ROW$,X*3,3)
MAP(X,Y)=Val(CELL$)
Next X
Next Y
Close 1
End Proc

Procedure WKLEJANIEIKONEK
Repeat
WEJSCIE

If SK_Y>256-64
If _DRAWY=>0
Paste Icon 32*_DRAWX,32*_DRAWY,MAP(_DRAWX,VPOS-VROW)
Rem Paste Icon 32*_DRAWX+32,32*_DRAWY,MAP(_DRAWX+1,VPOS-VROW)
End If
End If

If SK_Y<160
If _DRAWY>8
Paste Icon 32*_DRAWX,32*_DRAWY,MAP(_DRAWX,VPOS-VROW)
Rem Paste Icon 32*_DRAWX+32,32*_DRAWY,MAP(_DRAWX+1,VPOS-VROW)
End If
End If

_BOBKI
If SK_Y>0 Then Screen Offset 0,0,SK_Y Else RESETSCREEN
Bob Update : Sprite Update : Wait Vbl : Screen Swap : View

Until Mouse Key
Edit
End Proc

Procedure RESETSCREEN
SK_Y=256+32
VROW=8
_DRAWX=0 : _DRAWY=8
Screen Offset 0,0,SK_Y
End Proc

Procedure WEJSCIE
Add SK_Y,-1 : Rem -1 FOR FLUID SCROLL, ORIGINAL WAS -2
If _DRAWX<9 : Rem 9 FOR FLUID SCROLL, ORIGINAL WAS 7
Add _DRAWX,1
Else
_DRAWX=0
Dec _DRAWY
Inc VROW
End If

If SK_Y=100
_DRAWX=0
VROW=0
_DRAWY=16
VPOS=VPOS-9
End If

If SK_Y mod 32=0
'Bell 22
End If


If Jleft(1) and JAG_X>0 Then Dec JAG_X
If Jright(1) and JAG_X<320 Then Inc JAG_X
If Jup(1) and JAG_Y>0 Then Dec JAG_Y
If Jdown(1) and JAG_Y<256 Then Inc JAG_Y
If Fire(1) : End If
If Key State(69) : Edit : End If
End Proc

Procedure _BOBKI
Bob 1,JAG_X+SK_X,JAG_Y+SK_Y,1
End Proc

Last edited by sovenyimre; 25 March 2021 at 12:48.
sovenyimre is offline  
Old 25 March 2021, 18:08   #7
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
thank you for your help and your time, but even after adding these lines, the first screen is looped, the ten icons is scrolling, and then it's reset and all over again. bob displays correctly but flashes sometimes, especially at the top of the screen. I guess I'll leave this program for later after I get to know Amos a little better. Can I ask for help about the second scroller that I found in the book "ultimate-amos-1994-holborn" which also works cool, I managed to extend the length to over 200 icons and this is not the end but as usual I have a problem with pasting the bob.
Dim LEVELMAP (6, 8 0)
SCRPOINTER= O : BLOCKPOINTER= O : LEVELSIZE=O
BLOCKNUM= O : SCRLCOUNTER= O
Global SCRPOINTER, BLOCKPOINTER, LEVELMAP (), LEVELSIZE
Global XDATA, BLOCKNUM, SCRLCOUNTER , X , Y, BLOCK
INIT
INITSCROLL
Repeat
SCROLLSCREEN
Wait Vbl
until BLOCKPOINTER=LEVELSI ZE
End
Procedure INIT
Read LEVELSIZE
For A=O To 5
For B=O To LEVELSIZE
Read LEVELMAP (A, B)
Next B
Next A
Rem *** Level 1 ( 1280x200) data
Data 39
STRIP1 :
Data 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1
Data 1, 1, 1 , 1 , 1 , 1 , 1 , 1, 1, 1
Data 1, 1, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
Data 1, 1, 1, 1, 1 , 1 , 1 , 1, 1, 1
STRIP2 :
Data 1, 1, 1 , 1 , 1 , 1 , 1 , 1, 1, 1
Data 1 , 1, 1, 1 , 1 , 1 , 1 , 1, 1, 1
Data 1 , 1, 1, 3,15,15 , 15,5, 1 ,1
Data 1, 1, 1, 1 , 1, 1 , 1 , 1, 1 ,1
STRIP3 :
Data 1, 1, 1, 1 , 1, 1 , 1 , 1, 1, 1
Data 1, 1, 1, 1, 1 , 1, 1, 1 , 1 , 1
Data 1 , 1 ,2,14,14 , 14,14 , 14 , 6 ,1
Data 1, 1, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
STRIP4 :
Data 1 , 1, 1, 1 ,3,18 , 15, 1 5 , 5,1
Data 1, 1, 1, 1 , 1 , 1 , 1 , 1 , 1 , 1
Data 1 , 2 , 14 , 14 , 14 , 14,14 , 14 , 14 , 1 0
Data 16, 1 6 , 17,5,1 , 1, 1, 1 ,1,1
STRIPS :
Data 1 , 1 ,1,2,14,14 , 14 , 14,14 , 7
Data 16, 5 , 1, 1, 1, 1 , 1, 1 ,3,18
Data 9 , 14 , 14 , 14 , 14 , 14 , 14,14 , 14 , 14
Data 14 , 14 , 14 , 14 , 1 0 , 15 , 15 , 15,5 , 1
STRIP6 :
Data 4 , 4,9,14 , 14 , 14 , 14,14 , 14 , 14
Data 14 , 14,7,4,17,15,15,9, 14 , 14
Data 14 , 14 , 14 , 14 , 14 , 14,14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14 , 14,14 , 14
Data 14 , 14 , 14 , 14,14 , 14,14 , 14 , 14 , 14 , 14 , 14,14 , 14 , 14,14 , 14,7
End Proc
Procedure INITSCROLL
Screen Open 7,640, 4 0 , 1 6,Lowres
Flash Off : Curs Off : Cls °
Load Iff IIAMOSBOOK : Pictures/ScroI IBlocks . IFFII
S creen Hide 7
Screen Open 0 , 736, 1 9 2,1 6,Lowres
Flash Off : Curs Off : Cls °
Screen Display 0,128,48, 320 , 2 00
Screen Offset 0 , 3 2,0
Get Palette 7
Screen Hide °
SCRPOINTER=32
XDATA=O
BLOCKPOINTER=XDATA+10
For A= O To 5
For B=O To 9
BLOCK=LEVELMAP (A, XDATA+B )
X=SCRPOINTER+ ( B*32 )
Screen Copy 7, ( BLOCK- 1 ) * 3 2,0,BLOCK* 3 2,3 2 To 0 , X , A*32
Next B
Next A
BSTRIP=SCRPOINTER-32
FSTRIP=SCRPOINTER* ll
For A=O To 5
BLOCK=LEVELMAP (A, BLOCKPOINTER)
Screen Copy 7, ( BLOCK-l) * 3 2 , O,BLOCK* 3 2,3 2 To O , BSTRIP , A*32
Screen Copy 7, ( BLOCK-l) * 3 2 , O,BLOCK* 3 2,3 2 To O , FSTRIP , A*32
Next A
Screen Show 0
End Proc
Procedure SCROLL SCREEN
If SCRPOINTER=352 Then SCRPOINTER= O
If SCRLCOUNTER< 12
If BLOCKNUM<6
X=SCRPOINTER+320
Y=BLOCKNUM* 32
BLOCK=LEVELMAP ( BLOCKNUM , BLOCKPOINTER )
Else
X=SCRPOINTER-32
Y= ( BLOCKNUM- 6) *32
BLOCK=LEVELMAP ( BLOCKNUM- 6 , BLOCKPOINTER )
End If
Screen Copy 7, ( BLOCK-l) * 3 2 , O,BLOCK* 3 2,3 2 To O,X,Y
Inc BLOCKNUM
Else
End If
Screen Offset O , SCRPOINTER+SCRLCOUNTER ,O
Inc SCRLCOUNTER
If SCRLCOUNTER=32
SCRLCOUNTER= O
SCRPOINTER=SCRPOINTER+32
Ine BLOCKPOINTER
BLOCKNUM= O
End If
End Proc
I copied the code from the book so there may be errors
tomek is offline  
Old 25 March 2021, 19:57   #8
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
ok I pasted a bob but I have a problem with the control. the next problem are the colors of the bob. bob is taken from the bank samoloty1.abk and the icons from the iff file. I have the command get palette 7 - the icons are displayed correctly but the bob is not and it is pink and not brown and is blinking. changing the palette to get bob palette gives nothing
tomek is offline  
Old 25 March 2021, 20:06   #9
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
and as usual, the bob is flashing at the top and not at the bottom
tomek is offline  
Old 25 March 2021, 21:12   #10
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
- The code is working if you correct it, ...since it is a copy-paste. O=0
- Flicker could happen for many reasons. If You put these line AFTER screen offset... in procedure _SCROLLSCREEN
Bob 1,160+SCRPOINTER+SCRCOUNTER,100,1
Works for me, no flickering. It matters where it is, but since AMOS auto update the screen by default, it coud flicker anyway any time. I recommend to use the Manual update.
- On one screen you have only one palette! and the icons and Bobs are using the same palette! Sprites colors are independent from the palette
- You can set/get the palette from Icon or Bob bank with "Get Bob Palette" or "Get Icon Palette"
- The code use screen copy, and it is not only slower than the paste icon in up-down scroller, but could couse cleanup corruption under the bob combined with screen copy and screen offset.
sovenyimre is offline  
Old 26 March 2021, 05:26   #11
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
thanks for the answers, I have no more questions, I will keep trying
tomek is offline  
Old 29 March 2021, 21:53   #12
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
Following your lead, I tried amos tome, as a scroll I took a sample program from the tome disk and put my icons and objects there. finally everything works fantastic, no blinking and skipping but I don't know how to write control to bob 1, the previous methods don't work, I'm sending 2 pictures with the program. I am asking for help again because those bobs would finish me off
Attached Thumbnails
Click image for larger version

Name:	P1460527.jpg
Views:	145
Size:	305.3 KB
ID:	71467   Click image for larger version

Name:	P1460528.jpg
Views:	125
Size:	256.3 KB
ID:	71468  
tomek is offline  
Old 30 March 2021, 09:08   #13
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
I corrected again as it was in the original code and unfortunately the bob is flashing, why the previous bob is not flashing and mine is flashing, I just replaced the bob
tomek is offline  
Old 01 April 2021, 18:35   #14
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
I can test it for you but please put here the full code in text format.
sovenyimre is offline  
Old 02 April 2021, 10:51   #15
tomek
Registered User
 
Join Date: Feb 2021
Location: poland
Posts: 18
sorry my mistake, i found an error, fixed it and it works fine, it's not super smooth but it works, no flashing and no graphic errors. finally. thx
tomek 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
Bomber Bob ransom1122 request.Old Rare Games 61 25 September 2020 19:07
Show BOB geldo79 Coders. Asm / Hardware 23 12 October 2019 20:47
Bob's Bad Day - ... no Bob. AB Positive support.Games 5 16 May 2009 01:45
Bob's Bad Twistin'Ghost Retrogaming General Discussion 3 06 February 2002 13:50
Bomber Bob Tim Janssen request.Old Rare Games 2 07 January 2002 16:16

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 01:40.

Top

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