Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 HELMETLESS HARRY!!!!!!!!
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
petree08




PostPosted: Thu Dec 07, 2006 12:19 pm   Post subject: HELMETLESS HARRY!!!!!!!!

This is a game about a young man that likes collectiong coins and dodging rocks. But some body stole his blue helmet to sell it for apple sauce.

Kinda lame but it's a fun game

code:





const NUM_OF_ENIMIES := 10
const NUM_OF_COINS := 5
const MINX := -50
const Yline := 100

const SPEED2 := 2
const Speed := 5
const Midx := maxx div 2


var NumOfCoins : nat1 := 0
var Score : nat := 0
var X, Y : int
var Legangle : int := 160
var LegangleD : int := 1
var Legangle2 : int := 160
var LegangleD2 : int := -1

var Key : array char of boolean
var Head : int := 151
var HeadY : int := 1
var XE, YE : array 1 .. NUM_OF_ENIMIES of int
var XC, YC : array 1 .. NUM_OF_COINS of int
var PunchPad : int
var Hit : boolean := false
var HitC : array 1 .. NUM_OF_COINS of boolean
var Lives : int1 := 3
var Dead : boolean := false
var Font1 : int := Font.New ("Arial:30")
var Font2 : int := Font.New ("Arial:40")
var Font3 : int := Font.New ("Arial:20")


process Die

    sound (200, 100)
    sound (100, 100)
end Die

process PickUp
    sound (700, 100)

end PickUp
process OtherSide
    sound (800, 100)
    sound (600, 50)
end OtherSide

process Stomp
    sound (500, 200)
end Stomp

procedure Pause
    var Char : char
    Char := getchar
end Pause

setscreen ("graphics:max,max,nobuttonbar,offscreenonly")

colorback (black)
cls
X := Midx + 200
Y := Yline + 2
Font.Draw ("Missing Helmet Harry!", 10, 300, Font2, 14)
Font.Draw ("Peter Watt presents ...", 10, 500, Font1, 12)
Font.Draw ("(press any key to continue)", 10, 200, Font1, 14)
locatexy (X + 20, Y + Head + 10)
color (0)
put "Where's my blue helmut?"
% body
% head and spine
drawline (X, Y + 60, X, Y + Head - 10, 114)
drawfilloval (X, Y + Head, 10, 10, 114)
drawfilloval (X - 3, Y + Head + 5, 2, 2, 7)
drawfilloval (X + 3, Y + Head + 5, 2, 2, 7)

% Legs
%hips
drawline (X - 5, Legangle, X + 5, Legangle2, 114)
%Rightleg
drawline (X - 5, Legangle, X - 5, Legangle - 60, 114)
% left Leg
%drawdot (X, Y, 0)
drawline (X + 5, Legangle2, X + 5, Legangle2 - 60, 114)

% arms
drawline (X - 5, Legangle + 70, X + 5, Legangle2 + 70, 114)
drawline (X - 5, Legangle + 70, X - 15, Legangle + 30, 114)
drawline (X + 5, Legangle2 + 70, X + 15, Legangle2 + 30, 114)
View.Update
Pause

cls
color (12)
put ""
put ""
put "The rules of this game are very simple, try not to get hit."
put " Your goal is to collect as many coins as you can and bring them to"
put "the other side. Before you can collect the coins (yellow circles)"
put " you must first stomp on the coin button (the red circle thingy). But make sure "
put "you don't get hit by the falling rocks (grey circles)."
put "if you wish to pause the game press the enter button"
put "Use the arrow keys to move back and forth"
put ""
put "(press any key to continue)"
View.Update
Pause


for Index : 1 .. NUM_OF_ENIMIES
    randint (XE (Index), 1, maxx)
    randint (YE (Index), maxy, maxy + 200)
end for


for Index : 1 .. NUM_OF_COINS
    randint (XC (Index), 50, maxx - 50)
    HitC (Index) := false

end for

