• Print

Author Topic: TheAggressor!  (Read 119 times)

Prithak

  • Jr. Member
  • **
  • Posts: 98
  • Programmer: A machine turns Coffee into Code.
TheAggressor!
« on: April 30, 2018, 05:24:35 am »
This game is really simple and I made it for fun!

Zip File in The Attachment!

Code: [Select]
_TITLE "TheAggressor - Prithak Adhikari"
SCREEN _NEWIMAGE(800, 600, 32)
i& = _LOADIMAGE("TheAggressor/icon.png")

IF i& < -1 THEN

    _ICON i&

    _FREEIMAGE i&

END IF
DIM CenterX AS INTEGER
DIM Centery AS INTEGER

DIM x AS INTEGER
DIM y AS INTEGER

DIM char1 AS LONG
DIM char2 AS LONG
DIM char3 AS LONG
DIM vil1 AS LONG
DIM vil2 AS LONG
DIM vil3 AS LONG
DIM vil4 AS LONG
current_address$ = _CWD$
char1 = _LOADIMAGE("TheAggressor/Characters/Char_no_1.png")
char2 = _LOADIMAGE("TheAggressor/Characters/Char_no_2.png")
char3 = _LOADIMAGE("TheAggressor/Characters/Char_no_3.png")
vil1 = _LOADIMAGE("TheAggressor/Characters/Vil_no_1.png")
vil2 = _LOADIMAGE("TheAggressor/Characters/Vil_no_2.png")
vil3 = _LOADIMAGE("TheAggressor/Characters/Vil_no_3.png")
vil4 = _LOADIMAGE("TheAggressor/Characters/Vil_no_4.png")

GOTO load
shop:
CHDIR current_address$
CLS
PRINT "1) Score Multiplyer"
PRINT "Cost: 30 SitCoins"
PRINT "2) Prash"
PRINT "Cost: 10 SitCoins"
PRINT "3) Soku"
PRINT "Cost: 60 SitCoins"
INPUT "Enter Dedicated Number To Buy Something."; ch
IF ch = 1 THEN
    IF _FILEEXISTS("coin.dat") THEN
        OPEN "coin.dat" FOR INPUT AS #1
        INPUT #1, coin
        CLOSE #1
        IF coin < 30 THEN
            PRINT "You Don't Have Enough Coins.."
            SLEEP
            GOTO load
        ELSE
            PRINT "You Bought Score_Multiplyer!!"
            OPEN "coin.dat" FOR OUTPUT AS #1
            PRINT #1, coin - 30
            coin = coin - 30
            CLOSE #1
            OPEN "C:/TheAggressor/score_multiplyer.dat" FOR OUTPUT AS #1
            PRINT #1, "TRUE"
            CLOSE #1
        END IF

    ELSE
        PRINT "You Don't Have any SitCoins."
        SLEEP
        GOTO load
    END IF
END IF
IF ch = 2 THEN
    IF _FILEEXISTS("coin.dat") THEN
        OPEN "coin.dat" FOR INPUT AS #1
        INPUT #1, coin
        CLOSE #1
        IF coin < 10 THEN
            PRINT "You Don't Have Enough Coins.."
            SLEEP
            GOTO load
        ELSE
            PRINT "You Bought Prash!!"
            OPEN "coin.dat" FOR OUTPUT AS #1
            PRINT #1, coin - 10
            coin = coin - 10
            CLOSE #1
            OPEN "C:/TheAggressor/prash.dat" FOR OUTPUT AS #1
            PRINT #1, "TRUE"
            CLOSE #1
        END IF

    ELSE
        PRINT "You Don't Have any SitCoins."
        SLEEP
        GOTO load
    END IF
END IF
IF ch = 3 THEN
    IF _FILEEXISTS("coin.dat") THEN
        OPEN "coin.dat" FOR INPUT AS #1
        INPUT #1, coin
        CLOSE #1
        IF coin < 100 THEN
            PRINT "You Don't Have Enough Coins.."
            SLEEP
            GOTO load
        ELSE
            PRINT "You Bought SOKU!!"
            OPEN "coin.dat" FOR OUTPUT AS #1
            PRINT #1, coin - 100
            coin = coin - 100
            CLOSE #1
            OPEN "C:/TheAggressor/soku.dat" FOR OUTPUT AS #1
            PRINT #1, "TRUE"
            CLOSE #1
        END IF

    ELSE
        PRINT "You Don't Have any SitCoins."
        SLEEP
        GOTO load
    END IF
END IF


load:
IF _DIREXISTS("C:/TheAggressor") THEN
    CHDIR "C:/TheAggressor"
ELSE
    MKDIR "C:/TheAggressor"
    CHDIR "C:/TheAggressor"
END IF

IF _FILEEXISTS("Resolution.dat") THEN
    OPEN "Resolution.dat" FOR INPUT AS #1
    INPUT #1, wid
    INPUT #1, hei
    CLOSE #1
    SCREEN _NEWIMAGE(wid, hei, 32)
ELSE
    OPEN "Resolution.dat" FOR OUTPUT AS #1
    PRINT #1, 800
    PRINT #1, 600
    PRINT #1, "Higher Resolution = More Amount of Computer Speed Required."
    PRINT #1, "Minimum Resolution = 800(wid), 600(hei)"
    CLOSE #1
END IF
IF _FILEEXISTS("Score_Multiplyer.dat") THEN
    OPEN "Score_Multiplyer.dat" FOR INPUT AS #1
    INPUT #1, sm.unlocked$
    CLOSE #1
ELSE
END IF
IF _FILEEXISTS("save.dat") THEN
    OPEN "save.dat" FOR INPUT AS #1
    INPUT #1, lvl1.done$
    INPUT #1, lvl2.done$
    INPUT #1, lvl3.done$
    INPUT #1, lvl4.done$
    INPUT #1, lvl5.done$
    CLOSE #1
ELSE
    OPEN "save.dat" FOR OUTPUT AS #1
    PRINT #1, "FALSE"
    PRINT #1, "FALSE"
    PRINT #1, "FALSE"
    PRINT #1, "FALSE"
    PRINT #1, "FALSE"
    CLOSE #1
    lvl1.done$ = "FALSE"
    lvl2.done$ = "FALSE"
    lvl3.done$ = "FALSE"
    lvl4.done$ = "FALSE"
    lvl5.done$ = "FALSE"
END IF
IF _FILEEXISTS("selectchar.dat") THEN
    OPEN "selectchar.dat" FOR INPUT AS #1
    INPUT #1, thechar$
    CLOSE #1
ELSE
    OPEN "selectchar.dat" FOR OUTPUT AS #1
    PRINT #1, "NULL"
    CLOSE #1
    thechar$ = "NULL"
END IF
IF _FILEEXISTS("save.dat") THEN
    OPEN "save.dat" FOR INPUT AS #1
    INPUT #1, lvl1.done$
    INPUT #1, lvl2.done$
    CLOSE #1
    IF lvl2.done$ = "TRUE" THEN
        OPEN "sakrot.dat" FOR OUTPUT AS #1
        PRINT #1, "TRUE"
        CLOSE #1
    END IF
END IF
CenterX = _WIDTH / 2
Centery = _HEIGHT / 2
GOTO menu
DO
    k$ = UCASE$(INKEY$)

    _PRINTSTRING (CenterX - 50, Centery - 50), "TheAggressor"

    _PRINTSTRING (CenterX - 50, Centery), "Loading..."

    _DISPLAY: _DELAY 2
    EXIT DO
LOOP
menu:
COLOR _RGB32(0, 0, 0)
COLOR , _RGB32(227, 227, 233)

