NaaLaa
Star Trek - Printable Version

+- NaaLaa (https://www.naalaa.com/forum)
+-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html)
+--- Forum: NaaLaa 7 Code (https://www.naalaa.com/forum/forum-4.html)
+--- Thread: Star Trek (/thread-149.html)

Pages: 1 2


RE: Star Trek - Marcus - 07-29-2024

Looks very interesting!


RE: Star Trek - 1micha.elok - 07-30-2024

(07-29-2024, 02:08 PM)Marcus Wrote: Looks very interesting!

DISCLAIMER
  •     No extraterrestrial intelligence and technology are used behind the scene.
  •     No Klingon Warship is harmed during the making of this game.
  •     Nevertheless, we are Klingons 

So stay tune, I've promised to release the Star Trek N7 soon ...
Big Grin Big Grin Big Grin


RE: Star Trek - 1micha.elok - 08-01-2024

   
click the image to zoom in

Coming Soon
in 1 - 2 days

Big Grin Big Grin Big Grin


RE: Star Trek - Marcus - 08-01-2024

(07-30-2024, 12:36 AM)1micha.elok Wrote:
(07-29-2024, 02:08 PM)Marcus Wrote: Looks very interesting!

DISCLAIMER
  •     No extraterrestrial intelligence and technology are used behind the scene.
  •     No Klingon Warship is harmed during the making of this game.
  •     Nevertheless, we are Klingons 

So stay tune, I've promised to release the Star Trek N7 soon ...
Big Grin Big Grin Big Grin

Darned, I'll probably be in Stockholm on the release day Smile


RE: Star Trek - 1micha.elok - 08-02-2024

STAR TREK N7

    Tips to play STAR TREK N7 :
    1. Don't skip the introduction.
    2. Learn the coordinate system.
    3. Write down on a piece of paper some Klingon phrases,
    4. Find starbase to improve starship condition
    5. Use warp speed and phaser wisely
    6. Watch carefully your dashboard
        Never go into the battle if your starship condition is RED

Code:
'===============================================================================
'STAR TREK N7
'    Inspired by the 1970s Star Trek (BASIC) by Mike Mayfield and Bob Leedom.
'    Star Trek N7 is a simplified and modified version.
'    No artificial sound effects and background music are added to the game.
'    It's not intended as a full conversion from the original version, but rather
'    it's "just inpired" and as a proof of concept of text-based adventure game.
'
'    Tips to play STAR TREK N7 :
'    1. To understand Star Trek N7, please don't skip the introduction.
'    2. Learn the coordinate system in this game.
'       You have to know where your starship on the coordinate system.
'    3. Write down on a piece of paper some Klingon phrases,
'       it helps you to communicate with Klingon.
'    4. Find starbase to increase your energy and improve starship condition
'    5. Use warp speed and phaser wisely, they consume a lot of energy
'    6. Watch carefully your dashboard : stardate, condition, phaser and energy
'       Never go into the battle if your starship condition is RED.
'
'GAME ASSETS
'   Star Trek ASCII art  https://sunnyspot.org/asciiart/gallery/startrek.html
'   Klingon Phrases      https://www.kli.org/about-klingon/klingon-phrases/
'                        https://klingon.wiki/En/HowDoISay"
'
'DISCLAIMER
'    It is not intended for commercial use and not for sale                       
'    No person or entity associated with this game received payment   
'    or anything of value, or entered into any agreement,             
'    in connection with any game assets used in this game.
'
'    All trademarks and game assets are the property of their respective owners. 
'    While every effort is made to acknowledge their works,
'    some of the game assets used in in this tiny game may not have
'    clear name of the artist/author/creator/developer to be referred with.
'    It may not include all relevant facts or the most up-to-date information.
'           
'    Names, characters, places, events and incidents
'    are either the products of the author’s imagination
'    or used in a fictitious manner. Any resemblance to actual persons,
'    living or dead, or actual events is purely coincidental.
'
'    No extraterrestrial intelligence is used behind the scene.
'    No Klingon Warship is harmed during the making of this game.
'    Nevertheless, we are Klingons :)
'===============================================================================


'----------------
' INITIALIZATION
'----------------
#win32
set window "Star Trek N7",550,550,false
set redraw off
randomize time()

'color definition
visible black       = [0,0,0]         
visible white       = [255,255,255]

'Stardate determines the length of the game
visible Stardate    = []
Stardate.begin      = 3000 + rnd(0,1900)
Stardate.mission    = 15
Stardate.today      = Stardate.begin

'USS Enterprise, your ship
visible Ship        = []
Ship.state          = ["GREEN","RED"]
Ship.condition      = Ship.state[1] 
Ship.x              = rnd(1,8)
Ship.y              = rnd(1,8)
Ship.phaser         = 2
Ship.energy         = 2000
Ship.command        = ""

'Klingon, your enemy
visible Klingon     = []
Klingon.total       = 10
Klingon.number      = Klingon.total
for i = 1 to Klingon.total
    Klingon[i]      = []
    Klingon[i].x    = rnd(1,8)
    Klingon[i].y    = rnd(1,8)
next
Klingon[1].says     = "nuqneH"
Klingon[1].means    = "TRADITIONAL GREETING"
Klingon[2].says     = "qaStaH nuq ?"
Klingon[2].means    = "WHAT'S HAPPENING"
Klingon[3].says     = "maj"
Klingon[3].means    = "GOOD"
Klingon[4].says     = "naDevvo' yIghoS"
Klingon[4].means    = "GO AWAY"
Klingon[5].says     = "Heghlu'meH QaQ jajvam"
Klingon[5].means    = "TODAY IS A GOOD DAY TO DIE"
Klingon[6].says     = "tlhIngan maH"
Klingon[6].means    = "WE ARE KLINGONS"
Klingon[7].says     = "buy' ngop"
Klingon[7].means    = "THAT'S GREAT NEWS"
Klingon[8].says     = "DaH jImej"
Klingon[8].means    = "GOOD BYE"
Klingon[9].says     = "yIn nI' yISIQ 'ej yIchep"
Klingon[9].means    = "LONG LIFE AND PROSPER"
Klingon[10].says    = "qatlho'"
Klingon[10].means   = "THANK YOU"

'Starbase for resupplying your ship
visible Starbase    = []
Starbase.total      = 3
for i = 1 to Starbase.total
    Starbase[i]     = []
    Starbase[i].x   = rnd(1,8)
    Starbase[i].y   = rnd(1,8)
next

'Initial Message
intro1()
intro2()
intro3()


'-----------
' MAIN LOOP
'-----------
do
    set color black; cls
    Stardate.today = Stardate.today + 0.4
    Ship.location = Ship.x+","+Ship.y   
    set caret 10,20; set color white
   
    wln   "STARSHIP DASHBOARD"
    wln   "--------------------------"
    wln   "STARDATE           "+stardate()
    wln   "LOCATION           "+"("+Ship.x+","+Ship.y+")"
    wln   "CONDITION          "+Ship.condition
    wln   "PHASER             "+Ship.phaser
    wln   "ENERGY             "+shipenergy()
    wln   "KLINGON REMAINING  "+klingonremaining()
    wln
    wln   "TYPE HLP TO DISPLAY LIST OF COMMANDS"
    write "COMMAND ? "; Ship.command = rln(3,TYPE_STRING)
   
    'no more Klingons ?
    if Klingon.number <= 0 then
        clearscreen()
        wln "------------- CONGRATULATIONS -------------"
        wln "NO MORE KLINGON CHALLENGES"
        wln "YOU ARE PROMOTED AS"
        wln "THE CHIEF COMMANDER OF STARFLEET ENTERPRISE"
        wln "-------------------------------------------"
        wln
        wln "THE END"
        pause()
        starship(-100,0,350,20);end 'animate starship and close the window
    endif
   
    'check stardate and energy
    if Stardate.today - Stardate.begin >= Stardate.mission or Ship.energy<200 then
        set caret 10,200
        wln       
        wln "KLINGONS ALMOST TAKE OVER THE FEDERATION HEADQUARTER"
        wln "TO ASSASSINATE THE PRESIDENT OF THE FEDERATION"
        wln
        wln "IF YOU WANT TO CONTINUE, THE FEDERATION WILL"       
        wln "GIVE YOU MORE TIME AND MORE ENERGY"
        write "CONTINUE ? (Y/N)";continue = rln(1,TYPE_STRING)
        clearscreen()
        if upper(continue)="Y" then
            Stardate.mission = Stardate.mission + 10 'give more days
            if Ship.energy < 200 then
                Ship.energy = Ship.energy + 2000 'give additional energy
            endif   
        else
            clearscreen()
            starship(-100,0,250,20) 'animate the starship
            end                     'mission is terminated
        endif 
    endif
   
    select upper(Ship.command)
        case "LOC";locateship();pause()
        case "FDS";findstarbase();pause()
        case "SCK";scanklingon();pause()
        case "LKP";learnklingon();pause()
        case "NAV";navigate()
        case "PHA";phaser()
        case "EXT";exitgame()
        default
            help()
    endsel
loop


'-----------
' FUNCTIONS
'-----------
function intro1()
    for a = 1 to 17 step 0.6
        set color black; cls; set color white
        set caret 10,10;     wln "      ____ _____      _______                                      "
        set caret 10,10+a;   wln "     / __//_  _/ ,/| /____   )                                     "
        set caret 10,10+2*a; wln "    ( (    / / ,/  |   __ ) /                                      "
        set caret 10,10+3*a; wln "     \ \  / /,/ _  |  / // /                                       "
        set caret 10,10+4*a; wln "  ____) )/ //,-' `.| / / \ \                                       "
        set caret 10,10+5*a; wln " /_____//_///     ||/_/   \ \_ ______ ______     ______  __   __   "
        set caret 10,10+6*a; wln "                           \_//_  __//___   )   / ____/ / /  / /   "
        set caret 10,10+7*a; wln "                               / /    __ ) /   / /_    / / / /    "
        set caret 10,10+8*a; wln "                              / /    / // /   / ___|  / // /      "
        set caret 10,10+9*a; wln "                             / /    / / \ \  / /____ / / \ \       "
        set caret 10,10+10*a;wln "                            /_/    /_/   \ \/______//_/   \_\      "
        set caret 10,10+11*a;wln "                                          \/                       "
        redraw
        fwait 8
    next

    a = 15; i= 0
    star = []
    star.number = 20
    for s = 1 to star.number
        star[s]  = []
        star[s].x = rnd(0,2200)
        star[s].y = 40+rnd(14,28)*a   
    next
    do
        clearscreen_trace()
        draw rect 10,40+13*14,530,260
        set caret 20,40+14*15; wln "USS ENTERPRISE STARSHIP WARP SPEED"   
        set caret 100,40+18*a;wln "  ___________________          _-_             " 
        set caret 100,40+19*a;wln "  \==============_=_/ ____.---'---`---.____    "
        set caret 100,40+20*a;wln "              \_ \    \----._________.----/    "
        set caret 100,40+21*a;wln "                \ \   /  /    `-_-'            "
        set caret 100,40+22*a;wln "            __,--`.`-'..'-_                    "
        set caret 100,40+23*a;wln "           /____          ||                   "
        set caret 100,40+24*a;wln "                `--.____,-'                    "

        'moving stars animation
        for s = 1 to star.number
            set caret star[s].x-i,star[s].y; wln "*"
        next               
        if i > 550*3 then
            i = 0
        else
            i = i + 5
        endif       
           
        set caret 180,40+31*15;wln "PRESS ENTER TO CONTINUE"
        a = 15+rnd(-1,1)/10 'vibration visual effect
        redraw
        fwait 60

    until keydown(KEY_RETURN,true)
endfunc

function intro2()
    set caret 10,20
    set color black; cls; set color white
    text = []
    text[1] = "                 :  RRVIttIti+==iiii++iii++=;:,       :    "
    text[2] = "                 : IBMMMMWWWWMMMMMBXXVVYYIi=;:,        :   "
    text[3] = "                 : tBBMMMWWWMMMMMMBXXXVYIti;;;:,,      :   "
    text[4] = "                 t YXIXBMMWMMBMBBRXVIi+==;::;::::       ,  "
    text[5] = "                ;t IVYt+=+iIIVMBYi=:,,,=i+=;:::::,      ;; "
    text[6] = "                YX=YVIt+=,,:=VWBt;::::=,,:::;;;:;:     ;;; "
    text[7] = "                VMiXRttItIVRBBWRi:.tXXVVYItiIi==;:   ;;;;  "
    text[8] = "                =XIBWMMMBBBMRMBXi;,tXXRRXXXVYYt+;;: ;;;;;  "
    text[9] = "                 =iBWWMMBBMBBWBY;;;,YXRRRRXXVIi;;;:;,;;;=  "
    text[10] = "                  iXMMMMMWWBMWMY+;=+IXRRXXVYIi;:;;:,,;;=   "
    text[11] = "                  iBRBBMMMMYYXV+:,:;+XRXXVIt+;;:;++::;;;   "
    text[12] = "                  =MRRRBMMBBYtt;::::;+VXVIi=;;;:;=+;;;;=   "
    text[13] = "                   XBRBBBBBMMBRRVItttYYYYt=;;;;;;==:;=     "
    text[14] = "                    VRRRRRBRRRRXRVYYIttiti=::;:::=;=       "
    text[15] = "                     YRRRRXXVIIYIiitt+++ii=:;:::;==        "
    text[16] = "                     +XRRXIIIIYVVI;i+=;=tt=;::::;:;        "
    text[17] = "                      tRRXXVYti++==;;;=iYt;:::::,;;        "
    text[18] = "                       IXRRXVVVVYYItiitIIi=:::;,::;        "
    text[19] = "                        tVXRRRBBRXVYYYIti;::::,::::        "
    text[20] = "                         YVYVYYYYYItti+=:,,,,,:::::;       "
    text[21] = "                         YRVI+==;;;;;:,,,,,,,:::::::       "
    for tt = 1 to 21
        wln text[tt]
        redraw
        wait 400
    next                             

    wln
    wln "     ______ _______ ______ ______   _______ ______  ______ __  __  "
    wln "    / __  //__  __// __  // __  /  /__  __// __  / / ____// / / /  "
    wln "   / / /_/   / /  / /_/ // /_/ /     / /  / /_/ / / /__  / /_/ /   "
    wln "  __\ \     / /  / __  //   __/     / /  /   __/ / __ / /   _ /    "
    wln " / /_/ /   / /  / / / // /\ \      / /  / /\ \  / /___ / /\ \      "
    wln "/_____/   /_/  /_/ /_//_/  \_\    /_/  /_/  \_\/_____//_/  \_\     "
    wln
    text[1] = "        WILL MR.SPOCK AS CAPTAIN KIRK'S SECOND-IN-COMMAND"
    text[2] = "                 ACCEPT THE KLINGONS' CHALLENGES ?"
    for tt = 1 to 2
        type(text[tt])
        wln 
    next                             
    wln
    wln "                     PRESS ENTER TO CONTINUE"
    redraw
    do; wait 1;until keydown(KEY_RETURN,true)
endfunc

function intro3()
    set caret 10,60
    set color black; cls;set color white
    text    = []
    text[1] = "SPACE"
    text[2] = "THE FINAL FRONTIER"
    text[3] = "THESE ARE THE VOYAGES OF THE STARSHIP ENTERPRISE"
    text[4] = "TO EXPLORE STRANGE NEW WORLDS"
    text[5] = "TO SEEK OUT NEW LIFE AND NEW CIVILIZATIONS"
    text[6] = "TO BOLDLY GO WHERE NO ONE HAS GONE BEFORE"
    for tt = 1 to 6
        type(text[tt])
        wln 
    next                             
                                                                                               
    set caret 10,200;wln "                 ,------*------, "
    set caret 10,220;wln " ,------------    '---  ------'  "
    set caret 10,240;wln " '-------- --'      / /         "
    set caret 10,260;wln "     ,---' '-------/ /--,       "
    set caret 10,280;wln "      '----------------'        "
   
    wln
    text[1] = "CAPTAIN LOG ON STARDATE "+Stardate.begin
    text[2] = " FEAR OF ESCALATION GROW AFTER KLINGONS SENT THEIR WARSHIPS"
    text[3] = " INTELLIGENCE SAID THEY'LL ASSASSINATE THE PRESIDENT ON "+(Stardate.begin+Stardate.mission)
    text[4] = " DRIVE OUT ALL "+Klingon.total+" KLINGON WARSHIPS."
    text[5] = " WATCH CAREFULLY : STARDATE, CONDITION, PHASER, ENERGY"
    for tt = 1 to 5
        type(text[tt])
        wln 
    next                             
    wln
    wln " ENTER TO CONTINUE"
    redraw
    do; wait 1; until keydown(KEY_RETURN,true)

    starship(-100,110,200,20)'animate starship
endfunc

function type(x)
    for t = 0 to len(x)
        write mid(x,t)
        wait 100
        redraw
    next
endfunc

function stardate()
    if Stardate.today - Stardate.begin >= Stardate.mission then
        return round(Stardate.today)+" TIME IS OVER"
    else
        return round(Stardate.today)
    endif
endfunc

function shipenergy()
    if Ship.energy<200 then
        return Ship.energy+" WARNING"
    else
        return Ship.energy
    endif
endfunc

function klingonremaining()
    if Klingon.number >0 then
        return Klingon.number
    else
        return 0 +" PEACE ON THE UNIVERSE"
    endif
endfunc

function starship(x,b,y,a)
    do
        set color white
        set caret x+b,y;    wln "                 ,------*------, "
        set caret x+b,y+1*a;wln " ,------------    '---  ------'  "
        set caret x+b,y+2*a;wln " '-------- --'      / /         "
        set caret x+b,y+3*a;wln "     ,---' '-------/ /--,       "
        set caret x+b,y+4*a;wln "      '----------------'        " 
        fwait 30
        redraw
        set color black
        set caret x+b,y;    wln "                 ,------*------, "
        set caret x+b,y+1*a;wln " ,------------    '---  ------'  "
        set caret x+b,y+2*a;wln " '-------- --'      / /         "
        set caret x+b,y+3*a;wln "     ,---' '-------/ /--,       "
        set caret x+b,y+4*a;wln "      '----------------'        " 
        b=b+5
    until b>700     
endfunc

function quadrant()
    for a = 0 to 7
        for b = 0 to 320
            set caret 40+b,240+a*20;write "-"
        next
        for b = 0 to 8
            set caret 40+40*b,250+a*20;write "|"
        next
        set caret 15,250+a*20; write a+1 'row number
        set caret 60+40*a,230; write a+1 'header number
    next
    for b = 0 to 320
        set caret 40+b,240+a*20;write "-"
    next
    set caret 40, 420
    'wln "Note :"
    'wln " U = USS Enterprise"
    'wln " K = Klingon warship"
    'wln " * = Starbase"
    'wln
    wln "ENTER TO CONTINUE"
endfunc

function setloc(entity,x,y)
    set caret 60+40*(x-1),250+(y-1)*20; write entity
endfunc

function locateship()
    quadrant()
    setloc("U",Ship.x,Ship.y)
    set caret 400,250
    wln "Your Ship"
    wln "("+Ship.x+","+Ship.y+")"
endfunc

function findstarbase()
    quadrant()
    set caret 400,250;wln "Starbase"
    for i = 1 to Starbase.total
        setloc("*",Starbase[i].x,Starbase[i].y) '* = Starbase
        set caret 400,250+i*20;wln i+". ("+Starbase[i].x+","+Starbase[i].y+")"
    next
    Ship.energy = Ship.energy - 50
    set caret 40,520
endfunc

function scanklingon()
    quadrant()
    set caret 400,200;wln "Klingon"
    for i = 1 to Klingon.total
        setloc("K",Klingon[i].x,Klingon[i].y) 'K = Klingon's warship
        set caret 400,200+i*20;wln i+". ("+Klingon[i].x+","+Klingon[i].y+")"
    next
    Ship.energy = Ship.energy - 100
    set caret 40,520
endfunc

function learnklingon()
    set caret 10,220; wln "USEFUL KLINGON PHRASES"
    set caret 10,235; wln "----------------------"   
    for i = 1 to 10
        set caret 10,240+i*15 ; write i+". "+Klingon[i].means
        set caret 300,240+i*15; write " = "+Klingon[i].says
    next
   
    set caret 10, 420
    wln   
    wln "PRESS ENTER TO CONTINUE" 
    Ship.energy = Ship.energy - 30
endfunc

function navigate()
    'compass
     wln
     wln "       4  3  2     "
     wln "        \ | /      "
     wln "         \|/       "
     wln "    5 --- 0 --- 1  "
     wln "         /|\       "
     wln "        / | \      "
     wln "       6  7  8     "
     wln
     write "NAVIGATE ? (0-8) ";nav = rln(1,TYPE_NUMBER)
     
     warp = 1 'default
     if nav<>0 then 'nav = 0 stay at the same coordinate
        write "WARP SPEED ?(1-3) ";warp = rln(1,TYPE_NUMBER)
     endif
     
     select warp
        case 1; Ship.energy = Ship.energy - 100
        case 2; Ship.energy = Ship.energy - 200; Stardate.today = Stardate.today + 1
        case 3; Ship.energy = Ship.energy - 300; Stardate.today = Stardate.today + 2
        default
            Ship.energy = Ship.energy - 100
            Stardate.today = Stardate.today + 1
            warp = 1
     endsel
                                                   
    'goto new location
    tempx = Ship.x; tempy = Ship.y
    select nav
      case 0
        Ship.x = Ship.x; Ship.y = Ship.y
      case 1
        Ship.x = Ship.x + warp
      case 2
        Ship.x = Ship.x + warp; Ship.y = Ship.y - warp
      case 3
        Ship.y = Ship.y - warp
      case 4
        Ship.x = Ship.x - warp; Ship.y = Ship.y - warp
      case 5
        Ship.x = Ship.x - warp
      case 6
        Ship.x = Ship.x - warp; Ship.y = Ship.y + warp
      case 7
        Ship.y = Ship.y + warp
      case 8
        Ship.x = Ship.x + warp; Ship.y = Ship.y + warp
      default
        wln "TRY AGAIN"
    endsel
    if Ship.x < 1 or Ship.x > 8 or Ship.y < 1 or Ship.y> 8 then
        Ship.x = tempx; Ship.y=tempy 'you can't go out of boundary
    endif
       
    'is there a starbase on the location ?
    '  refill energy and improve ship condition
    '  move the starbase to 0,0 so it can't be used anymore
    for i = 1 to Starbase.total
        if Starbase[i].x = Ship.x and Starbase[i].y = Ship.y then
            set caret 10,380
            wln "WELCOME TO STARBASE"
            wln "-------------------"
            wln "ENERGY         IMPROVED"
            wln "SHIP CONDITION IMPROVED"
            Ship.energy = Ship.energy + 1000
            Ship.condition = Ship.state[0]
            Starbase[i].x = 0
            Starbase[i].y = 0
            pause()
        endif
    next
   
    clearscreen()
   
    'is there a Klingon on the location ?
    '  communicate with Klingon
    '  translate Klingon language
    '  if you can't translate, Klingon attack you, energy diminished
    '  if you can translate, there is no war. Klingon move to(0,0)
    for i = 1 to Klingon.total
        if Klingon[i].x = Ship.x and Klingon[i].y = Ship.y then
            temps = rnd(1,10)
            if temps < 10 then
                tempm = rnd(0,1)+temps
            else
                tempm = rnd(1,10)
            endif
            if  temps = tempm then
                rightanswer="Y"
            else
                rightanswer="N"
            endif         
            set caret 10,200       
            wln "OPEN COMMUNICATION WITH KLINGON ..."
            wln "KLINGON SAYS : "+Klingon[temps].says
            write "DOES IT MEAN... '"+Klingon[tempm].means+"' ? (Y/N)"; youranswer=rln(1,TYPE_STRING)
            wln
            if upper(youranswer) = rightanswer then
                wln "YOU UNDERSTAND KLINGON PHRASE WELL"
                wln "KLINGON IS HAPPY WITH YOU"
                wln Klingon[temps].says+" = "+Klingon[temps].means
                wln "KLINGON IS MOVING TO ITS HOME BASE"
                wln
                wln "PRESS ENTER TO CONTINUE"
                Klingon[i].x = 0
                Klingon[i].y = 0
                Klingon.number = Klingon.number - 1
                Ship.energy = Ship.energy + 500
            else
                wln "WRONG ANSWER. YOU MAKE KLINGON ANGRY"
                wln "YOU HAVE TO LEARN KLINGON PHRASES !"
                wln "KLINGON ATTACKS YOU ... ENERGY DIMINISHED"
                wln
                wln "PRESS ENTER TO CONTINUE"
                if Ship.condition="RED" then
                    Ship.energy=Ship.energy-500
                else
                    Ship.energy=Ship.energy-100
                    Ship.condition="RED"
                endif
            endif
            pause()
            clearscreen()
        endif
    next
endfunc

function phaser()
    a = 0
    tempk = rnd(-135,20)
    info = "SHIELD ACTIVATED"
    collision = false
    if Ship.phaser>0 then
        wln
        wln "TURNING ON PHASER MADE KLINGON REALLY ANGRY"
        wln "KLINGON THOUGHT THAT YOU HAD PROVOKED AN OPEN WAR"
        wln
        wln "SUDDENLY A KLINGON WARSHIP SHOT AT YOUR STARSHIP..."
        wln   
        wln "MR.SPOCK      : FROM WHERE DID THE KLINGON COME FROM ?"
        wln "CAPTAIN KIRK  : ACTIVATE SHIELD NOW !"
        wln "                WE HAVE TO PROTECT OUR STARSHIP"
        wln "COMPUTER      : SHIELD ACTIVATED "       
        wln "MR.SPOCK      : I'VE MODIFIED PHASER"
        wln "                PHASER WILL FREEZE TIME AND SPACE"
        wln "..."
        wln
        wln "PRESS ENTER TO CONTINUE"
        pause()
    else
        wln
        wln "YOU DON'T HAVE ENOUGH PHASER"
        wln "KLINGONS VOW TO RETALIATE AGAINST YOUR STARSHIP AT ANY COST"
        wln "YOU ENERGY IS DIMINISHED SOON"
        wln
        wln "PRESS ENTER TO CONTINUE"
        pause()
    endif
    k = 0
    kb = true   'is Klingon bullet animated ?
    upb = false 'is Klingon warship on upper boundary ?
    if Klingon.number >0 and Ship.phaser>0 then
        do
            clearscreen()
            set color white
            draw rect 10,200,500,200 'battle arena
           
            if keydown(KEY_UP) and collision=false then
                if a>-134 then a = a-1
            endif
           
            if keydown(KEY_DOWN) and collision=false then
                if a<22 then a = a+1
            endif
           
            set caret 30,350+a; wln "[ U ]" 'your starship
            set caret 430,350+tempk; wln "K" 'Klingon warship
            set caret 430-k,350+tempk; wln "-"'Klingon bullet
           
            'Klingon warship animation
            if tempk>-135 and upb=false and collision=false then
                tempk=tempk-1
                if tempk = -135 then
                    upb = true
                endif
            elseif upb=true and collision=false
                tempk = tempk+1
                if tempk = 20 then
                    upb = false
                endif
            endif
            wln
           
            'Klingon bullet animation       
            if 430 - k > 40 and kb then
                k = k + 5
            else
                k = 0
            endif

            if keydown(KEY_SPACE,true) and collision=false then
                for b = 40 to 450 step 20
                    set caret 40+b,350+a; wln ")"
                        set caret 10,420
                        wln "INFORMATION : FREEZE TIME AND SPACE"
                        wln
                        wln "CONTROL KEYS"
                        wln " UP/DOWN   : MOVE YOUR STARSHIP"
                        wln " SPACE     : SHOOT"
                        wln " ESC       : QUIT FROM PHASER MODE"
                       
                        'collision detection
                        if (40+b)> 430 and (a+5>tempk and a-5<tempk) then
                            info ="KLINGON IS DEFEATED. PRESS ESCAPE"
                            collision=true
                            kb = false
                        endif
                    redraw
                    fwait 10
                next
            endif
                   
            set caret 10,420
            wln "INFORMATION : "+info
            wln
            wln "CONTROL KEYS"
            wln " UP/DOWN   : MOVE YOUR STARSHIP"
            wln " SPACE     : SHOOT"
            wln " ESC       : QUIT FROM PHASER MODE"
            redraw 
            fwait 60       
        until keydown(KEY_ESCAPE,true)
       
        'if Klingon is hit,
        ' stop Klingon bullet
        ' Klingon.number is diminished
        ' move randomly one of the Klingon to home base (0,0)
        i = 1
        repeat = true
        if info<>"NONE" then
            Klingon.number = Klingon.number - 1
            while repeat
                if Klingon[i].x> 0 then
                    Klingon[i].x=0
                    Klingon[i].y=0
                    repeat=false 
                    Ship.phaser = Ship.phaser - 1   
                else
                    i=i+1
                endif
            wend
        endif
    endif
    if Ship.condition="RED" then
        Ship.energy = Ship.energy - 500
    else
        Ship.energy = Ship.energy - 300
    endif
endfunc

function exitgame()
    write "ARE YOU SURE ? (Y/N) ";exitg = rln(1,TYPE_STRING)
    wln "PRESS ENTER TO CONTINUE"
    pause()
    if upper(exitg)="Y" then
        starship(-100,0,250,20);end 'animate starship and close the window
    endif
endfunc

function pause()
    set caret 40,520;set color black;temp=rln();set color white
    clearscreen()
endfunc

function help()
    wln
    wln"ENTER ONE OF THE FOLLOWING:"
    wln"  HLP  (LIST OF COMMANDS)"
    wln"  LOC  (YOUR STARSHIP LOCATION)"
    wln"  FDS  (FIND STARBASE)"
    wln"  SCK  (SCAN KLINGON)"
    wln"  LKP  (LEARN KLINGON PHRASES)"
    wln"  NAV  (NAVIGATE)"
    wln"  PHA  (FIRE PHASERS)"
    wln"  EXT  (RESIGN YOUR COMMAND)"
    wln
    wln"PRESS ENTER TO CONTINUE"
    set color black
    temp=rln()
    set color white
    Ship.energy = Ship.energy - 20
endfunc

function clearscreen()
    set color black
    draw rect 0,190,550,550,1
    set color white
    set caret 10,200
endfunc

function clearscreen_trace()
    set color 0,0,0,20
    draw rect 0,190,550,550,1
    set color white
    set caret 10,200
endfunc



RE: Star Trek - johnno56 - 08-02-2024

Nicely done... Quickly found out that firing the Phasers often caused energy to drain really fast... Took a few moves to get the hang of the commands... Navigation was almost the same as the original. Only difference was that your version limits the speed to Warp 3. Other than that, the game is, how did Spock put it? Oh yes, "Fascinating."

The Klingon phrases were a new trick. A couple of them I did not know and the rest was a bit of a brain drain but got there in the end. Interesting effect of getting the phrases correct. Nicely done.

The "animations" were a nice touch... Very cool...

Perhaps a sequel? During Kirk's time they also encountered the Romulans and The Gorn... Sorry. But no Borg. They do not appear until about 160 years after Kirk... Moo Ha Ha Ha...


RE: Star Trek - Marcus - 08-02-2024

Haven't tried the game yet. But I looked at the code on my phone. Cool that you let tables contain both numeric and regular fields Smile


RE: Star Trek - Marcus - 08-03-2024

Now I've played it, and I totally suck at it Smile Super well done anyhow!