randint (PunchPad, 50, maxx - 50)
X := Midx
Y := Yline + 2
colorback (7)
color (0)
loop
    cls
    put "Score: ", Score
    put "Coins being carried: ", NumOfCoins
    put "Lives left: ", Lives

    for Index : 1 .. NUM_OF_ENIMIES
        YE (Index) := YE (Index) - SPEED2
        drawfilloval (XE (Index), YE (Index), 20, 20, 15)
        drawoval (XE (Index), YE (Index), 20, 20, 0)



        if YE (Index) <= Yline then
            randint (XE (Index), 50, maxx)
            randint (YE (Index), maxy, maxy + 200)
        end if




    end for
    Input.KeyDown (Key)

    if Key (KEY_RIGHT_ARROW) then
        X += Speed
        Legangle := Legangle + LegangleD
        Legangle2 += LegangleD2
        Head := Head + HeadY

    elsif Key (KEY_LEFT_ARROW) then

        Legangle := Legangle + LegangleD
        Legangle2 += LegangleD2
        Head := Head + HeadY

        X -= Speed
    end if


    if Legangle >= 180 or Legangle <= 140 then
        LegangleD := -LegangleD
    end if
    if Legangle2 >= 180 or Legangle2 <= 140 then
        LegangleD2 := -LegangleD2
    end if

    if X > maxx + 49 then
        fork OtherSide
        X := MINX
        randint (PunchPad, 50, maxx - 50)
        Score := Score + (NumOfCoins * 10)
        NumOfCoins := 0
        Hit := false


    end if
    if X < MINX - 1 then
        X := X + Speed
    end if
    % head bob
    if Head >= 165 or Head <= 150 then

        HeadY := -HeadY
    end if

    % ground
    drawline (1, Yline - 20, maxx, Yline - 20, 0)
    % body
    % head and spine
    drawline (X, Y + 60, X, Y + Head - 10, 114)
    drawfilloval (X, Y + Head, 10, 10, 114)
    drawfilloval (X - 3, Y + Head + 5, 2, 2, 7)
    drawfilloval (X + 3, Y + Head + 5, 2, 2, 7)

    % Legs
    %hips
    drawline (X - 5, Legangle, X + 5, Legangle2, 114)
    %Rightleg
    drawline (X - 5, Legangle, X - 5, Legangle - 60, 114)
    % left Leg
    %drawdot (X, Y, 0)
    drawline (X + 5, Legangle2, X + 5, Legangle2 - 60, 114)

    % arms
    drawline (X - 5, Legangle + 70, X + 5, Legangle2 + 70, 114)
    drawline (X - 5, Legangle + 70, X - 15, Legangle + 30, 114)
    drawline (X + 5, Legangle2 + 70, X + 15, Legangle2 + 30, 114)
    if Hit = false then
        drawfilloval (PunchPad, Yline - 20, 20, 5, 12)
    end if

    if X > PunchPad - 20 and X < PunchPad + 20 and Hit = false then

        Hit := true

        fork Stomp
        for Index : 1 .. NUM_OF_COINS
            randint (XC (Index), 50, maxx - 50)
            YC (Index) := Yline
            HitC (Index) := false

        end for
    end if

    for Index : 1 .. NUM_OF_ENIMIES
        if XE (Index) > X - 30 and XE (Index) < X + 30 and YE (Index) - 20 < Y + Head and Dead = false then
            fork Die
            Dead := true
            Lives := Lives - 1
            X := MINX
            randint (PunchPad, 50, maxx - 50)


            NumOfCoins := 0
            Hit := false
            Dead := false
        end if

    end for

    if Hit = true then



        for Index : 1 .. NUM_OF_COINS


            if HitC (Index) = false and X > XC (Index) - 10 and X < XC (Index) + 10 then
                HitC (Index) := true
                fork PickUp
                NumOfCoins := NumOfCoins + 1
            end if

            if HitC (Index) = false then

                drawfilloval (XC (Index), YC (Index), 10, 20, 14)
            end if
        end for
    end if
    if Key (KEY_ENTER) then

        Font.Draw ("The game is paused", 100, 500, Font1, 12)
        Font.Draw ("(press any key to resume game", 100, 300, Font1, 10)
        View.Update
        Pause
    end if
    View.Update
    Time.Delay (10)
    exit when Lives < 0 or Score > 500
end loop



cls
if Lives < 0 then

    Font.Draw ("You lost all your lives!", 50, 400, Font1, 12)

    Font.Draw ("You should have wore a..", 200, 300, Font1, 12)
    View.Update
    delay (2000)
    cls
    Font.Draw ("HELMET!!", 200, 200, Font2, 10)
else
    Font.Draw ("You won!", 50, 400, Font1, 12)
    Font.Draw ("And you didn't even need a...", 200, 300, Font1, 12)

    View.Update
    delay (2000)
    cls
    Font.Draw ("HELMET!!", 200, 200, Font2, 10)


end if


Sponsor
Sponsor
Sponsor
sponsor
GeoBoy




PostPosted: Thu Dec 07, 2006 9:39 pm   Post subject: Game

Pretty cool um


1.Sometimes his legs and arms wouldnt move and his head would just bob up and down,
2. If you go off the right side of the screen you appear on the left side, it should be the other way around too.
3.Also at the end I would put something like a play again button.

yeah its a cool game.
Hackmaster




PostPosted: Fri Dec 08, 2006 9:31 pm   Post subject: (No subject)

Hey, very nice job.

Petree... I have a question. What is your programming experience? you have littered this site with games, and they all have been pretty fun to play. I have nothing but good things to say about most of them. If you just started, you really need some sort of comendation!

Some suggestions for this game?

make the boulders fall faster as time goes on.

as soon as you collect all the coins, a new button should appear. don't make the person walk off the screen.

Congrats!
Prince Pwn




PostPosted: Sat Dec 09, 2006 12:13 am   Post subject: (No subject)

ow ur sound effects hurt my ears
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: