Frogger revisited

User projects written in or related to FreeBASIC.
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Jun 20, 2012 21:26

I am glad that you like it. The background tune should come soon.
Last edited by Roland Chastain on Jun 21, 2012 16:23, edited 1 time in total.
Dr_D
Posts: 2345
Joined: May 27, 2005 4:59
Contact:

Re: Frogger revisited

Postby Dr_D » Jun 22, 2012 23:51

awe man... why didn't you use the latest one when you added sound? :(
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Jun 23, 2012 8:54

Dr_D wrote:awe man... why didn't you use the latest one when you added sound? :(


It isn't too late. :-)

I've just tried your version. The frog moves are very well done. But instead of cars and crocs, there are still rectangles.
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Jul 30, 2012 2:21

Hello !

Here is a new edition of Frogger. Includes "rotozoom" !

Download
Last edited by Roland Chastain on Oct 19, 2013 5:23, edited 1 time in total.
Dr_D
Posts: 2345
Joined: May 27, 2005 4:59
Contact:

Re: Frogger revisited

Postby Dr_D » Aug 01, 2012 20:38

hehehe, Cool man. Are you going to make a complete game now?
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Aug 01, 2012 21:52

Dr_D wrote:hehehe, Cool man. Are you going to make a complete game now?


For me, I like it as it is. Maybe I will make some small corrections, but nothing else. If you have ideas to continue the project, please don't hesitate. You can start from this package if you want.
VANYA
Posts: 1245
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Frogger revisited

Postby VANYA » Aug 02, 2012 7:49

Beautiful.

1) Is not enough scoring.
2)The velocity can be increased with each passage to make it more difficult.

But maybe I should for nothing write because you have decided that the game you are satisfied :)

Anyway, well done Roland!
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Aug 02, 2012 20:21

Thank you, Vanya. The most part was made by others : I only stuck the pieces and tried to make a clean package. It's a team project, which has started one year ago with a code example written by BasicCoder2.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Re: Frogger revisited

Postby agamemnus » Nov 25, 2012 17:16

I played the version on the FreeBASIC Games Directory, but the frog often refuses to respond to my keyboard commands. I'm using Windows 7..
Jonge
Posts: 126
Joined: Jul 17, 2012 17:51
Location: Norway
Contact:

Re: Frogger revisited

Postby Jonge » Nov 25, 2012 19:58

agamemnus wrote:I played the version on the FreeBASIC Games Directory, but the frog often refuses to respond to my keyboard commands. I'm using Windows 7..


I had a similar problem when testing my game project Brick Mayhem on a Win7 computer. I could not navigate the main menu when in full screen. Maybe a GfxLib problem on Win7?
Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Oct 19, 2013 5:20

Hello gentlemen !

Here is a new Frogger edition.

Image

I made small modifications here and there, but the most important is that the program now uses FBSound.
BasicCoder2
Posts: 2817
Joined: Jan 01, 2009 7:03

Re: Frogger revisited

Postby BasicCoder2 » Oct 20, 2013 4:58

Roland Chastain wrote:Hello gentlemen !
Here is a new Frogger
I made small modifications here and there, but the most important is that the program now uses FBSound.


I did start making better graphics then I lost momentum on the project :) One fix is that the sprites should exit and enter the screen not just turn around. I discovered that FreeBasic's graphics can handle images with coordinates outside the screen coordinates. Below is a demo but apart from the turtle I haven't had time to convert all the graphics to data statements so all you see are turtles.

Run this to make a crude background image.

Code: Select all

'color used by MSPaint
const cOrange = rgb(255,127,39)
const cYellow = rgb(255,242,0)
const cLime   = rgb(181,230,29)
const cBlue   = rgb(0,162,232)
const cLightBlue = rgb(153,217,234)
const cDarkGreen = rgb(34,177,76)
const cRed       = rgb(237,28,36)
const cLightGray = rgb(195,195,195)

screenres 640,480,32
'display text ribbon
line (0,0)-(639,40),cOrange,bf
line (0,41)-(639,80),cDarkGreen,bf
line (0,81)-(639,240),cLightBlue,bf
line (0,241)-(639,280),cDarkGreen,bf
line (0,281)-(639,440),cLightGray,bf
line (0,441)-(639,479),cDarkGreen,bf

for y as integer = 0 to 480 step 40
    line (0,y)-(639,y+40),rgb(0,0,0),b
next y

bsave "fBackGround.bmp",0

print "DONE"
sleep


Run this to make turtleR1.bmp and turtleL1.bmp in current directory

Code: Select all



#include "fbgfx.bi"
using fb
screenres 640,480,32  'before making any images

'images of pieces
dim shared as FB.Image ptr turtleR2
turtleR2 = imagecreate(59,37,0)
dim shared as FB.Image ptr turtleL2
turtleL2 = imagecreate(59,37,0)

dim as string char

for j as integer = 0 to 36
    read char
    for i as integer = 0 to 58
        if mid(char,i+1,1) = "#" then  'black
            pset turtleR2,(i,j),rgb(0,0,0)
            'pset (i+100,j),rgb(0,0,0)
        end if
        if mid(char,i+1,1)  = "." then 'brown
            pset turtleR2,(i,j),rgb(185,122,87)
            'pset (i+100,j),rgb(185,122,87)
        end if
        if mid(char,i+1,1)  = "*" then 'yellow
            pset turtleR2,(i,j),rgb(255,242,0)
            'pset (i+100,j),rgb(255,242,0)
        end if
        if mid(char,i+1,1)  = "'" then 'lime
            pset turtleR2,(i,j),rgb(181,230,29)
            'pset (i+100,j),rgb(181,230,29)
        end if
        if mid(char,i+1,1)  = "+" then 'white
            pset turtleR2,(i,j),rgb(255,255,255)
            'pset (i+100,j),rgb(255,255,255)
        end if
        if mid(char,i+1,1)  = " " then 'magenta
            pset turtleR2,(i,j),rgb(255,0,255)
            'pset (i+100,j),rgb(255,0,255)
        end if
    next i
next j
print "DONE"


put (100,100),turtleR2,pset

bsave "turtleR2.bmp",turtleR2
sleep
restore
'=========================================
for j as integer = 0 to 36
    read char
    for i as integer = 0 to 58
        if mid(char,i+1,1) = "#" then  'black
            pset turtleL2,(58-i,j),rgb(0,0,0)
            'pset (i+100,j),rgb(0,0,0)
        end if
        if mid(char,i+1,1)  = "." then 'brown
            pset turtleL2,(58-i,j),rgb(185,122,87)
            'pset (i+100,j),rgb(185,122,87)
        end if
        if mid(char,i+1,1)  = "*" then 'yellow
            pset turtleL2,(58-i,j),rgb(255,242,0)
            'pset (i+100,j),rgb(255,242,0)
        end if
        if mid(char,i+1,1)  = "'" then 'lime
            pset turtleL2,(58-i,j),rgb(181,230,29)
            'pset (i+100,j),rgb(181,230,29)
        end if
        if mid(char,i+1,1)  = "+" then 'white
            pset turtleL2,(58-i,j),rgb(255,255,255)
            'pset (i+100,j),rgb(255,255,255)
        end if
        if mid(char,i+1,1)  = " " then 'magenta
            pset turtleL2,(58-i,j),rgb(255,0,255)
            'pset (i+100,j),rgb(255,0,255)
        end if
    next i
next j
print "DONE"


put (100,100),turtleL2,pset

bsave "turtleL2.bmp",turtleL2

sleep
end


end

DATA "                                                           "
DATA "                                                           "
DATA "                                       ###                 "
DATA "      ###                             ##''#                "
DATA "    ###'###                          #'''''#               "
DATA "    #'''''##                         #'''''#               "
DATA "   #'''''''#     #############       #'''''#               "
DATA "   ##''''''##  ########....######   ##''''##               "
DATA "    ##''''''#####..###......##...####''''##                "
DATA "     ####'''##......#.......#.....##''''##                 "
DATA "        ######.....##.......##......##'##                  "
DATA "         #...##....##.......##.......###                   "
DATA "       ##.....##..####.......#......##..#         #####    "
DATA "      ##......#####..##....#####...##....#       #*****#   "
DATA "      #......####.....##.###...#####.....#      ##**###*#  "
DATA "    ###....###..##.....###......###......#     #'#***##*#  "
DATA "  ##''#..###.....##...####......####.....######'''#****#'#+"
DATA " #''''##########..#####..#....##...###..#''''''''''####'''#"
DATA "#'''''###..######.##.....######..###.####'''''''''''''''''#"
DATA " #''''##########..#####..#....##...###..#''''''''''####'''#"
DATA "  ##''#..###.....##...####......####.....######'''#****#'# "
DATA "    ###....###..##.....###......###......#     #'#***##*#  "
DATA "      #......####.....##.###...#####.....#      ##**###*#  "
DATA "      ##......#####..##....#####...##....#       #*****#   "
DATA "       ##.....##..####.......#......##..#         #####    "
DATA "         #...##....##.......##.......###                   "
DATA "        ######.....##.......##......##'##                  "
DATA "     ####'''##......#.......#.....##''''##                 "
DATA "    ##''''''#####..###......##...####''''##                "
DATA "   ##''''''##  ########....######   ##''''#                "
DATA "   #'''''''#     #############       #'''''#               "
DATA "    #'''''##                         #'''''#               "
DATA "    ###'###                          #'''''#               "
DATA "      ###                             ##''#                "
DATA "                                       ###                 "
DATA "                                                           "
DATA "                                                           "


Run this to make turtleR2.bmp and turtle.L2.bmp in the current directory.

Code: Select all

#include "fbgfx.bi"
using fb
screenres 640,480,32  'before making any images

'images of pieces
dim shared as FB.Image ptr turtleR1
turtleR1 = imagecreate(59,37,0)

dim shared as FB.Image ptr turtleL1
turtleL1 = imagecreate(59,37,0)

dim as string char

for j as integer = 0 to 36
    read char
    for i as integer = 0 to 58
        if mid(char,i+1,1) = "#" then  'black
            pset turtleR1,(i,j),rgb(0,0,0)
            'pset (i+100,j),rgb(0,0,0)
        end if
        if mid(char,i+1,1)  = "." then 'brown
            pset turtleR1,(i,j),rgb(185,122,87)
            'pset (i+100,j),rgb(185,122,87)
        end if
        if mid(char,i+1,1)  = "*" then 'yellow
            pset turtleR1,(i,j),rgb(255,242,0)
            'pset (i+100,j),rgb(255,242,0)
        end if
        if mid(char,i+1,1)  = "'" then 'lime
            pset turtleR1,(i,j),rgb(181,230,29)
            'pset (i+100,j),rgb(181,230,29)
        end if
        if mid(char,i+1,1)  = "+" then 'white
            pset turtleR1,(i,j),rgb(255,255,255)
            'pset (i+100,j),rgb(255,255,255)
        end if
        if mid(char,i+1,1)  = " " then 'magenta
            pset turtleR1,(i,j),rgb(255,0,255)
            'pset (i+100,j),rgb(255,0,255)
        end if
    next i
next j
print "DONE  R1"


put (100,100),turtleR1,pset

bsave "turtleR1.bmp",turtleR1

sleep
restore
'=========================================
for j as integer = 0 to 36
    read char
    for i as integer = 0 to 58
        if mid(char,i+1,1) = "#" then  'black
            pset turtleL1,(58-i,j),rgb(0,0,0)
            'pset (i+100,j),rgb(0,0,0)
        end if
        if mid(char,i+1,1)  = "." then 'brown
            pset turtleL1,(58-i,j),rgb(185,122,87)
            'pset (i+100,j),rgb(185,122,87)
        end if
        if mid(char,i+1,1)  = "*" then 'yellow
            pset turtleL1,(58-i,j),rgb(255,242,0)
            'pset (i+100,j),rgb(255,242,0)
        end if
        if mid(char,i+1,1)  = "'" then 'lime
            pset turtleL1,(58-i,j),rgb(181,230,29)
            'pset (i+100,j),rgb(181,230,29)
        end if
        if mid(char,i+1,1)  = "+" then 'white
            pset turtleL1,(58-i,j),rgb(255,255,255)
            'pset (i+100,j),rgb(255,255,255)
        end if
        if mid(char,i+1,1)  = " " then 'magenta
            pset turtleL1,(58-i,j),rgb(255,0,255)
            'pset (i+100,j),rgb(255,0,255)
        end if
    next i
next j
print "DONE"


put (100,100),turtleL1,pset

bsave "turtleL1.bmp",turtleL1

sleep
end


DATA "                                  ##                       "
DATA "        ##                       #''#                      "
DATA "       #''#                      #'''#                     "
DATA "      #''''#                    #'''''#                    "
DATA "     #'''''#                    #'''''#                    "
DATA "     #''''''#                   #''''''#                   "
DATA "     #''''''#    #############   #'''''#                   "
DATA "     ##'''''#  ########....###### #''''#                   "
DATA "      ##''''#####..###......##...##''''#                   "
DATA "       ###''##......#.......#.....##'''#                   "
DATA "         #####.....##.......##......##'#                   "
DATA "         #...##....##.......##.......###                   "
DATA "       ##.....##..####.......#......##..#         #####    "
DATA "      ##......#####..##....#####...##....#       #*****#   "
DATA "      #......####.....##.###...#####.....#      ##**###*#  "
DATA "    ###....###..##.....###......###......#     #'#***##*#  "
DATA "  ##''#..###.....##...####......####.....######'''#****#'#+"
DATA " #''''##########..#####..#....##...###..#''''''''''####'''#"
DATA "#'''''###..######.##.....######..###.####'''''''''''''''''#"
DATA " #''''##########..#####..#....##...###..#''''''''''####'''#"
DATA "  ##''#..###.....##...####......####.....######'''#****#'# "
DATA "    ###....###..##.....###......###......#     #'#***##*#  "
DATA "      #......####.....##.###...#####.....#      ##**###*#  "
DATA "      ##......#####..##....#####...##....#       #*****#   "
DATA "       ##.....##..####.......#......##..#         #####    "
DATA "         #...##....##.......##.......###                   "
DATA "         #####.....##.......##......##'#                   "
DATA "       ###''##......#.......#.....##'''#                   "
DATA "      ##''''#####..###......##...##''''#                   "
DATA "     ##'''''#  ########....###### #''''#                   "
DATA "     #''''''#    #############   #'''''#                   "
DATA "     #''''''#                   #''''''#                   "
DATA "     #'''''#                    #'''''#                    "
DATA "      #''''#                    #'''''#                    "
DATA "       #''#                      #'''#                     "
DATA "        ##                       #''#                      "
DATA "                                  ##                       "


Now the demo program that uses the above graphics. Note the sprite can be placed off or partly off the screen.

Code: Select all

#include "fbgfx.bi"
using fb

const SCRW = 640
const SCRH = 480
screenres SCRW,SCRH,32
color rgb(0,0,0),rgb(255,255,255)
cls

type aSPRITE4      'FOUR images
    as integer x
    as integer y
    as integer w
    as integer h
    as integer dx
    as integer dy
    as integer f              '# of current frame
    as FB.Image ptr image(4)  'four images
end type

dim shared as aSPRITE4 turtle(8)  'four images

for i as integer = 0 to 7
    read turtle(i).x
    read turtle(i).y
    turtle(i).w = 59
    turtle(i).h = 37
    if i > 3 then
        turtle(i).dx = -1
    else
        turtle(i).dx = 1
    end if
    turtle(i).dy = 0
    turtle(i).f  = 0   'first image to display
    turtle(i).image(0)= ImageCreate(turtle(i).w,turtle(i).h,0)
    turtle(i).image(1)= ImageCreate(turtle(i).w,turtle(i).h,0)
    turtle(i).image(2)= ImageCreate(turtle(i).w,turtle(i).h,0)
    turtle(i).image(3)= ImageCreate(turtle(i).w,turtle(i).h,0)
    bload "turtleR1.bmp",turtle(i).image(0)  'turtle going right
    bload "turtleR2.bmp",turtle(i).image(1)
    bload "turtleL1.bmp",turtle(i).image(2)  'turtle going left
    bload "turtleL2.bmp",turtle(i).image(3)  '
next i

dim shared as FB.Image ptr backGround
backGround = ImageCreate(640,480,0)
'bload "C:/FreeBasic/GAMES/BITMAPS/Background.bmp",backGround
bload "fBackGround.bmp",backGround

dim shared as double displayCounter,frameCounter
displayCounter = timer
frameCounter = timer

sub display()
    screenlock()
    put (0,0),backGround,pset
    for i as integer = 0 to 7
        if turtle(i).dx = 1 then
            put (turtle(i).x,turtle(i).y),turtle(i).image(turtle(i).f),trans
        else
            put (turtle(i).x,turtle(i).y),turtle(i).image(turtle(i).f+2),trans
        end if
    next i
   
    displayCounter = timer  'reset display counter
    locate 3,30
    print "HIT ESC KEY TO EXIT"
    screenunlock()
end sub

sub upDate()
    'move sprite
    for i as integer = 0 to 7
        turtle(i).x = turtle(i).x + turtle(i).dx
        'check range
        if turtle(i).x > SCRW + turtle(i).w or turtle(i).x < - turtle(i).w then
            turtle(i).dx = -turtle(i).dx 'reverse
        end if
    next i

   
    if timer - frameCounter > .5 then
        for i as integer = 0 to 7
            if turtle(i).f = 0 then turtle(i).f = 1 else turtle(i).f = 0 'toggle images
        next i
        frameCounter = timer
    end if
   
end sub

' **********   MAIN LOOP  **********
do
    if timer - displayCounter > 0.05 then
        upDate()       
        display()
    end if
loop until multikey(&H01)

' ************************************

sleep

for i as integer = 0 to 7
    imageDestroy turtle(i).image(0)
    imageDestroy turtle(i).image(1)
next i

data -60,82,130,82,320,82,510,82
data 160,162,360,162,520,162,660,162

Roland Chastain
Posts: 733
Joined: Nov 24, 2011 19:49
Location: Dakar, Senegal
Contact:

Re: Frogger revisited

Postby Roland Chastain » Oct 21, 2013 2:24

BasicCoder2 wrote:One fix is that the sprites should exit and enter the screen not just turn around. I discovered that FreeBasic's graphics can handle images with coordinates outside the screen coordinates. Below is a demo but apart from the turtle I haven't had time to convert all the graphics to data statements so all you see are turtles.


Thank you for the idea and for the demo. Nice swimming turtles.

Code: Select all

  sCar(1).dx = -1'1
  sCar(2).dx = -1'1


Code: Select all

    for i as integer = 1 to 4
      'if sCar(i).x < 1 or sCar(i).x > 330 then sCar(i).dx = - sCar(i).dx
      'if sCar(i).x < 0 - sCar(i).w then sCar(i).x = 371
      'if sCar(i).x > 371 then sCar(i).x = 0 - sCar(i).w
      if sCar(i).x < 0 - sCar(i).w - int(50 * rnd) then sCar(i).x = 371
      if sCar(i).x > 371 + int(50 * rnd) then sCar(i).x = 0 - sCar(i).w
    next i
D.J.Peters
Posts: 7101
Joined: May 28, 2005 3:28
Location: Germany

Re: Frogger revisited

Postby D.J.Peters » Oct 22, 2013 9:35

Good job, reminds me on m'y old Commodore C64.

Joshy

Return to “Projects”

Who is online

Users browsing this forum: grindstone and 1 guest