SUB Subroutine Kullanımı

Alt Program Kullanımı

Windows Ekran Koruyucu Benzeri Bir Ekran Koruyucu

Subroutine Yazım Ekranı:

SUB Subroutine Kullanımı

DECLARE SUB YAZICI (x!, y!)
CLS

RANDOMIZE TIMER

DO
     
   xRast = INT(RND * 80)
   yRast = INT(RND * 24)


   CALL YAZICI(xRast, yRast)
   SLEEP 1
   CLS

LOOP

SUB YAZICI (x, y)
LOCATE y, x: PRINT "============================"
LOCATE y + 1, x: PRINT "=========MERHABA============"
LOCATE y + 2, x: PRINT "============================"
END SUB

 

 SUB Subroutine Kullanımı

Ekranda Ok Tuşlarıyla Hareket Edebilen Bir Robot

DECLARE SUB Kafa (x!, y!)
DECLARE SUB Govde (x!, y!)
DECLARE SUB AyakSol (x!, y!)
DECLARE SUB AyakSag (x!, y!)
DECLARE SUB KolSol (x!, y!)
DECLARE SUB KolSag (x!, y!)
DECLARE SUB Robot (x!, y!)
CLS


x = 50
y = 10

DO

  SELECT CASE INKEY$

    CASE CHR$(0) + CHR$(77)
      x = x + 1
      CLS
    CASE CHR$(0) + CHR$(75)
      x = x - 1
      CLS
    CASE CHR$(0) + CHR$(72)
      y = y - 1
      CLS
    CASE CHR$(0) + CHR$(80)
      y = y + 1
      CLS

    'Ikinci Robot ve savas

  END SELECT

  CALL Robot(x, y)
  'PRINT x, y


LOOP

SUB AyakSag (x, y)

x = x + 4
CALL AyakSol(x, y)
x = x - 4

END SUB

SUB AyakSol (x, y)

LOCATE y + 5, x - 2: PRINT "▒"
LOCATE y + 6, x - 2: PRINT "▒"
LOCATE y + 7, x - 2: PRINT "▒"
LOCATE y + 8, x - 2: PRINT "▒"
LOCATE y + 9, x - 2: PRINT ""

END SUB

SUB Govde (x, y)

LOCATE y, x - 3: PRINT "▒▒▒▒▒▒▒"
LOCATE y + 1, x - 3: PRINT "▒▒▒▒▒▒▒"
LOCATE y + 2, x - 3: PRINT "▒▒▒▒▒▒▒"
LOCATE y + 3, x - 3: PRINT "▒▒▒▒▒▒▒"
LOCATE y + 4, x - 3: PRINT "▒▒▒▒▒▒▒"


END SUB

SUB Kafa (x, y)

LOCATE y - 3, x - 2: PRINT " ▒▒▒ "
LOCATE y - 2, x - 2: PRINT "▒▒▒▒▒"
LOCATE y - 1, x - 2: PRINT " ▒▒▒ "

END SUB

SUB KolSag (x, y)

LOCATE y, x + 4: PRINT "▒"
LOCATE y + 1, x + 5: PRINT "▒"
LOCATE y + 2, x + 5: PRINT "▒"
LOCATE y + 3, x + 5: PRINT "▒"
LOCATE y + 4, x + 5: PRINT "▒"
LOCATE y + 5, x + 5: PRINT ""

END SUB

SUB KolSol (x, y)

LOCATE y, x - 4: PRINT "▒"
LOCATE y + 1, x - 5: PRINT "▒"
LOCATE y + 2, x - 5: PRINT "▒"
LOCATE y + 3, x - 5: PRINT "▒"
LOCATE y + 4, x - 5: PRINT "▒"
LOCATE y + 5, x - 5: PRINT ""

END SUB

SUB Robot (x, y)

 
 CALL Kafa(x, y)
 CALL Govde(x, y)
 CALL AyakSol(x, y)
 CALL AyakSag(x, y)
 CALL KolSol(x, y)
 CALL KolSag(x, y)

END SUB

 

SUB Subroutine Kullanımı

 

Rastgele Noktalarda Çiçek Açan Kodlar

DECLARE SUB Buyume5 (x!, y!)
DECLARE SUB Buyume4 (x!, y!)
DECLARE SUB Buyume3 (x!, y!)
DECLARE SUB Buyume2 (x!, y!)
DECLARE SUB Buyume1 (x!, y!)
DECLARE SUB Cicek (x!, y!)
DECLARE SUB Beklet ()
CLS

DO

  XRast = INT(RND * 79) + 1
  YRast = INT(RND * 19) + 5

  CALL Cicek(XRast, YRast)


LOOP WHILE INKEY$ <> CHR$(27)

SUB Beklet
FOR k = 1 TO 1000000
NEXT
END SUB

SUB Buyume1 (x, y)


LOCATE y, x: PRINT ""


END SUB

SUB Buyume2 (x, y)

LOCATE y - 1, x: PRINT " "
LOCATE y, x: PRINT ""
LOCATE y + 1, x: PRINT " "

END SUB

SUB Buyume3 (x, y)

LOCATE y - 1, x: PRINT " "
LOCATE y, x: PRINT "   "
LOCATE y + 1, x: PRINT " "


END SUB

SUB Buyume4 (x, y)

LOCATE y - 2, x: PRINT " "
LOCATE y - 1, x: PRINT "    "
LOCATE y, x: PRINT " "
LOCATE y + 1, x: PRINT "    "
LOCATE y + 2, x: PRINT " "


END SUB

SUB Buyume5 (x, y)

LOCATE y - 2, x: PRINT "
LOCATE y - 1, x: PRINT "   "
LOCATE y, x: PRINT "    "
LOCATE y + 1, x: PRINT "   "
LOCATE y + 2, x: PRINT "


END SUB

SUB Cicek (x, y)


CALL Buyume1(x, y)
CALL Beklet
CALL Buyume2(x, y)
CALL Beklet
CALL Buyume3(x, y)
CALL Beklet
CALL Buyume5(x, y)
CALL Beklet
CALL Buyume4(x, y)
CALL Beklet

END SUB

SUB Subroutine Kullanımı

Yorumunuzu Ekleyin

Yükleniyor...