CLS
DO
    DO WHILE _MOUSEINPUT
        k$ = UCASE$(INKEY$)

        _PRINTSTRING (CenterX - 50, 0), "TheAggressor"
        _PRINTSTRING (CenterX - 50, 100), "Press Your Way to VICTORY!!!"
        _PRINTSTRING (CenterX - 50, 200), "Press 'S' To GO To Shop"
        _PRINTSTRING (CenterX - 50, 215), "Press 'C' To Select Character!"

        LINE (CenterX - 50, Centery - 50)-(CenterX + 30, Centery + 30), _RGB32(100, 220, 255), BF
        LINE (CenterX - 50, Centery - 50)-(CenterX + 30, Centery + 30), _RGB32(0, 0, 0), B

        LINE (CenterX + 200, Centery + 200)-(CenterX + 300, Centery + 300), _RGB32(100, 220, 255), BF
        LINE (CenterX + 200, Centery + 200)-(CenterX + 300, Centery + 300), _RGB32(0, 0, 0), B

        IF k$ = "S" THEN GOTO shop
        IF k$ = "C" THEN GOTO char
        COLOR , _RGB32(100, 220, 255): _PRINTSTRING (CenterX + 210, Centery + 250), "Resolution"
        mx = _MOUSEX
        my = _MOUSEY
        mb = _MOUSEBUTTON(1)
        IF mx >= CenterX - 50 AND mx <= CenterX + 30 AND my >= Centery - 50 AND my <= Centery + 30 AND mb = -1 THEN
            GOTO game
        END IF
        IF mx >= CenterX + 200 AND mx <= CenterX + 300 AND my >= Centery + 200 AND my <= Centery + 300 AND mb = -1 THEN
            GOTO res
        END IF
        COLOR , _RGB32(100, 220, 255): _PRINTSTRING (CenterX - 20, Centery - 10), "Play"
        COLOR , _RGB32(227, 227, 233)
        _DISPLAY
        _LIMIT 200
        CLS
    LOOP
LOOP
game:
CLS
DO
    k$ = UCASE$(INKEY$)

    _PRINTSTRING (CenterX - 150, Centery - 100), "Currently, There is only 1 character and 1 Villain so play with it!"
    _PRINTSTRING (CenterX - 150, Centery - 85), "Press [C] To Go To It!"

    IF k$ = "C" THEN EXIT DO

    _DISPLAY
    CLS
LOOP
lvlt:
DO
    k$ = UCASE$(INKEY$)
    LOCATE 1, 1: PRINT "Very Early Level Tab!"
    IF lvl1.done$ = "FALSE" THEN LOCATE 3, 1: PRINT "[A] Level 1"
    IF lvl2.done$ = "FALSE" THEN LOCATE 4, 1: PRINT "[B] Level 2"
    IF lvl3.done$ = "FALSE" THEN LOCATE 5, 1: PRINT "[C] Level 3"
    IF lvl4.done$ = "FALSE" THEN LOCATE 6, 1: PRINT "[D] Level 4"
    IF lvl5.done$ = "FALSE" THEN LOCATE 7, 1: PRINT "[E] Level 5[COMING SOON]"

    IF lvl1.done$ = "TRUE" THEN LOCATE 3, 1: PRINT "[A] Level 1[DONE]"
    IF lvl2.done$ = "TRUE" THEN LOCATE 4, 1: PRINT "[B] Level 2[DONE]"
    IF lvl3.done$ = "TRUE" THEN LOCATE 5, 1: PRINT "[C] Level 3[DONE]"
    IF lvl4.done$ = "TRUE" THEN LOCATE 6, 1: PRINT "[D] Level 4[DONE]"
    IF lvl5.done$ = "TRUE" THEN LOCATE 7, 1: PRINT "[E] Level 5[DONE]"

    IF k$ = CHR$(27) THEN GOTO menu

    IF k$ = "A" THEN GOTO lvl1
    IF k$ = "B" THEN GOTO lvl2
    IF k$ = "C" THEN GOTO lvl3
    IF k$ = "D" THEN GOTO lvl4
    _DISPLAY
    CLS
