Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
I need help in something
#1
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:
XO=(320-256)/2

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
X1=X*8+4+XO
Y1=Y*8+4
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
DC=-1
FD=True : Rem Flag for First Dot hit
Repeat
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)
CP=Point(X,Y)
If CP=1
FH=False
If FD
' First dot to be hit, so no fancy checks needed:
Bell 80
Paint X,Y,2
FH=True
FD=False
Else
X1=X-8
Y1=Y
If X1>XO : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
If Not FH
X1=X
Y1=Y-8
If Y1>0 : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
End If
If Not FH
X1=X+8
Y1=Y
If X1<XO+255 : Proc _CHECK_HIT[X,Y,X1,Y1] : End If
End If
If Not FH
X1=X
Y1=Y+8
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!
FH=True
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
Boom
End Proc

Edit
Zitieren


Nachrichten in diesem Thema

Gehe zu:


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