News:

Welcome to RetroCoders Community

Main Menu

Another retro game - Clay Pigeon!

Started by electricwalrus, Jun 22, 2023, 11:21 AM

Previous topic - Next topic

electricwalrus

Hi guys

I've coded another simple program for you all to have a look at. Its called "Clay Pigeon" and its hard! :) Very simple program as you will see. I can get 300 points in one game. The code is very simple and should be an easy port too :D Enjoy!

electricwalrus

electricwalrus

#lang "fblite"
Option Gosub
Option Explicit

Dim i as byte
Dim ii as byte
Dim score as integer
Dim lives as byte

Screen 17
Color 14
Print "Shoot the clay pigeon!"
Print "Press the space bar to fire gun and shoot the object"
Sleep

score = 0
lives = 5

start:
Cls
Gosub UpdateScore
Locate 1,1
COlor 9
Print "Shoot the clay pigeon!";
color 14
Locate 25,65
Print "^";
color 10
Beep
for i = 2 to 79   
    locate 2,i-1
    Print " " + chr(4);
    sleep 40
    If MultiKey(1) then end
    if inkey <> "" AND i > 5 then Goto Shoot
next
Locate 25,1
Color 15
Print "The Clay Pigeon Got Away!";
sleep 3000
goto start


shoot:
for ii = 24 to 1 Step -1
    Locate ii+1,65
    Print " ";
    Locate ii,65
    color 10
    Print "^";
    Sleep 40
next
Locate 25,1
Color 15
if i = 65 then 
    Print "You got it! Great work!";
    Score = Score + 100
    Gosub updatescore
    Beep
Else
    Print "Your Missed!";
    lives = lives - 1
    Gosub updatescore
    If lives = 0 then
        Cls
        Color 15
        Print "Game Over - Final Score: " + str(score)
        Sleep 3000
        End
    end if
end if
Sleep 3000
Goto start

updatescore:
Color 11
locate 24,1
Print "Score: " + str(score) + " - Lives: " + str(lives)
return

ron77

Hello, electricwalrus !!!

Cool game! thanks for sharing :)


johnno56

Oh... This is a frustratingly simple game! It certainly puts my eye/hand coordination to the test... But still a very cool game...  I like the way the 'pigeon' stops when it is shot at... Kind of like a deer in the headlights of an oncoming truck... lol

Looking forward to your next challenge... Moo Ha Ha Ha....
May your journey be free of incident.  Live long and prosper.

CharlieJV

I like that kind of stuff.  Very cool, very easy to port: BAM version.

johnno56

Minor suggestion (or two). Each 'level' have the 'player' reposition randomly in the right half of the screen. Perhaps slightly vary the speed of the pigeon for each level. (prevents the player 'predicting' the pigeons position). If the pigeon speed is adopted, the number of lives, may have to be increased as the game may seem a little too short.

I am curious... is there any reason for the pigeon to 'stop' when the player shoots?

In case I forget... Nice conversion... :)
May your journey be free of incident.  Live long and prosper.

electricwalrus

It's like that because thats how the old amstrad version used to work. Its a simple program for people to learn. Like most of my work its so people can understand the code and how it works. fairlystraightforward

feel free to modify it and send up your own version

and thank you for your positive feedback. i appreciate that.

ZXDunny

Quote from: electricwalrus on Jun 23, 2023, 08:10 AMfeel free to modify it and send up your own version

Challenge Accepted! I love this sort of thing. It provides a framework for improvement and learning.

johnno56

Amstrad? I had one of those! Very cool machine! My emulator gets quite a workout!
May your journey be free of incident.  Live long and prosper.

mysoft

hehe i just updated it a bit (same logic) to use regular freebasic mode
but yeah with fixed pattern once you get used it gets easier (i got 800 while testing this morning.)
the harder part was to NOT do ballistics xD

oh btw i cleared the keyboard buffer before waiting for the shoot point, to avoid the keyboard auto-shot "bug" that it had

dim shared as long i,score=0,lives=5

Screen 17 : Color 14
Print "Shoot the clay pigeon!"
Print "Press the space bar to fire gun and shoot the object"
Sleep

#define PrintAt(_row,_col,_color) color _color : locate _row , _col : print

sub updatescore()
  PrintAt(24,1,1) "Score: " & score & " - Lives: " & lives
end sub

do 'start:
  do
    
    Cls
    UpdateScore()
    PrintAt( 1, 1, 9) "Shoot the clay pigeon!";
    PrintAt(25,65,14) "^";
    
    while len(inkey): wend    
    Beep
    for i = 2 to 79   
        PrintAt( 2 , i-1 , 10 ) !" \4";
        sleep 40
        If MultiKey(1) then end
        if i>5 andalso len(inkey) then exit do
    next
    Locate 25,1 : Color 15 : Print "The Clay Pigeon Got Away!";
    sleep 3000
  loop    
    
  color 10
  for ii as long = 24 to 1 Step -1
    printAt( ii+1 , 65 , 10 ) " ";
    printAt( ii   , 65 , 10 ) "^";
    Sleep 40
  next
  
  if i = 65 then 
    printAt( 25 , 1 , 15 ) "You got it! Great work!";
    Score = Score + 100 : updatescore() : Beep
  Else
    printAt( 25 , 1 , 15 ) "You Missed!";
    lives = lives - 1 : updatescore()
    If lives = 0 then
      Cls : Print "Game Over - Final Score: " & score
      Sleep 15000 : system      
    end if
  end if
  
  Sleep 3000

loop