• 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
I need help in something
I have a source code I am working in AMOS but I am finding very difficult to do my thing on it...and I am wondering how can I convert it from AMOS to AmiBlitz code?

' These need to be global as they're referenced within
' a couple of procedures:
' Flag indicating a valid hit:
Global FH
' Countdown timer for the "Invalid Action!" display:
Global DC

' Hide everything until we've finished drawing:
Auto View Off
Screen Open 0,320,200,32,Lowres
Curs Off
Flash Off
Colour 0,$0 : Rem Screen Background
Colour 1,$FFF : Rem Dot
Colour 2,$F00 : Rem Dat after it's been hit
' This colour represents your background IFF pic, just don't use colours
' 0 thru 2 in the picture!
Colour 3,$FF0
Colour 4,$FFF : Rem Border (so you can't select it as a dot)
Cls 0
' Centres your rectangular play area:

Ink 4
Box XO+0,0 To XO+255,167
' This bar represents your background pic:
Ink 3
Bar XO+1,1 To XO+254,166

For X=0 To 31
For Y=0 To 20
Ink 1
Bar X1-1,Y1-1 To X1+1,Y1+1
Ink 0
Box X1-2,Y1-2 To X1+2,Y1+2
Next Y
Next X
Auto View On
Screen Show 0
' There MUST be a Wait Vbl before you use Limit Mouse!
Wait Vbl
Limit Mouse X Hard(XO+0),Y Hard(0) To X Hard(XO+255),Y Hard(167)
Paper 0
Pen 1
Ink 2
FD=True : Rem Flag for First Dot hit
Wait Vbl
If DC=0
Locate 10,23
Print Chr$(7);
Dec DC
Else If DC>0
Dec DC
End If
MC=Mouse Click

If MC=%1 : Rem left mouse click
X=X Screen(X Mouse)
Y=Y Screen(Y Mouse)
If CP=1
' First dot to be hit, so no fancy checks needed:
Bell 80
Paint X,Y,2
If X1>XO : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
If Not FH
If Y1>0 : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
End If
If Not FH
If X1<XO+255 : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
End If
If Not FH
If Y1<167 : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
End If
If Not FH
' Right colour but no adjacent hit dots:
Proc _MISS
End If
End If
Else If CP=2
' Dot already hit
Proc _MISS
End If
End If
' Simple right-click to exit for this demo:
Until MC=%10

Procedure _CHECK_HIT[X,Y,X1,Y1]
' Check if the dot at X1,Y1 has been hit
' If it has, we're OK to set the one at X,Y
If Point(X1,Y1)=2
Bell 80
Paint X,Y,2
' Set the hit flag to indicate no more checking is necessary
' Without this, you'd get a trill of bells!
End If
End Proc

Procedure _MISS
' Chr$(7) clears to end of line
Locate 10,23
Print "Invalid Action!";Chr$(7);
DC=50 : Rem Set the Countdown Timer for 1 second
End Proc

You have to convert the source manually or semi-manually (find&replace). Amiblitz has a different syntax and runtime.
First of all you should decide which is your target system (OCS, AGA or RTG) and upon those you decide the runtime you are going to use. (Slices, Display or AmigaOS Screens).
Actually my target is really OCS and PAL fact I want my program to synch with 50 Hz vertical line that works only in PAL Amiga...any idea how to make that in Blitz basic? Also another question...can AmiBlitz3 work on an Amiga 500 512 KB Chip RAM with 8 MB Fast RAM on a 030 processor or that is not enough for it?
"VWait" is a command that waits until the vertical blank interrupt happens.
Amiblitz3 should run on High-End Amiga. You want to use BlitzBasic2. However, I would develop under WinUAE and only once the program is finished compile an exe under BlitzBasic2.
Is using vwait is all I need in my program? Is there any specific parameter or anything like that? So if I use vwait would the program synch to PAL mode and not work on NTSC mode or would it work in both regions?

Ones I am done with AMOS I will make all my big serious games on Blitz Basic Smile
VWait waits till the vertical blank interrupt happens, whatever screen you have open. May it be PAL, NTSC or whatsoever (productity...). This way you get your video update 100% flickerfree and smooth.
It has the amount of interrupts to wait as parameter, but usually you want to way 1 VBlank, which is the default. The AB3 online help is your friend ;-)
One final question and I will not harass you on this specific topic, what is the parameter for PAL and NTSC? Just curious.
VWait waits exactly till the next display refresh happens. It can take a parameter that waits for n display refreshs instead of just the next one.
NTSC is a function that returns -1 if the Amiga runs in NTSC, or 0 if it runs in PAL.
The display mode is set by the Slice or Display or OpenScreenTags instructions. There is however, a ForceNTSC and ForcePAL instruction that does exactly what it spells.

Hope that answers you questions. Otherwise: May the online help be with you!

Gehe zu:

Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste