Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
90-minute old-skool game creation challenge in FB!
#11
Well after listening to 90mins of Led Zeppelin and drinking a few coffees I created this. Its a pitty I didn't work faster, I had so much more planned for it. the score was acually going to be useful and it would have been able to play more than one game in a row, if you want to, just edit it to call Setup, and just add a clear map thing in there.

With 20mins left I hadn't seen it run, I wrote all subs and linked em together.

This is only a 2 player game cause I had a bug with the AI, its an easy fix but I have to put it here like this.

Enjoy.

Code:
DECLARE SUB Menu()
DECLARE SUB Engine()
DECLARE SUB Keys(P$)
DECLARE SUB AI()
DECLARE SUB Put.Bonus()
DECLARE SUB Put.Wall()
DECLARE SUB Display.Map()
DECLARE SUB Display.Score()
DECLARE SUB Display.Boarder()
DECLARE SUB Move.Lines()
DECLARE SUB Setup()
DECLARE SUB Checkwinner()

DIM SHARED Map(40,25), Lines(2,6), times(5) as double, Game, wallmem(3)

const North = 1
const South = 2
const East = 3
const West = 4

const Slow = 1
const Normal = 2
const Fast = 3

const Alive = 1
const Dead = 2

const Player1 = 1
const Player2 = 2



Screen 16,,,1
Randomize timer

menu()

engine()


sleep

' - = - = - = - = - = - = - = - =] S U B S [= - = - = - = - = - = - = - = - = -

SUB Menu()
    color 15
    print "Lines"
    color 7
    print "1) 1 Player game"
    color 15
    print "2) 2 Player game"
    do
        P$ = inkey$
    loop until P$ = "2" or P$ = chr$(27)
    'if P$ = "1" then Game = Player1
    if P$ = "2" then Game = Player2
    if P$ = chr$(27) then end
    cls
    Display.Boarder()
    display.map()
    setup()
    Call engine()
END SUB

SUB Checkwinner()
    if lines(1,5) = dead or lines(2,5) = dead then
        cls
        if lines(1,5) = dead Then print "PLAYER 2 WINS":print "WITH A SCORE OF "+str$(lines(2,6))
        if lines(2,5) = dead Then print "PLAYER 1 WINS":print "WITH A SCORE OF "+str$(lines(1,6))        
        print "Hit [Enter] to end"
        do:P$=inkey$:loop until P$ = chr$(13)
        end
    end if
end sub


SUB Engine()
    do
        P$ = inkey$
        if P$ <> "" then Call keys(P$)
        if Game = Player1 then Call AI()
        Call Move.Lines()
        Call Checkwinner()
        Call Display.score()
        Call Put.bonus()
        Call Put.wall()
        Call display.Map()
    loop until P$ = chr$(27)
END SUB


SUB Setup()
    Lines(1,1) = 1
    Lines(1,2) = 1
    Lines(1,3) = Normal
    Lines(1,4) = East
    Lines(1,5) = Alive
    Lines(1,6) = 0  
    Lines(2,1) = 40
    Lines(2,2) = 21
    Lines(2,3) = Normal
    Lines(2,4) = West
    Lines(2,5) = Alive
    Lines(2,6) = 0
    WallMem(1) = 0
    WallMem(2) = 0    
    WallMem(3) = 0
END SUB    


SUB Move.Lines()
    if times(1) < timer - .01 then
        for i = 1 to 2
            if Lines(i,3) = Fast then
                if lines(i,4) = North then lines(i,2) -= 1
                if lines(i,4) = South then lines(i,2) += 1
                if lines(i,4) = East then lines(i,1) += 1
                if lines(i,4) = West then lines(i,1) -= 1
            end if
        next
        times(1) = timer
    elseif times(2) < timer - .1 then
        for i = 1 to 2
            if Lines(i,3) = Normal then
                if lines(i,4) = North then lines(i,2) -= 1
                if lines(i,4) = South then lines(i,2) += 1
                if lines(i,4) = East then lines(i,1) += 1
                if lines(i,4) = West then lines(i,1) -= 1
            end if
        next
        if map(lines(1,1),lines(1,2)) = 7 then lines(1,6) +=int(rnd*20)+10
        if map(lines(2,1),lines(2,2)) = 7 then lines(2,6) +=int(rnd*20)+10    
        if map(lines(1,1),lines(1,2)) < 5 and map(lines(1,1),lines(1,2)) <> 0 then lines(1,5) = Dead
        if map(lines(2,1),lines(2,2)) < 5 and map(lines(2,1),lines(2,2)) <> 0 then lines(2,5) = Dead
        for i = 1 to 2
            if lines(i,1) = 0 then lines(i,5) = Dead
            if lines(i,2) = 0 then lines(i,5) = Dead
            if lines(i,1) = 41 then lines(i,5) = Dead
            if lines(i,2) = 22 then lines(i,5) = Dead            
        next
        map(lines(1,1),lines(1,2)) = 1
        map(lines(2,1),lines(2,2)) = 2  
        lines(1,6) += 1
        lines(2,6) += 1        
        times(2) = timer
    elseif times(3) < timer - .4 then
        for i = 1 to 2
            if Lines(i,3) = Slow then
                if lines(i,4) = North then lines(i,2) -= 1
                if lines(i,4) = South then lines(i,2) += 1
                if lines(i,4) = East then lines(i,1) += 1
                if lines(i,4) = West then lines(i,1) -= 1
            end if
        next
        times(3) = timer
    end if
END SUB

SUB Keys(P$)
    if P$ = "w" then lines(1,4) = North
    if P$ = "s" then lines(1,4) = South
    if P$ = "d" then lines(1,4) = East
    if P$ = "a" then lines(1,4) = West
    if game = player2 then
        if P$ = "8" then lines(2,4) = North
        if P$ = "5" then lines(2,4) = South
        if P$ = "6" then lines(2,4) = East
        if P$ = "4" then lines(2,4) = West
    end if
END SUB




SUB Display.Boarder()
    for i = 1 to 42
        locate 1,i+9:color 7:print chr$(219)
        locate 23,i+9:color 8:print chr$(219)
        if i < 23 then
            locate i+1,10:color 7:print chr$(219)
            locate i+1,51:color 8:print chr$(219)
        end if
    next
END SUB


SUB Display.Map()
    for x = 1 to 40
        for y = 1 to 21
            locate y+1,x+10
            if map(x,y) = 1 then
                color 9:print chr$(219)
            elseif map(x,y) = 2 then
                color 12:print chr$(219)
            elseif map(x,y) = 3 then
                color 7:print chr$(178)
            elseif map(x,y) = 4 then
                color 7:print chr$(219)
            elseif map(x,y) = 5 then
                color 7:print chr$(176)
            elseif map(x,y) = 6 then
                color 7:print chr$(177)
            elseif map(x,y) = 7 then
                color 10:print chr$(36)
            elseif map(x,y) = 8 then
                color 4:print chr$(83)
            'else
            '    color 15:print chr$(219)
            end if
        next
    next
END SUB

SUB Put.Wall()
    if times(4) < timer - .25 then
        if Wallmem(1) = 0 then
            do
                WallMem(2) = int(rnd * 40)
                WallMem(3) = int(rnd * 21)
            loop until Map(WallMem(2),WallMem(3)) = 0
            Wallmem(1) = 4
            Map(WallMem(2),WallMem(3)) = 5
        elseif Wallmem(1) = 1 then
            Map(WallMem(2),WallMem(3)) = 4
        elseif Wallmem(1) = 2 then
            Map(WallMem(2),WallMem(3)) = 3
        elseif Wallmem(1) = 3 then
            Map(WallMem(2),WallMem(3)) = 6            
        end if
        Wallmem(1) = Wallmem(1) - 1
        times(4) = timer
    end if
END SUB

SUB Put.Bonus()
    if times(5) < timer - 10 then
        do
            bx = int(rnd * 40)
            by = int(rnd * 21)
        loop until Map(bx,by) = 0
        Map(bx,by) = 7
        times(5) = timer
    end if
END SUB

SUB AI()
    if map(lines(2,1),lines(2,2)-1) > 4 then lines(2,4) = North
    if map(lines(2,1),lines(2,2)+1) > 4 then lines(2,4) = South
    if map(lines(2,1)+1,lines(2,2)) > 4 then lines(2,4) = East
    if map(lines(2,1)-1,lines(2,2)) > 4 then lines(2,4) = West      
END SUB

SUB Display.Score()
    locate 1,1
    color 15
    print "PLAYER 1"
    color 7
    print "SCORE:"
    print str$(lines(1,6))
    print
    color 15
    print "PLAYER 2"
    color 7
    print "SCORE:"
    print str$(lines(2,6))
END SUB

I think I might make another one, time to have a look through my commodore 64 cassettes to find a game to rip Big Grin.

PS. I'm not some old dude, I'm acually 17, despite having a C= and listen to Led Zeppelin.
Reply
#12
To Nixon again:

As for your entry there, it is a two-player nibbles-based game, which gives me this kinda old-skool feeling, which is a good start up front, man! Wink

And look, telling from what you said, it took you just 90 minutes for you to get that source code ready for this challenge. Good job there!

The one problem I found so far is that when the snake player moves in the *exact* opposite direction of where he/she is moving, then the other player automatically wins, which is something that you need to work on and fix a little bit, Nixon. Other than that, I am officially accepting your entry! Big Grin

Also, like I said from the beginning, you can enter this challenge as many times as you like, so you are no doubt welcome to dig into your old Commodore 64 archives to give you an idea of what your next 90-min game is gonna be (and I wish you a lot of good fortune in coming up with a better one, at that! Big Grin )!!

With all of that in mind, be seeing you later, and thank you tonight!!!



[Image: file.php?id=32]
- Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine” and “AFlib2 - Aura Flow Library 2”
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#13
If I'm not mistaken, that's the way most nibbles games work because you're essentially turning back on yourself (much the same as if you circled around and ran into your side). Good work, Nixon. I can't imagine what you'd turn out with 90 minutes of Enya...
Reply
#14
Thanks Adigun A. Polack and Ryan, I think I aimed a bit to high on that game. Well after another 90 minutes have have made this

Code:
' MINE FIELD
' BY NIXON
' My best(well only) score was 154 seconds, 128 moves

DECLARE SUB Menu()
DECLARE SUB Setup()
DECLARE SUB Engine()
DECLARE SUB EndGame(Dead)
DECLARE SUB Make.Map()
DECLARE SUB Display.Map()
DECLARE SUB Display.Time()
DECLARE SUB Display.Moves()
DECLARE SUB Display.Mines()
DECLARE SUB Engine.Keys(P$)
DECLARE SUB Ontop.Mine()
DECLARE SUB Instructions()
DECLARE SUB Display.Boarder()

screen 16,,,1

Dim shared Map(40,25) as integer,Time.old as double,Moves.Taken as integer,_
            Player.x as integer,Player.y as integer, gameover as integer

const North = 1
const South = 2
const East = 3
const West = 4
const FALSE = 0
const TRUE = not FALSE
const Mine = 1
const NoTime = 2

randomize timer

menu


' - = = - - = = - - = = - - = = - =]  S U B S  [= - = = - - = = - - = = - - = = -

SUB Menu()
    do
        cls
        color 15
        print "M I N E   F I E L D"
        print
        print "1) Play Game"
        print
        print "2) Instructions"
        print
        Print "3) Exit"
        do
            P$ = inkey$
        loop until P$ = "1" or P$ = "2" or P$ = "3"
        if P$ = "1" then call Setup():Call Engine()
        if P$ = "2" then Call Instructions()
        if P$ = "3" then end
    loop
    
END SUB

SUB Setup()
    Make.Map()
    Display.Boarder()
    Display.Map()
    Player.x = 1
    Player.y = 1
    Time.old = timer
    Engine.Keys(P$)
    Moves.Taken = 0
    gameover = FALSE
END SUB

SUB Engine()
    do
        P$ = inkey$
        if P$ <> "" then call Engine.Keys(P$)
        call Ontop.Mine()
        Display.Time
        Display.moves
        Display.mines
    loop until P$ = chr$(27) or gameover = TRUE
END SUB

SUB Ontop.Mine()
    if Map(Player.x, player.y) = 8 then Dead = Mine:call EndGame(Dead)
    if Map(Player.x, player.y) = 5 then Dead = FALSE:call EndGame(Dead)    
END SUB

SUB Make.Map()
    for x = 1 to 40
        for y = 1 to 22
            map(x,y) = int(rnd*3)+1
            if int(rnd*10) = 2 then Map(x,y) = 8
        next
    next
    map(1,1) = 1
    map(2,1) = 1
    map(1,2) = 1    
    map(37,19) = 5
END SUB

SUB Display.Map()
    for x = 1 to 40
        for y = 1 to 21
            locate y+1,x+1
            if map(x,y) = 1 then
                color 2:print chr$(176)
            elseif map(x,y) = 2 then
                color 2:print chr$(177)
            elseif map(x,y) = 3 then
                color 2:print chr$(178)
            elseif map(x,y) = 4 then
                color 10:print "$"
            elseif map(x,y) = 5 then
                color 14:print chr$(35)
            elseif map(x,y) = 5 then
                color 7:print "P"                
            elseif map(x,y) = 8 then
                color 2:print chr$(int(rnd*2)+176)          
            else
                color 15:print chr$(219)
            end if
        next
    next
END SUB

SUB Display.Time()
    time.since = Timer - Time.old
    Time.Left = 180 - Time.Since
    if Time.Left <=0 then Dead = NoTime: call EndGame(Dead)
    locate 7,45
    color 7
    print "Time Left:";Time.Left;"  "
END SUB

SUB Display.Moves()
    locate 1,45
    color 15
    print "M I N E   F I E L D"
    locate 3,45
    color 7
    print "Moves Taken:";Moves.Taken
END SUB

SUB Display.Mines()
    NumMines = 0
    if Map(player.x,player.y-1) = 8 then NumMines += 1
    if Map(player.x,player.y+1) = 8 then NumMines += 1
    if Map(player.x+1,player.y) = 8 then NumMines += 1
    if Map(player.x-1,player.y) = 8 then NumMines += 1  
    if Map(player.x-1,player.y-1) = 8 then NumMines += 1  
    if Map(player.x+1,player.y-1) = 8 then NumMines += 1
    if Map(player.x+1,player.y+1) = 8 then NumMines += 1
    if Map(player.x-1,player.y+1) = 8 then NumMines += 1    
    color 7
    locate 5,45
    print "Close Mines:"; NumMines
END SUB

SUB Engine.Keys(P$)
    locate player.y+1, player.x+1:color 0:print chr$(219)
    if P$ = "8" and player.y > 1 then Player.y -= 1:Moves.Taken += 1
    if P$ = "5" and player.y < 21 then Player.y += 1:Moves.Taken += 1
    if P$ = "6" and player.x < 40 then Player.x += 1:Moves.Taken += 1
    if P$ = "4" and player.x > 1 then Player.x -= 1:Moves.Taken += 1
    if P$ = "7" and player.x > 1 and player.y > 1 then Player.y -= 1:Player.x -= 1:Moves.Taken += 1
    if P$ = "9" and player.x < 40 and player.y > 1 then Player.y -= 1:Player.x += 1:Moves.Taken += 1
    if P$ = "1" and player.x > 1 and player.y < 21 then Player.y += 1:Player.x -= 1:Moves.Taken += 1
    if P$ = "3" and player.x < 40 and player.y < 21 then Player.y += 1:Player.x += 1:Moves.Taken += 1
    
    locate player.y+1, player.x+1:color 15:print chr$(2)
END SUB

SUB Display.Boarder()
    for i = 1 to 40
        locate 1,i+1:color 12:print chr$(196)
        locate 23,i+1:color 4:print chr$(196)
        if i < 22 then
            locate i+1,1:color 12:print chr$(179)
            locate i+1,42:color 4:print chr$(179)
        end if
    next
    locate 1,1:color 12:print "+"
    locate 1,42:color 12:print "+"
    locate 23,1:color 12:print "+"
    locate 23,42:color 4:print "+"
END SUB

SUB EndGame(Dead)
    cls
    if Dead = Mine then
        color 15
        print "YOU WALKED ON A MINE!"
    elseif Dead = NoTime then
        color 15
        print "YOU RAN OUT OF TIME!"        
    elseif Dead = FALSE then
        color 15
        print "YOU MADE IT THROUGH THE MINE FIELD"
        print "IN ONLY ";int(Timer - Time.old);" SECONDS"
        print "AND ONLY ";Moves.Taken;" MOVES"
    end if
    print:print:print
    print "Hit [Enter] to continue"
    do:P$ = inkey$:loop until P$ = chr$(13)
    Gameover = True
END SUB

SUB Instructions()
    cls
    Print "Keys"
    print "Use these to direct your player on the minefield."
    print "7 8 9 4 5 6 1 3"
    print
    print "game"
    print "must cross to the yellow # before time runs out"
    print "and without stepping on a mine."
    print
    print "Hit [Enter] to continue"
    do:P$ = inkey$:loop until P$ = chr$(13)
END SUB

I don't think is as good but I did have a working game quicker, which allowed me to do a little more work with menus and stuff. Theres another game which I want to make, it seemed quite popular in the last compo.

Enjoy.

Edit: I nearly forgot, I got the idea for this game from Mine Avoider released in 1996 by Amit Jain programmed in QB. Don't worry I didn't use any code from it Big Grin So much for a C= game.
Reply
#15
To Nixon this morning:

What do I think of your new game called Mine Field? I am telling you that it is a hair-raising (and much better!! Big Grin ) little one there, in that it reminds me of the game Minesweeper a bit — only that instead of using your mouse and clicking on things, you are *actually* using your character to navigate through the field littered with randomized mines that are waiting to spring their trap on you, all while trying to make it safely to that yellow pound sign ( # ), which takes a helluva lot of sheer skill and cleverness for you to master through! Man, now THAT is old-skool gone into some splendid originality there, and I give you a lot of extra points on that there, Nixon!!! (^_-)//

Also, the fact that you added the “Close Mines” indicator really adds to the challenge and pressure of the game itself to let the player know of the dangers to deal with and overcome, and that there is a time limit as well, too, just to keep things interesting! Cool

Overall, AWESOME JOB ON THIS, my man Nixon, and you are really shaping up into an excellent challenger here, you know that? :king: Your Mine Field entry is officially accepted from me!!

Check you later with another game from you soon, if you are ready to lay it on me again! Wink



APPLAUDING YOUR EXCELLENT WORK HERE,

[Image: file.php?id=32]
Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine” and “AFlib2 - Aura Flow Library 2”
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#16
Mr Polack, "Mine Field" is a pretty old game Smile and Nixon's version is pretty awesome.

Take a glance at the original here.

[Image: minedout.gif]
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#17
It's a nice game, but I think AAP is getting a bit carried away. 'Splendid originality'??
Reply
#18
To Kylemc:

For all I know there, I said ‘splendid originality’ at the time because I have not known that the original Sinclair version of the game even existed at all..... until just now, that is. Pardon me for that, I just gotta be more careful about my words, that is all. Wink



And to Na_th_an:

I *did not* know that there was an original Sinclair version of Mine Field.... in fact, in all my childhood, I have never even seen or heard of it at all. Ever. And so, I thank you so much for bringing this to my attention, man! Big Grin=b

You are absolutely right about Nixon’s version being awesome and all, because hey, I am all for it on that! :king:



See you both again, and thank you so much for some fine references that I never even knew about myself!!



[Image: file.php?id=32]
- Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine” and “AFlib2 - Aura Flow Library 2”
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#19
To all of you (this is VERY important!):

Right up front, pardon me for posting twice in a row here, because there is some stuff that I want to break to you tonight regarding this challenge! Wink

Since the time-frame towards the December 2005 issue of QB Express took WAY too long than was originally expected, I will be very fair to people wanting to enter this challenge by extending the deadline to the forthcoming deadline of the February 2006 issue of QB Express. Because then I am giving you some breathing distance in coming up with your 90-minute game in FB, that is for sure!

Be seeing you, and enjoy the extension!!! Big Grin !



[Image: file.php?id=32]
- Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine” and “AFlib2 - Aura Flow Library 2”



P.S. Rules have updated a bit for this challenge, so please see the top and opening post of this thread. Thanks!!! Cool=b

UPDATE (on 1-16-2006 at 2:24pm EST): When I originally written this message, I accidentally misquoted the deadline timing. Now, I adjusted the message to fit the proper deadline. So, final word is that the deadline for this challenge is the *exact* same as the forthcoming deadline for the February issue of QB Express. There we stand. Wink
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#20
To all of you (and pay real important attention, please! Big Grin ):

Pardon me again please for posting another post in a row in this thread, but I want to let you know right now that the deadline for this current challenge has just been revealed: Saturday, February 18, 2006. That is the EXACT same date as the deadline of the forthcoming February issue of QB Express, as promised. Wink

So far, I have gotten three (3) wonderful entries, and I am *really* looking forward to seeing more, so please refer to the very first post in this thread for more details on how to enter this interesting challenge if you haven’t already, alright? Smile=b

Thank you so much for your fine patrionage, and please continue to enjoy this one richly! ^-^



[Image: file.php?id=32]
- Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine” and “AFlib2 - Aura Flow Library 2”
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)