LOOP
lvl1:
b = 0
interval = TIMER + 10: IF UCASE$(thechar$) = "SAKROT" THEN interval = interval + 3
goal = 40: IF UCASE$(thechar$) = "PRASH" THEN goal = goal - 10
DO

    DO WHILE TIMER < interval

        LOCATE 1, 1: PRINT "Press "; CHR$(34); "v"; CHR$(34); " To Win!"
        LOCATE 2, 1: PRINT "Goal: "; goal
        LOCATE 3, 1: PRINT "Pressed: "; b
        LOCATE 4, 1: PRINT "Time Left: "; interval - TIMER
        IF UCASE$(sm.unlocked$) = "TRUE" THEN LOCATE 5, 1: PRINT "Score Multiplyer Unlocked"
        IF UCASE$(thechar$) = "SOKU" THEN LOCATE 6, 1: PRINT "Soku is Adding You Score!"
        k$ = UCASE$(INKEY$)

        WHILE _MOUSEINPUT
            IF _MOUSEBUTTON(1) = -1 THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        WEND

        IF k$ = "V" THEN b = b + 1
        IF k$ = "V" AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
        IF k$ = "V" AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        IF b >= 40 THEN EXIT DO

        _PUTIMAGE (0, 0)-(_WIDTH, _HEIGHT), vil1&

        _DISPLAY
        CLS

    LOOP

    IF b >= goal THEN lvl1.done$ = "TRUE": PRINT "You've Beat The Level 1!!!": OPEN "save.dat" FOR OUTPUT AS #1: _DISPLAY: _DELAY 2: PRINT #1, lvl1.done$: PRINT #1, lvl2.done$: PRINT #1, lvl3.done$: PRINT #1, lvl4.done$: PRINT #1, lvl5.done$: CLOSE #1: EXIT DO ELSE PRINT "You've Lost Level 1!": EXIT DO
    _DISPLAY
    CLS

LOOP
GOTO lvlt
lvl2:
b = 0
goal = 80: IF UCASE$(thechar$) = "PRASH" THEN goal = goal - 10
interval = TIMER + 15: IF UCASE$(thechar$) = "SAKROT" THEN interval = interval + 3
DO

    DO WHILE TIMER < interval

        LOCATE 1, 1: PRINT "Press "; CHR$(34); "V"; CHR$(34); " To Win!"
        LOCATE 2, 1: PRINT "Goal: "; goal
        LOCATE 3, 1: PRINT "Pressed: "; b
        LOCATE 4, 1: PRINT "Time Left: "; interval - TIMER
        k$ = UCASE$(INKEY$)

        WHILE _MOUSEINPUT
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        WEND
        IF k$ = "V" THEN b = b + 1
        IF k$ = "V" AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
        IF k$ = "V" AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        IF b >= goal THEN EXIT DO

        _PUTIMAGE (0, 0)-(_WIDTH, _HEIGHT), vil2&

        _DISPLAY
        CLS

    LOOP

    IF b >= goal THEN lvl2.done$ = "TRUE": PRINT "You've Beat The Level 2!!!": OPEN "save.dat" FOR OUTPUT AS #1: _DISPLAY: _DELAY 2: PRINT #1, lvl1.done$: PRINT #1, lvl2.done$: PRINT #1, lvl3.done$: PRINT #1, lvl4.done$: PRINT #1, lvl5.done$: CLOSE #1: EXIT DO ELSE PRINT "You've Lost Level 1!": EXIT DO
    _DISPLAY
    CLS

LOOP
GOTO lvlt

lvl3:
b = 0
interval = TIMER + 15: IF UCASE$(thechar$) = "SAKROT" THEN interval = interval + 3
goal = 200: IF UCASE$(thechar$) = "PRASH" THEN goal = goal - 10
DO

    DO WHILE TIMER < interval

        LOCATE 1, 1: PRINT "Press "; CHR$(34); "V"; CHR$(34); " To Win!"
        LOCATE 2, 1: PRINT "Goal: "; goal
        LOCATE 3, 1: PRINT "Pressed: "; b
        LOCATE 4, 1: PRINT "Time Left: "; interval - TIMER
        k$ = UCASE$(INKEY$)

        WHILE _MOUSEINPUT
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        WEND
        IF k$ = "V" THEN b = b + 1
        IF k$ = "V" AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
        IF k$ = "V" AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        IF b >= goal THEN EXIT DO

        _PUTIMAGE (0, 0)-(_WIDTH, _HEIGHT), vil3&

        _DISPLAY
        CLS

    LOOP

    IF b >= goal THEN lvl3.done$ = "TRUE": PRINT "You've Beat Level 3!!!": OPEN "save.dat" FOR OUTPUT AS #1: _DISPLAY: _DELAY 2: PRINT #1, lvl1.done$: PRINT #1, lvl2.done$: PRINT #1, lvl3.done$: PRINT #1, lvl4.done$: PRINT #1, lvl5.done$: CLOSE #1: EXIT DO ELSE PRINT "You've Lost Level 1!": EXIT DO
    _DISPLAY
    CLS

LOOP
GOTO lvlt

lvl4:
goal = 400: IF UCASE$(thechar$) = "PRASH" THEN goal = goal - 10

interval = TIMER + 10: IF UCASE$(thechar$) = "SAKROT" THEN interval = interval + 3
b = 0
DO

    DO WHILE TIMER < interval

        LOCATE 1, 1: PRINT "Press "; CHR$(34); "V"; CHR$(34); " To Win!"
        LOCATE 2, 1: PRINT "Goal: "; goal
        LOCATE 3, 1: PRINT "Pressed: "; b
        LOCATE 4, 1: PRINT "Time Left: "; interval - TIMER
        k$ = UCASE$(INKEY$)

        WHILE _MOUSEINPUT
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 THEN b = b + 1
            IF _MOUSEBUTTON(1) = -1 AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        WEND
        IF k$ = "V" THEN b = b + 1
        IF k$ = "V" AND UCASE$(sm.unlocked$) = "TRUE" THEN b = b + 1
        IF k$ = "V" AND UCASE$(thechar$) = "SOKU" THEN b = b + 5
        IF b >= goal THEN EXIT DO

        _PUTIMAGE (0, 0)-(_WIDTH, _HEIGHT), vil4&

        _DISPLAY
        CLS

    LOOP

    IF b >= goal THEN lvl4.done$ = "TRUE": PRINT "You've Beat The Level 4!!!": OPEN "save.dat" FOR OUTPUT AS #1: _DISPLAY: _DELAY 2: PRINT #1, lvl1.done$: PRINT #1, lvl2.done$: PRINT #1, lvl3.done$: PRINT #1, lvl4.done$: PRINT #1, lvl5.done$: CLOSE #1: EXIT DO ELSE PRINT "You've Lost Level 1!": EXIT DO
    _DISPLAY
    CLS

LOOP
GOTO lvlt


res:
CLS
INPUT "Enter Width"; wid
CenterX = wid / 2
INPUT "Enter Height"; hei
Centery = hei / 2
OPEN "resolution.dat" FOR OUTPUT AS #1
PRINT #1, wid
PRINT #1, hei
CLOSE #1
SCREEN _NEWIMAGE(wid, hei, 32)
GOTO menu

char:
IF _FILEEXISTS("selectchar.dat") THEN
    OPEN "selectchar.dat" FOR INPUT AS #1
    INPUT #1, thechar$
    thechar$ = UCASE$(thechar$)
    CLOSE #1
ELSE
    OPEN "selectchar.dat" FOR OUTPUT AS #1
    PRINT #1, "NULL"
    CLOSE #1
    thechar$ = "NULL"
END IF

IF _FILEEXISTS("sakrot.dat") THEN
    OPEN "sakrot.dat" FOR INPUT AS #1
    INPUT #1, sakrot.unlocked$
    CLOSE #1
ELSE
    OPEN "sakrot.dat" FOR OUTPUT AS #1
    PRINT #1, "FALSE"
    CLOSE #1
    sakrot.unlocked$ = "FALSE"
END IF
IF _FILEEXISTS("prash.dat") THEN
    OPEN "prash.dat" FOR INPUT AS #1
    INPUT #1, prash.unlocked$
    CLOSE #1
ELSE
    OPEN "prash.dat" FOR OUTPUT AS #1
    PRINT #1, "FALSE"
    CLOSE #1
    prash.unlocked$ = "FALSE"
END IF
IF _FILEEXISTS("soku.dat") THEN
    OPEN "soku.dat" FOR INPUT AS #1
    INPUT #1, soku.unlocked$
    CLOSE #1
ELSE
    OPEN "soku.dat" FOR OUTPUT AS #1
    PRINT #1, "FALSE"
    CLOSE #1
    soku.unlocked$ = "FALSE"
END IF

DO

    k$ = UCASE$(INKEY$)

    IF sakrot.unlocked$ = "TRUE" THEN LOCATE 1, 1: PRINT "Press [A] To Select Sakrot!"
    IF prash.unlocked$ = "TRUE" THEN LOCATE 2, 1: PRINT "Press [B] To Select Prash."
    IF soku.unlocked$ = "TRUE" THEN LOCATE 3, 1: PRINT "Press [C] To Select Soku."

    IF sakrot.unlocked$ = "FALSE" THEN LOCATE 1, 1: PRINT "Sakrot Is Locked [Unlock it by Completing Level 2.]"
    IF prash.unlocked$ = "FALSE" THEN LOCATE 2, 1: PRINT "Prash is Locked [Unlock it by Spending 10 sitcoins(Press 'D' To Buy)]"
    IF soku.unlocked$ = "FALSE" THEN LOCATE 3, 1: PRINT "Soku is Locked[Unlock it by Spending 60 sitcoins(Press 'D' To Buy)]"


    _PUTIMAGE (100, 50)-(150, 100), char1
    _PUTIMAGE (200, 50)-(250, 100), char2
    _PUTIMAGE (300, 50)-(350, 100), char3

    _PRINTSTRING (100, 110), "Sakrot"
    _PRINTSTRING (200, 110), "Prash"
    _PRINTSTRING (300, 110), "Soku"
    _PRINTSTRING (400, 110), "Your Selected Character: " + thechar$

    IF sakrot.unlocked$ = "TRUE" AND k$ = "A" THEN
        thechar$ = "SAKROT"
    ELSEIF prash.unlocked$ = "TRUE" AND k$ = "B" THEN
        thechar$ = "PRASH"
    ELSEIF soku.unlocked$ = "TRUE" AND k$ = "C" THEN
        thechar$ = "SOKU"
    END IF
    IF k$ = "D" THEN GOTO shop
    OPEN "selectchar.dat" FOR OUTPUT AS #1
    PRINT #1, thechar$
    CLOSE #1

    IF k$ = CHR$(27) THEN GOTO menu

    _DISPLAY
    CLS
LOOP
« Last Edit: April 30, 2018, 05:38:51 am by Prithak »
Q: 0 is False and 1 is True, right?
A: 1

Prithak

  • Jr. Member
  • **
  • Posts: 98
  • Programmer: A machine turns Coffee into Code.
Re: TheAggressor!
« Reply #1 on: April 30, 2018, 05:26:06 am »
Oh Shoot forgot to add attachments  ;D ;D
Q: 0 is False and 1 is True, right?
A: 1

Prithak

  • Jr. Member
  • **
  • Posts: 98
  • Programmer: A machine turns Coffee into Code.
Re: TheAggressor!
« Reply #2 on: April 30, 2018, 05:30:32 am »
To get SitCoins make a file named "coin.txt" and write the amount. #DONE!!
Q: 0 is False and 1 is True, right?
A: 1

  • Print